use of net.minecraft.world.level.block.entity.TileEntityEnderChest in project Crazy-Crates by Crazy-Crew.
the class NMS_Support method openChest.
@Override
public void openChest(Block block, boolean open) {
Material type = block.getType();
if (type == Material.CHEST || type == Material.TRAPPED_CHEST || type == Material.ENDER_CHEST) {
World world = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition position = new BlockPosition(block.getX(), block.getY(), block.getZ());
if (block.getType() == Material.ENDER_CHEST) {
TileEntityEnderChest tileChest = (TileEntityEnderChest) world.getBlockEntity(position, false);
world.a(position, tileChest.q(), 1, open ? 1 : 0);
} else {
TileEntityChest tileChest = (TileEntityChest) world.getBlockEntity(position, false);
world.a(position, tileChest.q(), 1, open ? 1 : 0);
}
}
}
Aggregations