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,34 @@
|
||||
package mekanism.common.recipe.inputs;
|
||||
|
||||
public abstract class MachineInput
|
||||
{
|
||||
public abstract int hashIngredients();
|
||||
|
||||
/**
|
||||
* Test equality to another input.
|
||||
* This should return true if the input matches this one,
|
||||
* IGNORING AMOUNTS.
|
||||
* Allows usage of HashMap optimisation to get recipes.
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean testEquality(MachineInput other);
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return hashIngredients();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other)
|
||||
{
|
||||
if(other instanceof MachineInput)
|
||||
{
|
||||
return testEquality((MachineInput)other);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user