package org.bukkit.craftbukkit.block; import net.minecraft.server.TileEntityChest; import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.inventory.Inventory; /** * Represents a chest. * * @author sk89q */ public class CraftChest extends CraftBlockState implements Chest { private final CraftWorld world; private final TileEntityChest chest; public CraftChest(final Block block) { super(block); world = (CraftWorld)block.getWorld(); chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ()); } public Inventory getInventory() { return new CraftInventory(chest); } @Override public boolean update(boolean force) { boolean result = super.update(force); if (result) { chest.h(); } return result; } }