use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_16_R3 method updateTileEntity.
@Override
public void updateTileEntity(Chest chest) {
Location loc = chest.getLocation();
World world = ((CraftWorld) loc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
TileEntity tileEntity = world.getTileEntity(blockPosition);
TileEntityWildChest tileEntityWildChest;
if (tileEntity instanceof TileEntityWildChest) {
tileEntityWildChest = (TileEntityWildChest) tileEntity;
((WChest) chest).setTileEntityContainer(tileEntityWildChest);
} else {
tileEntityWildChest = new TileEntityWildChest(chest, world, blockPosition);
world.removeTileEntity(blockPosition);
world.setTileEntity(blockPosition, tileEntityWildChest);
}
}
use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_16_R3 method removeTileEntity.
@Override
public void removeTileEntity(Chest chest) {
Location loc = chest.getLocation();
World world = ((CraftWorld) loc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
TileEntity currentTileEntity = world.getTileEntity(blockPosition);
if (currentTileEntity instanceof TileEntityWildChest)
world.removeTileEntity(blockPosition);
}
use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_18_R2 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) getBlockEntity(world, blockPosition);
if (tileChest != null)
blockEvent(world, blockPosition, getBlock(NMSMappings_v1_18_R2.getBlockState(tileChest)), 1, open ? 1 : 0);
}
use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_8_R3 method updateTileEntity.
@Override
public void updateTileEntity(Chest chest) {
Location loc = chest.getLocation();
World world = ((CraftWorld) loc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
TileEntity tileEntity = world.getTileEntity(blockPosition);
TileEntityWildChest tileEntityWildChest;
if (tileEntity instanceof TileEntityWildChest) {
tileEntityWildChest = (TileEntityWildChest) tileEntity;
((WChest) chest).setTileEntityContainer(tileEntityWildChest);
} else {
tileEntityWildChest = new TileEntityWildChest(chest, world, blockPosition);
}
world.setTileEntity(blockPosition, tileEntityWildChest);
}
use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_8_R3 method removeTileEntity.
@Override
public void removeTileEntity(Chest chest) {
Location loc = chest.getLocation();
World world = ((CraftWorld) loc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
TileEntity currentTileEntity = world.getTileEntity(blockPosition);
if (currentTileEntity instanceof TileEntityWildChest)
world.t(blockPosition);
}
Aggregations