if (!doRemove) {
inv = new InventoryCopy(robot);
}
InventoryCrafting invCraft = new InventoryCrafting(new Container() {
@Override
public boolean canInteractWith(EntityPlayer player) {
// TODO Auto-generated method stub
return false;
}
}, 3, 3);
for (int i = 0; i < items.length; ++i) {
Object tmp = items [i];
if (tmp == null) {
continue;
}
int qty = 0;
ArrayStackFilter filter;
if (tmp instanceof ItemStack) {
ItemStack stack = (ItemStack) tmp;
qty = stack.stackSize;
filter = new ArrayStackFilter(stack);
} else {
ArrayList<ItemStack> stacks = (ArrayList<ItemStack>) tmp;
qty = stacks.get(0).stackSize;
filter = new ArrayStackFilter(stacks.toArray(new ItemStack[stacks.size()]));
}
for (IInvSlot s : InventoryIterator.getIterable(inv)) {
if (filter.matches(s.getStackInSlot())) {
ItemStack removed = s.decreaseStackInSlot(qty);
qty = qty - removed.stackSize;
if (invCraft.getStackInSlot(i) != null) {
invCraft.getStackInSlot(i).stackSize += qty;
} else {
invCraft.setInventorySlotContents(i, removed);
}
invCraft.setInventorySlotContents(i, removed);
if (removed.stackSize == 0) {
break;
}
}