001    package org.bukkit.block;
002    
003    import org.bukkit.Location;
004    import org.bukkit.World;
005    import org.bukkit.inventory.DoubleChestInventory;
006    import org.bukkit.inventory.Inventory;
007    import org.bukkit.inventory.InventoryHolder;
008    
009    /**
010     * Represents a double chest.
011     */
012    public class DoubleChest implements InventoryHolder {
013        private DoubleChestInventory inventory;
014    
015        public DoubleChest(DoubleChestInventory chest) {
016            inventory = chest;
017        }
018    
019        public Inventory getInventory() {
020            return inventory;
021        }
022    
023        public InventoryHolder getLeftSide() {
024            return inventory.getLeftSide().getHolder();
025        }
026    
027        public InventoryHolder getRightSide() {
028            return inventory.getRightSide().getHolder();
029        }
030    
031        public Location getLocation() {
032            return new Location(getWorld(), getX(), getY(), getZ());
033        }
034    
035        public World getWorld() {
036            return ((Chest)getLeftSide()).getWorld();
037        }
038    
039        public double getX() {
040            return 0.5 * (((Chest)getLeftSide()).getX() + ((Chest)getRightSide()).getX());
041        }
042    
043        public double getY() {
044            return 0.5 * (((Chest)getLeftSide()).getY() + ((Chest)getRightSide()).getY());
045        }
046    
047        public double getZ() {
048            return 0.5 * (((Chest)getLeftSide()).getZ() + ((Chest)getRightSide()).getZ());
049        }
050    }