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:
Ben Spiers committed 2014-09-04 04:26:55 +01:00
1 parent 4dd3d4ba01
commit ce6946c669
77 files changed
+1294 -486

No files matched your search

@@ -0,0 +1,41 @@
package mekanism.common.recipe.inputs;
import mekanism.api.gas.Gas;
import mekanism.api.util.StackUtils;
import net.minecraft.item.ItemStack;
public class AdvancedMachineInput extends MachineInput
{
public ItemStack itemStack;
public Gas gasType;
public AdvancedMachineInput(ItemStack item, Gas gas)
{
itemStack = item;
gasType = gas;
}
public boolean isValid()
{
return itemStack != null && gasType != null;
}
public boolean matches(AdvancedMachineInput input)
{
return StackUtils.equalsWildcard(itemStack, input.itemStack) && input.itemStack.stackSize >= itemStack.stackSize;
}
@Override
public int hashIngredients()
{
return StackUtils.hashItemStack(itemStack) << 8 | gasType.getID();
}
@Override
public boolean testEquality(MachineInput other)
{
return other instanceof AdvancedMachineInput && StackUtils.equalsWildcardWithNBT(itemStack, ((AdvancedMachineInput)other).itemStack) && gasType.getID() == ((AdvancedMachineInput)other).gasType.getID();
}
}