mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-25 20:32:27 +00:00
Merge pull request #27 from GTNewHorizons/allow-arcane-assembler-parallel
Allow Arcane Assembler parallel
This commit is contained in:
1 file changed
+32
@@ -1,6 +1,8 @@
|
||||
package thaumicenergistics.common.integration.tc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
@@ -101,6 +103,9 @@ public class ArcaneCraftingPattern
|
||||
|
||||
// Set validity
|
||||
this.setPatternValidity( ( this.aspects.size() > 0 ) && ( this.result != null ) && hasAtLeastOneValidInput );
|
||||
|
||||
// Ensure AE result and ingredients are populated
|
||||
this.setupAEResults();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +123,9 @@ public class ArcaneCraftingPattern
|
||||
|
||||
// Read the data
|
||||
this.readFromNBT( data );
|
||||
|
||||
// Ensure AE result and ingredients are populated
|
||||
this.setupAEResults();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -787,4 +795,28 @@ public class ArcaneCraftingPattern
|
||||
return data;
|
||||
}
|
||||
|
||||
// Custom equality so AE may see the same recipe as the same pattern
|
||||
// Allows AE to parallel if multiple assemblers with this recipe are available
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
ArcaneCraftingPattern that = (ArcaneCraftingPattern) o;
|
||||
|
||||
if (isValid != that.isValid) return false;
|
||||
if (!Objects.equals(result, that.result)) return false;
|
||||
if (!Arrays.equals(ingredientsAE, that.ingredientsAE)) return false;
|
||||
return Arrays.equals(allResults, that.allResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = result != null ? result.hashCode() : 0;
|
||||
hash = 31 * hash + Arrays.hashCode(ingredientsAE);
|
||||
hash = 31 * hash + Arrays.hashCode(allResults);
|
||||
hash = 31 * hash + (isValid ? 1 : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user