use of buildcraft.factory.TileAutoWorkbench in project LogisticsPipes by RS485.
the class AutoWorkbench method importRecipe.
@Override
public boolean importRecipe(TileEntity tile, ItemIdentifierInventory inventory) {
if (!(tile instanceof TileAutoWorkbench)) {
return false;
}
TileAutoWorkbench bench = (TileAutoWorkbench) tile;
ItemStack result = bench.craftMatrix.getRecipeOutput();
if (result == null) {
return false;
}
inventory.setInventorySlotContents(9, result);
// Import
for (int i = 0; i < bench.craftMatrix.getSizeInventory(); i++) {
if (i >= inventory.getSizeInventory() - 2) {
break;
}
final ItemStack newStack = bench.craftMatrix.getStackInSlot(i) == null ? null : bench.craftMatrix.getStackInSlot(i).copy();
if (newStack != null && newStack.stackSize > 1) {
newStack.stackSize = 1;
}
inventory.setInventorySlotContents(i, newStack);
}
inventory.compact_first(9);
return true;
}
use of buildcraft.factory.TileAutoWorkbench in project BuildCraft by BuildCraft.
the class SchematicAutoWorkbench method storeRequirements.
@Override
public void storeRequirements(IBuilderContext context, BlockPos pos) {
TileAutoWorkbench autoWb = getTile(context, pos);
if (autoWb != null) {
ArrayList<ItemStack> rqs = new ArrayList<>();
rqs.add(new ItemStack(BuildCraftFactory.autoWorkbenchBlock));
for (IInvSlot slot : InventoryIterator.getIterable(autoWb.craftMatrix, EnumFacing.UP)) {
ItemStack stack = slot.getStackInSlot();
if (stack != null) {
stack = stack.copy();
stack.stackSize = 1;
rqs.add(stack);
}
}
storedRequirements = JavaTools.concat(storedRequirements, rqs.toArray(new ItemStack[rqs.size()]));
}
}
use of buildcraft.factory.TileAutoWorkbench in project BuildCraft by BuildCraft.
the class SchematicAutoWorkbench method placeInWorld.
@Override
public void placeInWorld(IBuilderContext context, BlockPos pos, List<ItemStack> stacks) {
super.placeInWorld(context, pos, stacks);
TileAutoWorkbench autoWb = getTile(context, pos);
if (autoWb != null) {
for (IInvSlot slot : InventoryIterator.getIterable(autoWb.craftMatrix, EnumFacing.UP)) {
ItemStack stack = slot.getStackInSlot();
if (stack != null) {
stack.stackSize = 1;
}
}
}
}
Aggregations