mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Massive recipe system overhaul.
They should be much more efficient now (this reduced the tick time of the CI Chamber by 3-4x in my testing), due to being able to just use the HashMap's get() instead of being limited to iterating through entries. NEI integration code now a lot more readable and type-safe as well.
This commit is contained in:
1 parent
4dd3d4ba01
commit
ce6946c669
77 files changed
+1294
-486
No files matched your search
@@ -0,0 +1,52 @@
|
||||
package mekanism.common.recipe.inputs;
|
||||
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import mekanism.api.util.StackUtils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An infusion input, containing the type of and amount of infuse the operation requires, as well as the input ItemStack.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class InfusionInput extends MachineInput
|
||||
{
|
||||
/** The type of this infusion */
|
||||
public InfuseType infusionType;
|
||||
|
||||
/** How much infuse it takes to perform this operation */
|
||||
public int infuseAmount;
|
||||
|
||||
/** The input ItemStack */
|
||||
public ItemStack inputStack;
|
||||
|
||||
public InfusionInput(InfuseType infusiontype, int required, ItemStack itemstack)
|
||||
{
|
||||
infusionType = infusiontype;
|
||||
infuseAmount = required;
|
||||
inputStack = itemstack;
|
||||
}
|
||||
|
||||
public static InfusionInput getInfusion(InfuseType type, int stored, ItemStack itemstack)
|
||||
{
|
||||
return new InfusionInput(type, stored, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashIngredients()
|
||||
{
|
||||
return infusionType.unlocalizedName.hashCode() << 8 | StackUtils.hashItemStack(inputStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testEquality(MachineInput other)
|
||||
{
|
||||
if(other instanceof InfusionInput)
|
||||
{
|
||||
InfusionInput ii = (InfusionInput)other;
|
||||
return infusionType == ii.infusionType && StackUtils.equalsWildcardWithNBT(inputStack, ii.inputStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user