diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index bb476c1d5df..31501954709 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -498,7 +498,7 @@ protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMul return null; } - return map.findRecipe(maxVoltage, inputs, fluidInputs, getMinTankCapacity(getOutputTank())); + return map.findRecipe(maxVoltage, inputs, fluidInputs); } /** diff --git a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java index db8c204fa43..d5098764a6c 100644 --- a/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java @@ -75,7 +75,7 @@ protected void trySearchNewRecipe() { if (fuelStack == null || ModHandler.isWater(fuelStack)) continue; Recipe dieselRecipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.findRecipe( - GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack), Integer.MAX_VALUE); + GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack)); // run only if it can apply a certain amount of "parallel", this is to mitigate int division if (dieselRecipe != null && fuelStack.amount >= dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { fluidTank.drain(dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER, true); @@ -86,7 +86,7 @@ protected void trySearchNewRecipe() { } Recipe denseFuelRecipe = RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.findRecipe( - GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack), Integer.MAX_VALUE); + GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack)); // run only if it can apply a certain amount of "parallel", this is to mitigate int division if (denseFuelRecipe != null && fuelStack.amount >= denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) { fluidTank.drain(denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER, true); diff --git a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java index 70aab53d54e..79b151a560c 100644 --- a/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java +++ b/src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java @@ -404,7 +404,7 @@ private static double getQuotient(double base) { */ protected static void applyTieredHammerNoRandomDrops(@Nonnull IBlockState blockState, List drops, int fortuneLevel, @Nonnull RecipeMap map, int tier) { ItemStack itemStack = GTUtility.toItem(blockState); - Recipe recipe = map.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList(), 0); + Recipe recipe = map.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList()); if (recipe != null && !recipe.getOutputs().isEmpty()) { drops.clear(); for (ItemStack outputStack : recipe.getResultItemOutputs(GTUtility.getTierByVoltage(recipe.getEUt()), tier, map)) { diff --git a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java index 47d3d999b52..d638655b0ec 100644 --- a/src/main/java/gregtech/api/items/toolitem/ToolHelper.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolHelper.java @@ -582,7 +582,7 @@ public static void applyHammerDropConversion(ItemStack tool, IBlockState state, // Stack lists can be immutable going into Recipe#matches barring no rewrites List dropAsList = Collections.singletonList(silktouchDrop); // Search for forge hammer recipes from all drops individually (only LV or under) - Recipe hammerRecipe = RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(GTValues.V[1], dropAsList, Collections.emptyList(), 0, false); + Recipe hammerRecipe = RecipeMaps.FORGE_HAMMER_RECIPES.findRecipe(GTValues.V[1], dropAsList, Collections.emptyList(), false); if (hammerRecipe != null && hammerRecipe.matches(true, dropAsList, Collections.emptyList())) { drops.clear(); OrePrefix prefix = OreDictUnifier.getPrefix(silktouchDrop); diff --git a/src/main/java/gregtech/api/recipes/GTRecipeHandler.java b/src/main/java/gregtech/api/recipes/GTRecipeHandler.java index 09f72e8a234..06e085dd803 100644 --- a/src/main/java/gregtech/api/recipes/GTRecipeHandler.java +++ b/src/main/java/gregtech/api/recipes/GTRecipeHandler.java @@ -55,7 +55,7 @@ public static > boolean removeRecipesByInputs(RecipeM } } - boolean wasRemoved = map.removeRecipe(map.findRecipe(Long.MAX_VALUE, itemIn, fluidIn, Integer.MAX_VALUE)); + boolean wasRemoved = map.removeRecipe(map.findRecipe(Long.MAX_VALUE, itemIn, fluidIn)); if (ConfigHolder.misc.debug) { if (wasRemoved) GTLog.logger.info("Removed Recipe for inputs: Items: {} Fluids: {}", itemNames, fluidNames); diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index baf710327f3..239239c6294 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -394,36 +394,34 @@ protected ValidationResult postValidateRecipe(@Nonnull ValidationResult< } @Nullable - public Recipe findRecipe(long voltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs, int outputFluidTankCapacity) { - return this.findRecipe(voltage, GTUtility.itemHandlerToList(inputs), GTUtility.fluidHandlerToList(fluidInputs), outputFluidTankCapacity); + public Recipe findRecipe(long voltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs) { + return this.findRecipe(voltage, GTUtility.itemHandlerToList(inputs), GTUtility.fluidHandlerToList(fluidInputs)); } /** * Finds a Recipe matching the Fluid and/or ItemStack Inputs. * - * @param voltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage - * @param inputs the Item Inputs - * @param fluidInputs the Fluid Inputs - * @param outputFluidTankCapacity minimal capacity of output fluid tank, used for fluid canner recipes for example + * @param voltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage + * @param inputs the Item Inputs + * @param fluidInputs the Fluid Inputs * @return the Recipe it has found or null for no matching Recipe */ @Nullable - public Recipe findRecipe(long voltage, List inputs, List fluidInputs, int outputFluidTankCapacity) { - return findRecipe(voltage, inputs, fluidInputs, outputFluidTankCapacity, false); + public Recipe findRecipe(long voltage, List inputs, List fluidInputs) { + return findRecipe(voltage, inputs, fluidInputs, false); } /** * Finds a Recipe matching the Fluid and/or ItemStack Inputs. * - * @param voltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage - * @param inputs the Item Inputs - * @param fluidInputs the Fluid Inputs - * @param outputFluidTankCapacity minimal capacity of output fluid tank, used for fluid canner recipes for example - * @param exactVoltage should require exact voltage matching on recipe. used by craftweaker + * @param voltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage + * @param inputs the Item Inputs + * @param fluidInputs the Fluid Inputs + * @param exactVoltage should require exact voltage matching on recipe. used by craftweaker * @return the Recipe it has found or null for no matching Recipe */ @Nullable - public Recipe findRecipe(long voltage, final List inputs, final List fluidInputs, int outputFluidTankCapacity, boolean exactVoltage) { + public Recipe findRecipe(long voltage, final List inputs, final List fluidInputs, boolean exactVoltage) { final List items = inputs.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList()); final List fluids = fluidInputs.stream().filter(f -> f != null && f.amount != 0).collect(Collectors.toList()); @@ -1150,7 +1148,7 @@ public SoundEvent getSound() { public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) { List mcItemInputs = itemInputs == null ? Collections.emptyList() : Arrays.stream(itemInputs).map(CraftTweakerMC::getItemStack).collect(Collectors.toList()); List mcFluidInputs = fluidInputs == null ? Collections.emptyList() : Arrays.stream(fluidInputs).map(CraftTweakerMC::getLiquidStack).collect(Collectors.toList()); - Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, outputFluidTankCapacity, true); + Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, true); return backingRecipe == null ? null : new CTRecipe(this, backingRecipe); } diff --git a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java index 710d1493faa..045975e5a01 100644 --- a/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java +++ b/src/main/java/gregtech/api/recipes/logic/ParallelLogic.java @@ -1,11 +1,6 @@ package gregtech.api.recipes.logic; import gregtech.api.capability.IMultipleTankHandler; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.recipes.FluidKey; -import gregtech.api.recipes.Recipe; -import gregtech.api.recipes.RecipeBuilder; -import gregtech.api.recipes.RecipeMap; import gregtech.api.metatileentity.IVoidable; import gregtech.api.recipes.FluidKey; import gregtech.api.recipes.Recipe; @@ -505,7 +500,7 @@ public static RecipeBuilder appendItemRecipes(@Nonnull RecipeMap recipeMap // Determine if there is a valid recipe for this item. If not, skip it. Recipe matchingRecipe = recipeMap.findRecipe(maxVoltage, Collections.singletonList(currentInputItem), - Collections.emptyList(), 0); + Collections.emptyList()); GTRecipeInput inputIngredient; if (matchingRecipe != null) { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java index 05373ee68f6..b635d2c0f3c 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFluidCanner.java @@ -20,8 +20,8 @@ public RecipeMapFluidCanner(String unlocalizedName, int maxInputs, int maxOutput @Override @Nullable - public Recipe findRecipe(long voltage, List inputs, List fluidInputs, int outputFluidTankCapacity, boolean exactVoltage) { - Recipe recipe = super.findRecipe(voltage, inputs, fluidInputs, outputFluidTankCapacity, exactVoltage); + public Recipe findRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + Recipe recipe = super.findRecipe(voltage, inputs, fluidInputs, exactVoltage); if (recipe != null) return recipe; for (ItemStack input : inputs) { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java index 4cc693c69d4..4b2ad541b5d 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFormingPress.java @@ -29,8 +29,8 @@ public RecipeMapFormingPress(String unlocalizedName, int maxInputs, int maxOutpu @Override @Nullable - public Recipe findRecipe(long voltage, List inputs, List fluidInputs, int outputFluidTankCapacity, boolean exactVoltage) { - Recipe recipe = super.findRecipe(voltage, inputs, fluidInputs, outputFluidTankCapacity, exactVoltage); + public Recipe findRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + Recipe recipe = super.findRecipe(voltage, inputs, fluidInputs, exactVoltage); // Item Mold renaming - min of 2 inputs required if (recipe == null && inputs.size() > 1) { diff --git a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java index 6195cecf6ad..015b9e678bc 100644 --- a/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java +++ b/src/main/java/gregtech/api/recipes/machines/RecipeMapFurnace.java @@ -19,8 +19,8 @@ public RecipeMapFurnace(String unlocalizedName, int maxInputs, int maxOutputs, i @Override @Nullable - public Recipe findRecipe(long voltage, List inputs, List fluidInputs, int outputFluidTankCapacity, boolean exactVoltage) { - Recipe normalRecipe = super.findRecipe(voltage, inputs, fluidInputs, outputFluidTankCapacity, exactVoltage); + public Recipe findRecipe(long voltage, List inputs, List fluidInputs, boolean exactVoltage) { + Recipe normalRecipe = super.findRecipe(voltage, inputs, fluidInputs, exactVoltage); if (normalRecipe != null || inputs.size() == 0) return normalRecipe; diff --git a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java index 569a6a7cb9d..940b95a35b6 100644 --- a/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SmartItemFilter.java @@ -45,7 +45,7 @@ public Object matchItemStack(ItemStack itemStack) { ItemStack infinitelyBigStack = itemStack.copy(); infinitelyBigStack.setCount(Integer.MAX_VALUE); - Recipe recipe = filteringMode.recipeMap.findRecipe(Long.MAX_VALUE, Collections.singletonList(infinitelyBigStack), Collections.emptyList(), Integer.MAX_VALUE); + Recipe recipe = filteringMode.recipeMap.findRecipe(Long.MAX_VALUE, Collections.singletonList(infinitelyBigStack), Collections.emptyList()); if (recipe == null) { filteringMode.transferStackSizesCache.put(itemAndMetadata, 0); cachedTransferRateValue = 0; diff --git a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java index 48ab5fbb0da..beadfcb4253 100644 --- a/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java +++ b/src/main/java/gregtech/integration/groovy/VirtualizedRecipeMap.java @@ -61,7 +61,7 @@ public SimpleObjectStream streamRecipes() { public Recipe find(long voltage, List items, List fluids) { if (items == null || items.isEmpty()) items = Collections.emptyList(); if (fluids == null || fluids.isEmpty()) fluids = Collections.emptyList(); - return this.recipeMap.findRecipe(voltage, items, fluids, Integer.MAX_VALUE, true); + return this.recipeMap.findRecipe(voltage, items, fluids, true); } public boolean removeByInput(long voltage, List items, List fluids) { diff --git a/src/test/java/gregtech/api/recipes/RecipeMapTest.java b/src/test/java/gregtech/api/recipes/RecipeMapTest.java index 231b602c588..308983b27d8 100644 --- a/src/test/java/gregtech/api/recipes/RecipeMapTest.java +++ b/src/test/java/gregtech/api/recipes/RecipeMapTest.java @@ -85,11 +85,11 @@ public void setupRecipes() { public void findRecipe() { MatcherAssert.assertThat(map.getRecipeList().size(), is(3)); - Recipe r = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.COBBLESTONE)), Collections.singletonList(null), 0); + Recipe r = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.COBBLESTONE)), Collections.singletonList(null)); MatcherAssert.assertThat(r, notNullValue()); // This test is failing for me locally -dan - Recipe r2 = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.STONE)), Collections.singletonList(new FluidStack(FluidRegistry.WATER, 1)), 0); + Recipe r2 = map.findRecipe(1, Collections.singletonList(new ItemStack(Blocks.STONE)), Collections.singletonList(new FluidStack(FluidRegistry.WATER, 1))); MatcherAssert.assertThat(r2, notNullValue()); } @@ -101,8 +101,8 @@ public void findRecipeFluidOnly() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)), - 64000); + NitrogenDioxide.getFluid(1000)) + ); MatcherAssert.assertThat(r, notNullValue()); } @@ -113,8 +113,8 @@ public void removeRecipe() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)), - 64000); + NitrogenDioxide.getFluid(1000)) + ); MatcherAssert.assertThat(r, notNullValue()); assert map.removeRecipe(r); MatcherAssert.assertThat(map.findRecipe(30, @@ -122,8 +122,8 @@ public void removeRecipe() { Arrays.asList( Epichlorohydrin.getFluid(144), Naphtha.getFluid(3000), - NitrogenDioxide.getFluid(1000)), - 64000), nullValue()); + NitrogenDioxide.getFluid(1000)) + ), nullValue()); MatcherAssert.assertThat(map.getRecipeList().size(), is(2)); }