Search in sources :

Example 1 with TileEntityChest

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

the class NMSAdapter_v1_12_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(), 1, open ? 1 : 0);
}
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 2 with TileEntityChest

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

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

Example 3 with TileEntityChest

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

the class NMSAdapter_v1_8_R3 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);
    tileEntityChest.a(name);
}
Also used : TileEntityChest(net.minecraft.server.v1_8_R3.TileEntityChest) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 4 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project Slabbo by Sven65.

the class SlabboAPI_v1_8_R1 method setChestName.

public void setChestName(Block chestBlock, String name) {
    Chest chest = (Chest) chestBlock.getState();
    World nmsWorld = ((CraftWorld) chestBlock.getWorld()).getHandle();
    TileEntity tileEntity = nmsWorld.getTileEntity(new BlockPosition(chestBlock.getX(), chestBlock.getY(), chestBlock.getZ()));
    if (!(tileEntity instanceof TileEntityChest))
        return;
    ((TileEntityChest) tileEntity).a(name);
    chest.update();
}
Also used : TileEntity(net.minecraft.server.v1_8_R1.TileEntity) TileEntityChest(net.minecraft.server.v1_8_R1.TileEntityChest) Chest(org.bukkit.block.Chest) TileEntityChest(net.minecraft.server.v1_8_R1.TileEntityChest) BlockPosition(net.minecraft.server.v1_8_R1.BlockPosition) World(net.minecraft.server.v1_8_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld)

Example 5 with TileEntityChest

use of net.minecraft.server.v1_8_R1.TileEntityChest in project solinia3-core by mixxit.

the class PatchUtils method listToInventory.

public Inventory listToInventory(NBTTagList nbttaglist) {
    TileEntityChest tileentitychest = new TileEntityChest();
    for (int i = 0; i < nbttaglist.size(); i++) {
        NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
        int j = nbttagcompound.getByte("Slot") & 0xFF;
        if (j >= 0 && j < 27) {
            tileentitychest.setItem(j, net.minecraft.server.v1_15_R1.ItemStack.a(nbttagcompound));
        }
    }
    return new CraftInventory(tileentitychest);
}
Also used : CraftInventory(org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventory) TileEntityChest(net.minecraft.server.v1_15_R1.TileEntityChest) NBTTagCompound(net.minecraft.server.v1_15_R1.NBTTagCompound)

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