From d9252be3bcec8687310c6a857f90da0ffc3256c6 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Wed, 13 Apr 2022 23:58:05 +0800 Subject: 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 --- .../chemplant/GregtechMTE_ChemicalPlant.java | 49 +--------------------- 1 file changed, 2 insertions(+), 47 deletions(-) (limited to 'src') 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 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 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) { -- cgit