diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-04-13 23:58:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 17:58:05 +0200 |
commit | d9252be3bcec8687310c6a857f90da0ffc3256c6 (patch) | |
tree | 3949ff8eb94b7f2cc115008d9d530dbb1179ba29 /src | |
parent | b022549c4b3e445172879185790e632501418615 (diff) | |
download | GT5-Unofficial-d9252be3bcec8687310c6a857f90da0ffc3256c6.tar.gz GT5-Unofficial-d9252be3bcec8687310c6a857f90da0ffc3256c6.tar.bz2 GT5-Unofficial-d9252be3bcec8687310c6a857f90da0ffc3256c6.zip |
use the proper recipe input checker instead of always reinvent the wheel (#169)
* more resilient GTNH detection
fix crashes in dev
* use the standard recipe input checker instead of always reinvent the wheel
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index ca1757f98f..eeb35f394c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -851,51 +851,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt } } - private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) { - int aInputCount = aComparator.mInputs.length; - if (aInputCount > 0) { - //Logger.INFO("Looking for recipe with "+aInputCount+" Items"); - int aMatchingInputs = 0; - recipe : for (ItemStack a : aComparator.mInputs) { - for (ItemStack b : aInputs) { - if (a.getItem() == b.getItem()) { - if (a.getItemDamage() == b.getItemDamage()) { - //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName()); - aMatchingInputs++; - continue recipe; - } - } - } - } - if (aMatchingInputs != aInputCount) { - return false; - } - } - int aFluidInputCount = aComparator.mFluidInputs.length; - if (aFluidInputCount > 0) { - //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids"); - int aMatchingFluidInputs = 0; - recipe : for (FluidStack b : aComparator.mFluidInputs) { - //Logger.INFO("Checking for fluid "+b.getLocalizedName()); - for (FluidStack a : aFluids) { - if (GT_Utility.areFluidsEqual(a, b)) { - //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName()); - aMatchingFluidInputs++; - continue recipe; - } - else { - //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName()); - } - } - } - if (aMatchingFluidInputs != aFluidInputCount) { - return false; - } - } - Logger.INFO("Recipes Match!"); - return true; - } - public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) { if (!mInitRecipeCache) { initRecipeCaches(); @@ -909,7 +864,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids."); // Try check the cached recipe first if (aRecipe != null) { - if (areInputsEqual(aRecipe, aInputs, aFluids)) { + if (aRecipe.isRecipeInputEqual(false, aFluids, aInputs)) { if (aRecipe.mEUt <= aVoltage) { Logger.INFO("Using cached recipe."); return aRecipe; @@ -927,7 +882,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt // Iterate the tiers recipes until we find the one with all inputs matching master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) { for (GT_Recipe aRecipeToCheck : aTieredMap) { - if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) { + if (aRecipeToCheck.isRecipeInputEqual(false, aFluids, aInputs)) { log("Found recipe with matching inputs!"); if (aRecipeToCheck.mSpecialValue <= aSpecialValue) { if (aRecipeToCheck.mEUt <= aVoltage) { |