Search in sources :

Example 6 with TileEntityChest

use of net.minecraft.world.level.block.entity.TileEntityChest in project WildChests by BG-Software-LLC.

the class NMSAdapter_v1_17_R1 method playChestAction.

@Override
public void playChestAction(Location location, boolean open) {
    World world = ((CraftWorld) location.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(location.getX(), location.getY(), location.getZ());
    TileEntityChest tileChest = (TileEntityChest) world.getTileEntity(blockPosition);
    if (tileChest != null)
        world.playBlockAction(blockPosition, tileChest.getBlock().getBlock(), 1, open ? 1 : 0);
}
Also used : TileEntityChest(net.minecraft.world.level.block.entity.TileEntityChest) BlockPosition(net.minecraft.core.BlockPosition) World(net.minecraft.world.level.World) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld)

Aggregations

BlockPosition (net.minecraft.core.BlockPosition)6 World (net.minecraft.world.level.World)6 TileEntityChest (net.minecraft.world.level.block.entity.TileEntityChest)6 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)2 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)2 CraftWorld (org.bukkit.craftbukkit.v1_18_R2.CraftWorld)2 TileEntityEnderChest (net.minecraft.world.level.block.entity.TileEntityEnderChest)1 Material (org.bukkit.Material)1