From 6b34eb453dc86da24f05a6ffdddce84b650b61f5 Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Sun, 8 Nov 2020 22:54:46 +0800 Subject: [PATCH] Defensive coding to prevent client chunk loading --- .../logistics/block/mechanicalArm/ArmPlacementPacket.java | 4 ++-- .../schematics/packet/ConfigureSchematicannonPacket.java | 2 +- .../foundation/networking/TileEntityConfigurationPacket.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmPlacementPacket.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmPlacementPacket.java index dcc51b7f7..7ed4f378e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmPlacementPacket.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmPlacementPacket.java @@ -53,10 +53,10 @@ public class ArmPlacementPacket extends SimplePacketBase { if (player == null) return; World world = player.world; - if (world == null) + if (world == null || !world.isBlockPresent(pos)) return; TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity == null || !(tileEntity instanceof ArmTileEntity)) + if (!(tileEntity instanceof ArmTileEntity)) return; ArmTileEntity arm = (ArmTileEntity) tileEntity; diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java index c69f1f822..4a5984e77 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java @@ -52,7 +52,7 @@ public class ConfigureSchematicannonPacket extends SimplePacketBase { if (player == null) return; World world = player.world; - if (world == null) + if (world == null || !world.isBlockPresent(pos)) return; TileEntity tileEntity = world.getTileEntity(pos); diff --git a/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java b/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java index ba3bd1f3b..8260a5821 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java @@ -39,7 +39,7 @@ public abstract class TileEntityConfigurationPacket return; World world = player.world; - if (world == null || world.getTileEntity(pos) == null) + if (world == null || !world.isBlockPresent(pos)) return; TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof SyncedTileEntity) {