public static ArrayList<ItemContainer> getFurnaceContainers( Location location, CompassDirection direction) { ArrayList<ItemContainer> containers = new ArrayList<ItemContainer>(); HashSet<Block> blocks = BlockUtils.getAdjacentBlocks(location, 1); for (Block block : blocks) { if (getMinecartManiaInventory(block) != null && getMinecartManiaInventory(block) instanceof MinecartManiaFurnace) { MinecartManiaFurnace furnace = (MinecartManiaFurnace) getMinecartManiaInventory(block); for (int line = 0; line < 4; line++) { String text = ((Sign) location.getBlock().getState()).getLine(line); if (isFurnaceFuelLine(text)) { containers.add(new FurnaceFuelContainer(furnace, text, direction)); } else if (isFurnaceSmeltLine(text)) { containers.add(new FurnaceSmeltContainer(furnace, text, direction)); } } } } return containers; }
public static ArrayList<ItemContainer> getItemContainers( Location location, CompassDirection direction, boolean collection) { ArrayList<ItemContainer> containers = new ArrayList<ItemContainer>(); HashSet<Block> blocks = BlockUtils.getAdjacentBlocks(location, 1); HashSet<Block> toSkip = new HashSet<Block>(); for (Block block : blocks) { if (getMinecartManiaInventory(block) != null && !toSkip.contains(block)) { MinecartManiaInventory inventory = getMinecartManiaInventory(block); if (inventory instanceof MinecartManiaDoubleChest) { MinecartManiaChest other = MinecartManiaChest.getNeighborChest( block.getWorld(), block.getX(), block.getY(), block.getZ()); toSkip.add(other.getLocation().getBlock()); } ArrayList<String> lines = getItemLines(((Sign) location.getBlock().getState())); for (String text : lines) { if (!text.isEmpty() && !isFurnaceFuelLine(text) && !isFurnaceSmeltLine(text)) { ItemContainer temp = null; if (collection) { MinecartManiaLogger.getInstance().debug("Found Inventory To Collect From"); temp = new ItemCollectionContainer(inventory, text, direction); } else { if (inventory instanceof MinecartManiaFurnace) { MinecartManiaLogger.getInstance().debug("Found Furnace To Deposit From"); temp = new FurnaceDepositItemContainer( (MinecartManiaFurnace) inventory, text, direction); } else { MinecartManiaLogger.getInstance().debug("Found Inventory To Deposit From"); temp = new ItemDepositContainer(inventory, text, direction); } } if (temp != null) { containers.add(temp); } } } } } return containers; }