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
@@ -5,10 +5,30 @@ import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BasicMachineRecipe extends MachineRecipe<ItemStackInput, ItemStackOutput>
|
||||
public abstract class BasicMachineRecipe<RECIPE extends BasicMachineRecipe<RECIPE>> extends MachineRecipe<ItemStackInput, ItemStackOutput, RECIPE>
|
||||
{
|
||||
public BasicMachineRecipe(ItemStackInput input, ItemStackOutput output)
|
||||
{
|
||||
super(input, output);
|
||||
}
|
||||
|
||||
public BasicMachineRecipe(ItemStack input, ItemStack output)
|
||||
{
|
||||
super(new ItemStackInput(input), new ItemStackOutput(output));
|
||||
this(new ItemStackInput(input), new ItemStackOutput(output));
|
||||
}
|
||||
|
||||
public boolean canOperate(ItemStack[] inventory, int inputIndex, int outputIndex)
|
||||
{
|
||||
return getInput().useItemStackFromInventory(inventory, inputIndex, false) && getOutput().applyOutputs(inventory, outputIndex, false);
|
||||
}
|
||||
|
||||
public void operate(ItemStack[] inventory, int inputIndex, int outputIndex)
|
||||
{
|
||||
if(getInput().useItemStackFromInventory(inventory, inputIndex, true))
|
||||
{
|
||||
getOutput().applyOutputs(inventory, outputIndex, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user