Defensive coding to prevent client chunk loading

This commit is contained in:
Snownee 2020-11-08 22:54:46 +08:00
parent 2e3100be9a
commit 6b34eb453d
3 changed files with 4 additions and 4 deletions

View file

@ -53,10 +53,10 @@ public class ArmPlacementPacket extends SimplePacketBase {
if (player == null) if (player == null)
return; return;
World world = player.world; World world = player.world;
if (world == null) if (world == null || !world.isBlockPresent(pos))
return; return;
TileEntity tileEntity = world.getTileEntity(pos); TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity == null || !(tileEntity instanceof ArmTileEntity)) if (!(tileEntity instanceof ArmTileEntity))
return; return;
ArmTileEntity arm = (ArmTileEntity) tileEntity; ArmTileEntity arm = (ArmTileEntity) tileEntity;

View file

@ -52,7 +52,7 @@ public class ConfigureSchematicannonPacket extends SimplePacketBase {
if (player == null) if (player == null)
return; return;
World world = player.world; World world = player.world;
if (world == null) if (world == null || !world.isBlockPresent(pos))
return; return;
TileEntity tileEntity = world.getTileEntity(pos); TileEntity tileEntity = world.getTileEntity(pos);

View file

@ -39,7 +39,7 @@ public abstract class TileEntityConfigurationPacket<TE extends SyncedTileEntity>
return; return;
World world = player.world; World world = player.world;
if (world == null || world.getTileEntity(pos) == null) if (world == null || !world.isBlockPresent(pos))
return; return;
TileEntity tileEntity = world.getTileEntity(pos); TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof SyncedTileEntity) { if (tileEntity instanceof SyncedTileEntity) {