for(int i = 0; i < event.craftMatrix.getSizeInventory(); i++)
{
if(isBin(event.craftMatrix.getStackInSlot(i)))
{
ItemStack bin = event.craftMatrix.getStackInSlot(i);
InventoryBin inv = new InventoryBin(bin.copy());
int size = inv.getItemCount();
ItemStack testRemove = inv.removeStack();
bin.stackTagCompound.setInteger("newCount", size-(testRemove != null ? testRemove.stackSize : 0));
}
}
}
else {
int bin = -1;
int other = -1;
for(int i = 0; i < event.craftMatrix.getSizeInventory(); i++)
{
if(isBin(event.craftMatrix.getStackInSlot(i)))
{
bin = i;
}
else if(!isBin(event.craftMatrix.getStackInSlot(i)) && event.craftMatrix.getStackInSlot(i) != null)
{
other = i;
}
}
ItemStack binStack = event.craftMatrix.getStackInSlot(bin);
ItemStack otherStack = event.craftMatrix.getStackInSlot(other);
ItemStack testRemain = new InventoryBin(binStack.copy()).add(otherStack.copy());
if(testRemain != null && testRemain.stackSize > 0)
{
ItemStack proxy = new ItemStack(Mekanism.ItemProxy);
((ItemProxy)proxy.getItem()).setSavedItem(proxy, testRemain.copy());