mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
More work in the quest for greater recipe efficiency.
This commit is contained in:
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());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user