Search in sources :

Example 1 with GlowDoubleChestInventory

use of net.glowstone.inventory.GlowDoubleChestInventory in project Glowstone by GlowstoneMC.

the class GlowChest method getInventory.

@Override
public Inventory getInventory() {
    GlowBlock me = getBlock();
    BlockChest blockChest = (BlockChest) ItemTable.instance().getBlock(me.getType());
    BlockFace attachedChest = blockChest.getAttachedChest(me);
    if (attachedChest != null) {
        Block nearbyBlock = me.getRelative(attachedChest);
        GlowChest nearbyChest = (GlowChest) nearbyBlock.getState();
        switch(attachedChest) {
            case SOUTH:
            case EAST:
                return new GlowDoubleChestInventory(this, nearbyChest);
            case WEST:
            case NORTH:
                return new GlowDoubleChestInventory(nearbyChest, this);
            default:
                GlowServer.logger.warning("GlowChest#getInventory() can only handle N/O/S/W BlockFaces, got " + attachedChest);
                return getBlockInventory();
        }
    }
    return getBlockInventory();
}
Also used : GlowBlock(net.glowstone.block.GlowBlock) BlockChest(net.glowstone.block.blocktype.BlockChest) BlockFace(org.bukkit.block.BlockFace) GlowDoubleChestInventory(net.glowstone.inventory.GlowDoubleChestInventory) GlowBlock(net.glowstone.block.GlowBlock) Block(org.bukkit.block.Block)

Aggregations

GlowBlock (net.glowstone.block.GlowBlock)1 BlockChest (net.glowstone.block.blocktype.BlockChest)1 GlowDoubleChestInventory (net.glowstone.inventory.GlowDoubleChestInventory)1 Block (org.bukkit.block.Block)1 BlockFace (org.bukkit.block.BlockFace)1