use of buildcraft.lib.inventory.filter.CraftingFilter in project BuildCraft by BuildCraft.
the class TileAdvancedCraftingTable method searchNeighborsForIngredients.
private void searchNeighborsForIngredients() {
for (IInvSlot slot : InventoryIterator.getIterable(craftingSlots, EnumFacing.UP)) {
ItemStack ingred = slot.getStackInSlot();
if (ingred == null) {
continue;
}
IStackFilter filter = new CraftingFilter(ingred);
if (InvUtils.countItems(invInput, EnumFacing.UP, filter) < InvUtils.countItems(craftingSlots, EnumFacing.UP, filter)) {
for (EnumFacing side : SEARCH_SIDES) {
TileEntity tile = getTile(side);
if (tile instanceof IInventory) {
IInventory inv = InvUtils.getInventory((IInventory) tile);
ItemStack result = InvUtils.moveOneItem(inv, side.getOpposite(), invInput, side, filter);
if (result != null) {
return;
}
}
}
}
}
}
Aggregations