Search in sources :

Example 6 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_12_R1 method setChestName.

@Override
public void setChestName(Location chest, String name) {
    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(name);
}
Also used : TileEntityChest(net.minecraft.server.v1_12_R1.TileEntityChest) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) World(net.minecraft.server.v1_12_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 7 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 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]);
}
Also used : TileEntityChest(net.minecraft.server.v1_16_R3.TileEntityChest) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 8 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project UltraCosmetics by iSach.

the class EntityUtil method playChestAnimation.

@Override
public void playChestAnimation(Block b, boolean open, TreasureChestDesign design) {
    Location location = b.getLocation();
    World world = ((CraftWorld) location.getWorld()).getHandle();
    BlockPosition position = new BlockPosition(location.getX(), location.getY(), location.getZ());
    if (design.getChestType() == ChestType.ENDER) {
        TileEntityEnderChest tileChest = (TileEntityEnderChest) world.getTileEntity(position);
        world.playBlockAction(position, tileChest.w(), 1, open ? 1 : 0);
    } else {
        TileEntityChest tileChest = (TileEntityChest) world.getTileEntity(position);
        world.playBlockAction(position, tileChest.w(), 1, open ? 1 : 0);
    }
}
Also used : TileEntityChest(net.minecraft.server.v1_8_R3.TileEntityChest) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) TileEntityEnderChest(net.minecraft.server.v1_8_R3.TileEntityEnderChest) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) Location(org.bukkit.Location)

Example 9 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project WildChests by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 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.server.v1_16_R3.TileEntityChest) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 10 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project WildChests by BG-Software-LLC.

the class NMSAdapter_v1_8_R3 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, world.getType(blockPosition).getBlock(), 1, open ? 1 : 0);
}
Also used : TileEntityChest(net.minecraft.server.v1_8_R3.TileEntityChest) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Aggregations

BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)3 TileEntityChest (net.minecraft.server.v1_8_R3.TileEntityChest)3 World (net.minecraft.server.v1_8_R3.World)3 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)3 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)2 TileEntityChest (net.minecraft.server.v1_12_R1.TileEntityChest)2 World (net.minecraft.server.v1_12_R1.World)2 TileEntityChest (net.minecraft.server.v1_15_R1.TileEntityChest)2 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)2 TileEntityChest (net.minecraft.server.v1_16_R3.TileEntityChest)2 World (net.minecraft.server.v1_16_R3.World)2 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)2 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)2 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)1 NBTTagCompound (net.minecraft.server.v1_15_R1.NBTTagCompound)1 World (net.minecraft.server.v1_15_R1.World)1 BlockPosition (net.minecraft.server.v1_8_R1.BlockPosition)1 TileEntity (net.minecraft.server.v1_8_R1.TileEntity)1 TileEntityChest (net.minecraft.server.v1_8_R1.TileEntityChest)1 World (net.minecraft.server.v1_8_R1.World)1