From 5c452f3bab6b759a0f3a674e9d8fa05c12c4a099 Mon Sep 17 00:00:00 2001 From: miozune Date: Mon, 9 Sep 2024 09:21:25 +0900 Subject: [PATCH] Remove findRecipe methods (#3084) Co-authored-by: Martin Robertz Co-authored-by: boubou19 --- .../tileentities/multis/MTEWindmill.java | 6 ++- .../tiered/GT_MetaTileEntity_RadioHatch.java | 9 ++-- .../tileEntity/MTEMultiNqGenerator.java | 5 ++- src/main/java/gregtech/GTMod.java | 1 - .../implementations/MTEBasicGenerator.java | 8 +++- .../MTEBasicMachineBronze.java | 5 ++- .../MTEBasicMachineWithRecipe.java | 38 ++++++++--------- .../gregtech/api/recipe/FindRecipeQuery.java | 2 +- .../java/gregtech/api/recipe/RecipeMap.java | 38 ----------------- .../api/recipe/check/SingleRecipeCheck.java | 6 ++- .../machines/basic/MTEBoxinator.java | 12 +++--- .../multi/MTEIntegratedOreFactory.java | 41 +++++++++---------- .../multi/MTEOreDrillingPlantBase.java | 6 ++- .../multi/MTEPrimitiveBlastFurnace.java | 4 +- .../steam/MTESteamMaceratorBronze.java | 7 +++- .../steam/MTESteamMaceratorSteel.java | 7 +++- .../gregtech/common/tools/ToolHardHammer.java | 14 ++++--- .../gregtech/common/tools/ToolJackHammer.java | 12 ++++-- .../MTERocketFuelGeneratorBase.java | 8 +++- .../generators/MTERTGenerator.java | 14 +++---- .../multi/processing/MTESpargeTower.java | 5 ++- .../common/tileentity/MTESourceChamber.java | 6 ++- .../metaTileEntity/multi/MTEMicrowave.java | 13 +++--- 23 files changed, 127 insertions(+), 140 deletions(-) diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java b/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java index e60c147b705..7069e7533db 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java @@ -286,8 +286,10 @@ public boolean checkRecipe(ItemStack itemStack) { if (this.mOutputItems == null) this.mOutputItems = new ItemStack[2]; - GTRecipe tRecipe = RecipeMaps.maceratorRecipes - .findRecipe(this.getBaseMetaTileEntity(), false, false, V[1], null, itemStack); + GTRecipe tRecipe = RecipeMaps.maceratorRecipes.findRecipeQuery() + .items(itemStack) + .voltage(V[1]) + .find(); if (tRecipe == null) { return false; } diff --git a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 8e752711ea5..b7e4e966fb7 100644 --- a/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -212,12 +212,9 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { } if (this.lastRecipe == null || this.lastFail) { - this.lastRecipe = BartWorksRecipeMaps.radioHatchRecipes.findRecipe( - this.getBaseMetaTileEntity(), - false, - Integer.MAX_VALUE - 7, - null, - this.mInventory[0]); + this.lastRecipe = BartWorksRecipeMaps.radioHatchRecipes.findRecipeQuery() + .items(this.mInventory[0]) + .find(); if (this.lastRecipe == null) { this.lastFail = true; this.lastUsedItem = this.mInventory[0] == null ? null : this.mInventory[0].copy(); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java index aac9386ecc7..c83ef8c4fe3 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java @@ -225,8 +225,9 @@ protected boolean filtersFluid() { } } - GTRecipe tRecipe = GoodGeneratorRecipeMaps.naquadahReactorFuels - .findRecipe(this.getBaseMetaTileEntity(), true, 1 << 30, tFluids.toArray(new FluidStack[0])); + GTRecipe tRecipe = GoodGeneratorRecipeMaps.naquadahReactorFuels.findRecipeQuery() + .fluids(tFluids.toArray(new FluidStack[0])) + .find(); if (tRecipe != null) { Pair excitedInfo = getExcited(tFluids.toArray(new FluidStack[0]), false); int pall = excitedInfo == null ? 1 : excitedInfo.getValue(); diff --git a/src/main/java/gregtech/GTMod.java b/src/main/java/gregtech/GTMod.java index af9c9bafd02..07fa1449d2a 100644 --- a/src/main/java/gregtech/GTMod.java +++ b/src/main/java/gregtech/GTMod.java @@ -245,7 +245,6 @@ public class GTMod implements IGTMod { public static GTProxy gregtechproxy; public static final boolean DEBUG = Boolean.getBoolean("gt.debug"); - public static int MAX_IC2 = 2147483647; public static GTAchievements achievements; @Deprecated public static final String aTextGeneral = "general"; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java index ac923bc6990..963acf191f9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java @@ -305,7 +305,9 @@ public int getFuelValue(ItemStack aStack) { public long getFuelValue(ItemStack aStack, boolean aLong) { if (GTUtility.isStackInvalid(aStack) || getRecipeMap() == null) return 0; - GTRecipe tFuel = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + GTRecipe tFuel = getRecipeMap().findRecipeQuery() + .items(aStack) + .find(); if (tFuel == null) return 0; long liters = 10L; // 1000mb/100 @@ -314,7 +316,9 @@ public long getFuelValue(ItemStack aStack, boolean aLong) { public ItemStack getEmptyContainer(ItemStack aStack) { if (GTUtility.isStackInvalid(aStack) || getRecipeMap() == null) return null; - GTRecipe tFuel = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + GTRecipe tFuel = getRecipeMap().findRecipeQuery() + .items(aStack) + .find(); if (tFuel != null) return GTUtility.copyOrNull(tFuel.getOutput(0)); return GTUtility.getContainerItem(aStack, true); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineBronze.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineBronze.java index 507a807a763..2ede5545d12 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineBronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineBronze.java @@ -189,7 +189,10 @@ && getBaseMetaTileEntity().getCoverIDAtSide(getBaseMetaTileEntity().getFrontFaci @Override public int checkRecipe() { - GTRecipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, TierEU.LV, null, getAllInputs()); + GTRecipe tRecipe = getRecipeMap().findRecipeQuery() + .items(getAllInputs()) + .voltage(TierEU.LV) + .find(); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { this.mOutputItems[0] = tRecipe.getOutput(0); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineWithRecipe.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineWithRecipe.java index b5bd3d77e1b..8d13ab18c44 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineWithRecipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachineWithRecipe.java @@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; @@ -576,16 +575,15 @@ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity if (this.getFillableStack() == null) return this.getRecipeMap() .containsInput(aStack); else return this.getRecipeMap() - .findRecipe( - this.getBaseMetaTileEntity(), - this.mLastRecipe, - true, - true, - V[this.mTier], - new FluidStack[] { this.getFillableStack() }, - this.getSpecialSlot(), - appendSelectedCircuit(aStack)) - != null; + .findRecipeQuery() + .items(appendSelectedCircuit(aStack)) + .fluids(this.getFillableStack()) + .specialSlot(this.getSpecialSlot()) + .voltage(V[this.mTier]) + .cachedRecipe(this.mLastRecipe) + .dontCheckStackSizes(true) + .notUnificated(true) + .find() != null; } case 2 -> { return ((this.getInputAt(0) != null && this.getInputAt(1) != null) @@ -594,17 +592,17 @@ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity : (this.getRecipeMap() .containsInput(aStack) && this.getRecipeMap() - .findRecipe( - this.getBaseMetaTileEntity(), - this.mLastRecipe, - true, - true, - V[this.mTier], - new FluidStack[] { this.getFillableStack() }, - this.getSpecialSlot(), + .findRecipeQuery() + .items( aIndex == this.getInputSlot() ? appendSelectedCircuit(aStack, this.getInputAt(1)) : appendSelectedCircuit(this.getInputAt(0), aStack)) - != null))); + .fluids(this.getFillableStack()) + .specialSlot(this.getSpecialSlot()) + .voltage(V[this.mTier]) + .cachedRecipe(this.mLastRecipe) + .dontCheckStackSizes(true) + .notUnificated(true) + .find() != null))); } default -> { int tID = this.getBaseMetaTileEntity() diff --git a/src/main/java/gregtech/api/recipe/FindRecipeQuery.java b/src/main/java/gregtech/api/recipe/FindRecipeQuery.java index 16702b6be6f..3f63043d6c8 100644 --- a/src/main/java/gregtech/api/recipe/FindRecipeQuery.java +++ b/src/main/java/gregtech/api/recipe/FindRecipeQuery.java @@ -142,7 +142,7 @@ public FindRecipeQuery filter(Predicate filter) { /** * @param voltage Recipes that exceed this voltage won't match. It will be automatically multiplied by amperage - * of the recipemap. + * of the recipemap. By default, voltage is set to max Integer, meaning no voltage check. */ public FindRecipeQuery voltage(long voltage) { this.voltage = voltage; diff --git a/src/main/java/gregtech/api/recipe/RecipeMap.java b/src/main/java/gregtech/api/recipe/RecipeMap.java index 669c7de2cf9..9fb504c0a47 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMap.java +++ b/src/main/java/gregtech/api/recipe/RecipeMap.java @@ -21,7 +21,6 @@ import org.jetbrains.annotations.Unmodifiable; import gregtech.api.interfaces.IRecipeMap; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.util.FieldsAreNonnullByDefault; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTRecipeBuilder; @@ -207,8 +206,6 @@ public boolean containsInput(@Nullable Fluid aFluid) { return aFluid != null && backend.containsInput(aFluid); } - // region find recipe - /** * @return Entrypoint for fluent API for finding recipe. */ @@ -216,41 +213,6 @@ public FindRecipeQuery findRecipeQuery() { return new FindRecipeQuery(this); } - @Nullable - public GTRecipe findRecipe(@Nullable IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, long aVoltage, - @Nullable FluidStack[] aFluids, @Nullable ItemStack... aInputs) { - return findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); - } - - @Nullable - public GTRecipe findRecipe(@Nullable IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, - boolean aDontCheckStackSizes, long aVoltage, @Nullable FluidStack[] aFluids, @Nullable ItemStack... aInputs) { - return findRecipe(aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); - } - - @Nullable - public GTRecipe findRecipe(@Nullable IHasWorldObjectAndCoords aTileEntity, @Nullable GTRecipe aRecipe, - boolean aNotUnificated, long aVoltage, @Nullable FluidStack[] aFluids, @Nullable ItemStack aSpecialSlot, - @Nullable ItemStack... aInputs) { - return findRecipe(aTileEntity, aRecipe, aNotUnificated, false, aVoltage, aFluids, aSpecialSlot, aInputs); - } - - @Nullable - public GTRecipe findRecipe(@Nullable IHasWorldObjectAndCoords aTileEntity, @Nullable GTRecipe aRecipe, - boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, @Nullable FluidStack[] aFluids, - @Nullable ItemStack aSpecialSlot, @Nullable ItemStack... aInputs) { - return findRecipeQuery().items(aInputs != null ? aInputs : new ItemStack[0]) - .fluids(aFluids != null ? aFluids : new FluidStack[0]) - .specialSlot(aSpecialSlot) - .voltage(aVoltage) - .cachedRecipe(aRecipe) - .notUnificated(aNotUnificated) - .dontCheckStackSizes(aDontCheckStackSizes) - .find(); - } - - // endregion - @Override public String toString() { return "RecipeMap{" + "unlocalizedName='" diff --git a/src/main/java/gregtech/api/recipe/check/SingleRecipeCheck.java b/src/main/java/gregtech/api/recipe/check/SingleRecipeCheck.java index d339f8acfd6..12d8a387570 100644 --- a/src/main/java/gregtech/api/recipe/check/SingleRecipeCheck.java +++ b/src/main/java/gregtech/api/recipe/check/SingleRecipeCheck.java @@ -302,7 +302,11 @@ private static GTRecipe tryFindRecipe(@Nonnull RecipeMap recipeMap, NBTTagCom .map(FluidStack::loadFluidStackFromNBT) .toArray(FluidStack[]::new); int eut = tag.getInteger("eut"); - GTRecipe found = recipeMap.findRecipe(null, false, GTValues.V[GTUtility.getTier(eut)], fInputs, inputs); + GTRecipe found = recipeMap.findRecipeQuery() + .items(inputs) + .fluids(fInputs) + .voltage(GTValues.V[GTUtility.getTier(eut)]) + .find(); int[] chances = tag.getIntArray("chances"); if (chances.length == 0) chances = null; if (found == null || !GTUtility.equals(inputs, found.mInputs) diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTEBoxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTEBoxinator.java index 43d2d6b2955..d7edfec413f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTEBoxinator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTEBoxinator.java @@ -206,13 +206,11 @@ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) { if (hasValidCache(aStack, aTypeCache, false)) return true; - if (RecipeMaps.packagerRecipes.findRecipe( - getBaseMetaTileEntity(), - true, - GTValues.V[mTier], - null, - GTUtility.copyAmount(64, aStack), - tInput1) != null) { + if (RecipeMaps.packagerRecipes.findRecipeQuery() + .items(GTUtility.copyAmount(64, aStack), tInput1) + .voltage(GTValues.V[mTier]) + .notUnificated(true) + .find() != null) { return true; } if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GTModHandler.getRecipeOutput(aStack) != null) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java index 7de3fb8dbe4..187bf4ed694 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java @@ -46,7 +46,6 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.GregTechAPI; -import gregtech.api.enums.GTValues; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -463,8 +462,9 @@ private void doMac(HashSet... aTables) { for (ItemStack aStack : sMidProduct) { int tID = GTUtility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GTRecipe tRecipe = RecipeMaps.maceratorRecipes - .findRecipe(getBaseMetaTileEntity(), false, GTValues.V[15], null, aStack); + GTRecipe tRecipe = RecipeMaps.maceratorRecipes.findRecipeQuery() + .items(aStack) + .find(); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -485,12 +485,10 @@ private void doWash(HashSet... aTables) { for (ItemStack aStack : sMidProduct) { int tID = GTUtility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GTRecipe tRecipe = RecipeMaps.oreWasherRecipes.findRecipe( - getBaseMetaTileEntity(), - false, - GTValues.V[15], - new FluidStack[] { GTModHandler.getDistilledWater(Integer.MAX_VALUE) }, - aStack); + GTRecipe tRecipe = RecipeMaps.oreWasherRecipes.findRecipeQuery() + .items(aStack) + .fluids(GTModHandler.getDistilledWater(Integer.MAX_VALUE)) + .find(); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -511,8 +509,9 @@ private void doThermal(HashSet... aTables) { for (ItemStack aStack : sMidProduct) { int tID = GTUtility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GTRecipe tRecipe = RecipeMaps.thermalCentrifugeRecipes - .findRecipe(getBaseMetaTileEntity(), false, GTValues.V[15], null, aStack); + GTRecipe tRecipe = RecipeMaps.thermalCentrifugeRecipes.findRecipeQuery() + .items(aStack) + .find(); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -533,8 +532,9 @@ private void doCentrifuge(HashSet... aTables) { for (ItemStack aStack : sMidProduct) { int tID = GTUtility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GTRecipe tRecipe = RecipeMaps.centrifugeRecipes - .findRecipe(getBaseMetaTileEntity(), false, GTValues.V[15], null, aStack); + GTRecipe tRecipe = RecipeMaps.centrifugeRecipes.findRecipeQuery() + .items(aStack) + .find(); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -555,8 +555,9 @@ private void doSift(HashSet... aTables) { for (ItemStack aStack : sMidProduct) { int tID = GTUtility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GTRecipe tRecipe = RecipeMaps.sifterRecipes - .findRecipe(getBaseMetaTileEntity(), false, GTValues.V[15], null, aStack); + GTRecipe tRecipe = RecipeMaps.sifterRecipes.findRecipeQuery() + .items(aStack) + .find(); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -577,12 +578,10 @@ private void doChemWash(HashSet... aTables) { for (ItemStack aStack : sMidProduct) { int tID = GTUtility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GTRecipe tRecipe = RecipeMaps.chemicalBathRecipes.findRecipe( - getBaseMetaTileEntity(), - false, - GTValues.V[15], - getStoredFluids().toArray(new FluidStack[0]), - aStack); + GTRecipe tRecipe = RecipeMaps.chemicalBathRecipes.findRecipeQuery() + .items(aStack) + .fluids(getStoredFluids().toArray(new FluidStack[0])) + .find(); if (tRecipe != null && tRecipe.getRepresentativeFluidInput(0) != null) { FluidStack tInputFluid = tRecipe.getRepresentativeFluidInput(0) .copy(); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEOreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEOreDrillingPlantBase.java index 47504c574e0..6acc48c7723 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEOreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEOreDrillingPlantBase.java @@ -501,8 +501,10 @@ private ItemStack[] getOutputByDrops(Collection oreBlockDrops) { outputItems.add(multiplyStackSize(currentItem)); return; } - GTRecipe tRecipe = RecipeMaps.maceratorRecipes - .findRecipe(getBaseMetaTileEntity(), false, voltage, null, currentItem); + GTRecipe tRecipe = RecipeMaps.maceratorRecipes.findRecipeQuery() + .items(currentItem) + .voltage(voltage) + .find(); if (tRecipe == null) { outputItems.add(currentItem); return; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPrimitiveBlastFurnace.java index c95abda9d73..0011a0efad2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPrimitiveBlastFurnace.java @@ -370,7 +370,9 @@ private boolean checkRecipe() { } ItemStack[] inputs = new ItemStack[INPUT_SLOTS]; System.arraycopy(mInventory, 0, inputs, 0, INPUT_SLOTS); - GTRecipe recipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, 0, null, inputs); + GTRecipe recipe = getRecipeMap().findRecipeQuery() + .items(inputs) + .find(); if (recipe == null) { this.mOutputItems = null; return false; diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorBronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorBronze.java index 441bf266bfa..6c55b1228c5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorBronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorBronze.java @@ -79,8 +79,11 @@ public RecipeMap getRecipeMap() { @Override public int checkRecipe() { - GTRecipe tRecipe = getRecipeMap() - .findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, TierEU.LV, null, null, getAllInputs()); + GTRecipe tRecipe = getRecipeMap().findRecipeQuery() + .items(getAllInputs()) + .voltage(TierEU.LV) + .cachedRecipe(mLastRecipe) + .find(); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorSteel.java b/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorSteel.java index 226d0d387af..9aaad8ef38e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorSteel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/MTESteamMaceratorSteel.java @@ -78,8 +78,11 @@ public RecipeMap getRecipeMap() { @Override public int checkRecipe() { - GTRecipe tRecipe = getRecipeMap() - .findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, TierEU.LV, null, null, getAllInputs()); + GTRecipe tRecipe = getRecipeMap().findRecipeQuery() + .items(getAllInputs()) + .voltage(TierEU.LV) + .cachedRecipe(mLastRecipe) + .find(); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { diff --git a/src/main/java/gregtech/common/tools/ToolHardHammer.java b/src/main/java/gregtech/common/tools/ToolHardHammer.java index d26fe2b43d1..a5b0a38ee56 100644 --- a/src/main/java/gregtech/common/tools/ToolHardHammer.java +++ b/src/main/java/gregtech/common/tools/ToolHardHammer.java @@ -1,7 +1,5 @@ package gregtech.common.tools; -import static gregtech.GTMod.MAX_IC2; - import java.util.Arrays; import java.util.List; @@ -133,12 +131,16 @@ public boolean isMinableBlock(Block aBlock, byte aMetaData) { public int convertBlockDrops(List aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { int rConversions = 0; - GTRecipe tRecipe = RecipeMaps.hammerRecipes - .findRecipe(null, true, MAX_IC2, null, new ItemStack(aBlock, 1, aMetaData)); + GTRecipe tRecipe = RecipeMaps.hammerRecipes.findRecipeQuery() + .items(new ItemStack(aBlock, 1, aMetaData)) + .notUnificated(true) + .find(); if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { for (ItemStack tDrop : aDrops) { - tRecipe = RecipeMaps.hammerRecipes - .findRecipe(null, true, MAX_IC2, null, GTUtility.copyAmount(1, tDrop)); + tRecipe = RecipeMaps.hammerRecipes.findRecipeQuery() + .items(GTUtility.copyAmount(1, tDrop)) + .notUnificated(true) + .find(); if (tRecipe != null) { ItemStack tHammeringOutput = tRecipe.getOutput(0); if (tHammeringOutput != null) { diff --git a/src/main/java/gregtech/common/tools/ToolJackHammer.java b/src/main/java/gregtech/common/tools/ToolJackHammer.java index 6c46a4c9be2..bc0a7ddcc0b 100644 --- a/src/main/java/gregtech/common/tools/ToolJackHammer.java +++ b/src/main/java/gregtech/common/tools/ToolJackHammer.java @@ -78,12 +78,16 @@ public boolean isMinableBlock(Block aBlock, byte aMetaData) { public int convertBlockDrops(List aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { int rConversions = 0; - GTRecipe tRecipe = RecipeMaps.hammerRecipes - .findRecipe(null, true, 2147483647L, null, new ItemStack(aBlock, 1, aMetaData)); + GTRecipe tRecipe = RecipeMaps.hammerRecipes.findRecipeQuery() + .items(new ItemStack(aBlock, 1, aMetaData)) + .notUnificated(true) + .find(); if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { for (ItemStack tDrop : aDrops) { - tRecipe = RecipeMaps.hammerRecipes - .findRecipe(null, true, 2147483647L, null, GTUtility.copyAmount(1, tDrop)); + tRecipe = RecipeMaps.hammerRecipes.findRecipeQuery() + .items(GTUtility.copyAmount(1, tDrop)) + .notUnificated(true) + .find(); if (tRecipe != null) { ItemStack tHammeringOutput = tRecipe.getOutput(0); if (tHammeringOutput != null) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java index 386c5634f85..c81164cacb8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java @@ -295,7 +295,9 @@ public int getFuelValue(final ItemStack aStack) { return 0; } final GTRecipe tFuel = this.getRecipeMap() - .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + .findRecipeQuery() + .items(aStack) + .find(); if (tFuel != null) { return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100); } @@ -307,7 +309,9 @@ public ItemStack getEmptyContainer(final ItemStack aStack) { return null; } final GTRecipe tFuel = this.getRecipeMap() - .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + .findRecipeQuery() + .items(aStack) + .find(); if (tFuel != null) { return GTUtility.copy(tFuel.getOutput(0)); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java index 00a915b89c0..d94c764e537 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java @@ -100,12 +100,9 @@ public void loadNBTData(NBTTagCompound aNBT) { final NBTTagCompound data = list.getCompoundTagAt(0); ItemStack lastUsedFuel = ItemStack.loadItemStackFromNBT(data); if (lastUsedFuel != null) { - this.mCurrentRecipe = getRecipeMap().findRecipe( - getBaseMetaTileEntity(), - false, - 9223372036854775807L, - null, - new ItemStack[] { lastUsedFuel }); + this.mCurrentRecipe = getRecipeMap().findRecipeQuery() + .items(lastUsedFuel) + .find(); } } @@ -306,8 +303,9 @@ public int getPollution() { @Override public int getFuelValue(ItemStack aStack) { if ((GTUtility.isStackInvalid(aStack)) || (getRecipeMap() == null)) return 0; - GTRecipe tFuel = getRecipeMap() - .findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, new ItemStack[] { aStack }); + GTRecipe tFuel = getRecipeMap().findRecipeQuery() + .items(aStack) + .find(); if (tFuel != null) { this.mCurrentRecipe = tFuel; int voltage = tFuel.mEUt; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java index d78bbc0e45e..e401e907bb4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java @@ -202,7 +202,10 @@ public boolean isCorrectMachinePart(ItemStack aStack) { byte tTier = (byte) Math.max(0, GTUtility.getTier(tVoltage)); FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); if (tFluids.length > 0) { - GTRecipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, GTValues.V[tTier], tFluids); + GTRecipe tRecipe = getRecipeMap().findRecipeQuery() + .fluids(tFluids) + .voltage(GTValues.V[tTier]) + .find(); if (tRecipe != null) { FluidStack[] possibleOutputs = getPossibleByproductsOfSparge( tRecipe.mFluidInputs[0], diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java index 68cc7500057..d978b1eaabb 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java @@ -179,8 +179,10 @@ public boolean checkRecipe(ItemStack itemStack) { long tVoltageMaxTier = this.getMaxInputVoltage(); // Used to keep old math the same long tVoltageActual = GTValues.VP[(int) this.getInputVoltageTier()]; - RecipeSC tRecipe = (RecipeSC) BeamlineRecipeAdder2.instance.SourceChamberRecipes - .findRecipe(this.getBaseMetaTileEntity(), false, tVoltageActual, new FluidStack[] {}, tItems); + RecipeSC tRecipe = (RecipeSC) BeamlineRecipeAdder2.instance.SourceChamberRecipes.findRecipeQuery() + .items(tItems) + .voltage(tVoltageActual) + .find(); if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, new FluidStack[] {}, tItems)) return false; // Consumes // input diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java b/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java index d5e43aaa972..f8f0ad2cbee 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java @@ -173,14 +173,11 @@ public void outputAfterRecipe_EM() { if (entity instanceof Entity) { if (tickedStuff.add((Entity) entity)) { if (inside && entity instanceof EntityItem) { - GTRecipe tRecipe = RecipeMaps.microwaveRecipes.findRecipe( - mte, - null, - true, - 128, - null, - null, - new ItemStack[] { ((EntityItem) entity).getEntityItem() }); + GTRecipe tRecipe = RecipeMaps.microwaveRecipes.findRecipeQuery() + .items(((EntityItem) entity).getEntityItem()) + .voltage(128) + .notUnificated(true) + .find(); if (tRecipe == null || tRecipe.mInputs.length == 0 || tRecipe.mInputs[0].stackSize != 1) { itemsToOutput.add(((EntityItem) entity).getEntityItem()); } else {