3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Fix Block.setType alone being treated as legacy

Dieser Commit ist enthalten in:
md_5 2018-07-18 16:59:41 +10:00
Ursprung d48ecdeb45
Commit 9c98002856

Datei anzeigen

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