@Nullable @Override public Cache cacheTile(@Nonnull TileEntity tile, byte side) { Attachment attachment = parent.getAttachment(side); if (attachment != null && !attachment.allowDuctConnection()) { return null; } if (InventoryHelper.hasItemHandlerCap(tile, EnumFacing.VALUES[side ^ 1])) { return new Cache(tile, attachment); } return null; }
IItemHandler inv = cache.getItemHandler(i ^ 1); if (inv == null) { continue;
int maxStock = cache.filter.getMaxStock(); IItemHandler itemHandler = cache.getItemHandler(side ^ 1); if (!routeItems) { return simulateInsertItemStackIntoInventory(itemHandler, insertingItem, side ^ 1, maxStock); if (itemEntry.side != side && (cache.areEquivalentHandlers(itemHandler, itemEntry.side))) { continue;
public int simTransferI(int side, ItemStack insertingItem) { if (grid == null) { return 0; } Cache cache = tileCache[side]; if (cache == null) { return 0; } try { ItemStack itemStack = simTransfer(side, insertingItem); return itemStack.isEmpty() ? 0 : itemStack.getCount(); } catch (Exception err) { IItemHandler handler = cache.getItemHandler(side ^ 1); CrashReport crashReport = CrashHelper.makeDetailedCrashReport(err, "Inserting", this, "Inserting Item", insertingItem, "Side", side, "Cache", handler, "Grid", grid); CrashHelper.addSurroundingDetails(crashReport, "ItemDuct", parent); CrashHelper.addInventoryContents(crashReport, "Destination Inventory", handler); throw new ReportedException(crashReport); } }
public IItemHandler getItemHandler(int face) { return getItemHandler(EnumFacing.VALUES[face]); }
public int insertIntoInventory_do(ItemStack stack, int direction) { Cache cache = tileCache[direction]; IItemHandler itemHandler = cache.getItemHandler(direction ^ 1); if (itemHandler == null) { return stack.getCount(); } signalRepoll(); stack = insertItemStackIntoInventory(itemHandler, stack, direction ^ 1, cache.filter.getMaxStock()); return stack.isEmpty() ? 0 : stack.getCount(); }
@Override public ConnectionType getConnectionType(byte side) { if(this.tileCache[side] == null) { this.tileCache[side] = new Cache(pipe, null); } return cofh.thermaldynamics.duct.ConnectionType.NORMAL; }