More work in the quest for greater recipe efficiency.

This commit is contained in:
Ben Spiers committed 2014-09-05 04:20:12 +01:00
1 parent c6a77f9cfa
commit c7a429177b
87 files changed
+1416 -1106

No files matched your search

@@ -2,7 +2,7 @@ package mekanism.common.recipe.outputs;
import net.minecraft.item.ItemStack;
public class ItemStackOutput extends MachineOutput
public class ItemStackOutput extends MachineOutput<ItemStackOutput>
{
public ItemStack output;
@@ -10,4 +10,30 @@ public class ItemStackOutput extends MachineOutput
{
output = stack;
}
public boolean applyOutputs(ItemStack[] inventory, int index, boolean doEmit)
{
if(inventory[index] == null)
{
if(doEmit)
{
inventory[index] = output.copy();
}
return true;
} else if(inventory[index].isItemEqual(output) && inventory[index].stackSize + output.stackSize <= inventory[index].getMaxStackSize())
{
if(doEmit)
{
inventory[index].stackSize += output.stackSize;
}
return true;
}
return false;
}
@Override
public ItemStackOutput copy()
{
return new ItemStackOutput(output.copy());
}
}