mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 02:35:49 +01:00
Only remove tile entity if block type changes
By: md_5 <git@md-5.net>
This commit is contained in:
parent
353c9f5090
commit
e4b545e047
1 changed files with 2 additions and 2 deletions
|
@ -183,8 +183,9 @@ public class CraftBlock implements Block {
|
|||
}
|
||||
|
||||
public boolean setTypeAndData(final IBlockData blockData, final boolean applyPhysics) {
|
||||
IBlockData old = getNMS();
|
||||
// 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 (getNMS().isTileEntity()) { // SPIGOT-3725 always remove old tile entity
|
||||
if (old.isTileEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
// SPIGOT-4612: faster - just clear tile
|
||||
if (world instanceof net.minecraft.world.level.World) {
|
||||
((net.minecraft.world.level.World) world).removeTileEntity(position);
|
||||
|
@ -196,7 +197,6 @@ public class CraftBlock implements Block {
|
|||
if (applyPhysics) {
|
||||
return world.setTypeAndData(position, blockData, 3);
|
||||
} else {
|
||||
IBlockData old = world.getType(position);
|
||||
boolean success = world.setTypeAndData(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success) {
|
||||
world.getMinecraftWorld().notify(
|
||||
|
|
Loading…
Reference in a new issue