Boost TileEntity clear performance, with extra boost on Paper

This commit is contained in:
NotMyFault 2021-02-19 19:58:36 +01:00
parent 14c0d4a5e8
commit e8169afd64
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C

View File

@ -248,8 +248,12 @@ public class BukkitWorld extends AbstractWorld {
@Override @Override
public boolean clearContainerBlockContents(BlockVector3 pt) { public boolean clearContainerBlockContents(BlockVector3 pt) {
checkNotNull(pt);
if (getBlock(pt).getBlockType().getMaterial().hasContainer()) {
return false;
}
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
BlockState state = block.getState(); BlockState state = PaperLib.getBlockState(block, false).getState();
if (!(state instanceof InventoryHolder)) { if (!(state instanceof InventoryHolder)) {
return false; return false;
} }