From 1e8509d8ef3b4d80dffa72bc087f5de6002ff845 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 19 Jul 2021 18:49:27 +1000 Subject: [PATCH] SPIGOT-3725, SPIGOT-6638, MC-136917: Properly clear tile entities before replacing By: DerFrZocker --- .../main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index fd257e56e2..cc95f43533 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -19,7 +19,6 @@ import net.minecraft.world.level.GeneratorAccess; import net.minecraft.world.level.RayTrace; import net.minecraft.world.level.biome.BiomeBase; import net.minecraft.world.level.block.BlockRedstoneWire; -import net.minecraft.world.level.block.BlockTileEntity; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.TileEntity; import net.minecraft.world.level.block.state.IBlockData; @@ -74,10 +73,6 @@ public class CraftBlock implements Block { return new CraftBlock(world, position); } - private net.minecraft.world.level.block.Block getNMSBlock() { - return getNMS().getBlock(); - } - public net.minecraft.world.level.block.state.IBlockData getNMS() { return world.getType(position); } @@ -189,7 +184,7 @@ public class CraftBlock implements Block { public boolean setTypeAndData(final IBlockData blockData, final boolean applyPhysics) { // SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup - if (!blockData.isAir() && blockData.getBlock() instanceof BlockTileEntity && blockData.getBlock() != getNMSBlock()) { + if (getNMS().isTileEntity()) { // SPIGOT-3725 always remove old tile entity // SPIGOT-4612: faster - just clear tile if (world instanceof net.minecraft.world.level.World) { ((net.minecraft.world.level.World) world).removeTileEntity(position);