Digging packet DOS mitigation

This commit is contained in:
IzzelAliz 2021-12-15 21:50:04 +08:00
parent 249515291b
commit 6d45da2bab
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338

View File

@ -88,6 +88,9 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana
*/
@Overwrite
public void handleBlockBreakAction(BlockPos blockPos, ServerboundPlayerActionPacket.Action action, Direction direction, int i) {
if (!this.level.hasChunkAt(blockPos)) {
return;
}
double d0 = this.player.getX() - (blockPos.getX() + 0.5);
double d2 = this.player.getY() - (blockPos.getY() + 0.5) + 1.5;
double d3 = this.player.getZ() - (blockPos.getZ() + 0.5);