Created
December 6, 2014 02:58
-
-
Save Elements-/41779b3d2f20b7bc87a6 to your computer and use it in GitHub Desktop.
Check if a chest block is a double or single then get the inventory(s)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block b = .... | |
BlockFace[] sides = new BlockFace[] {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}; | |
for(BlockFace bf : sides) { | |
if(b.getRelative(bf, 1).getType() == b.getType()) { | |
Inventory left = ((DoubleChestInventory)((InventoryHolder)b.getState()).getInventory()).getLeftSide(); | |
Inventory right = ((DoubleChestInventory)((InventoryHolder)b.getState()).getInventory()).getRightSide(); | |
} else { | |
Chest c = (Chest) b.getState(); | |
Inventory inv = c.getInventory(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment