use of net.minecraft.world.level.block.entity.TileEntityChest in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_18_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) getTileEntity(world, blockPosition);
if (tileChest != null)
playBlockAction(world, blockPosition, getBlock(getBlock(tileChest)), 1, open ? 1 : 0);
}
use of net.minecraft.world.level.block.entity.TileEntityChest 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 net.minecraft.world.level.block.entity.TileEntityChest in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_17_R1 method setChestName.
@Override
public void setChestName(Location chest, String name) {
assert chest.getWorld() != null;
World world = ((CraftWorld) chest.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(chest.getBlockX(), chest.getBlockY(), chest.getBlockZ());
TileEntityChest tileEntityChest = (TileEntityChest) world.getTileEntity(blockPosition);
assert tileEntityChest != null;
tileEntityChest.setCustomName(CraftChatMessage.fromString(name)[0]);
}
use of net.minecraft.world.level.block.entity.TileEntityChest in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_18_R1 method setChestName.
@Override
public void setChestName(Location chest, String name) {
assert chest.getWorld() != null;
World world = ((CraftWorld) chest.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(chest.getBlockX(), chest.getBlockY(), chest.getBlockZ());
TileEntityChest tileEntityChest = (TileEntityChest) world.c_(blockPosition);
assert tileEntityChest != null;
tileEntityChest.a(CraftChatMessage.fromString(name)[0]);
}
use of net.minecraft.world.level.block.entity.TileEntityChest 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