Fix Block.setType alone being treated as legacy

This commit is contained in:
md_5 2018-07-18 16:59:41 +10:00
parent d48ecdeb45
commit 9c98002856

View File

@ -130,7 +130,7 @@ public class CraftBlock implements Block {
@Override
public void setType(Material type, boolean applyPhysics) {
setTypeAndData(type, (byte) 0, applyPhysics);
setBlockData(type.createBlockData(), applyPhysics);
}
@Override
@ -143,10 +143,6 @@ public class CraftBlock implements Block {
setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
}
public boolean setTypeAndData(final Material type, final byte data, final boolean applyPhysics) {
return setTypeAndData(CraftMagicNumbers.getBlock(type, data), applyPhysics);
}
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()) {
@ -529,7 +525,7 @@ public class CraftBlock implements Block {
if (itemCausesDrops(item)) {
return breakNaturally();
} else {
return setTypeAndData(Material.AIR, (byte) 0, true);
return setTypeAndData(Blocks.AIR.getBlockData(), true);
}
}