From f6fcb25a0b80a940308ebdec4e0480fb3f48b1bb Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Tue, 16 Jun 2026 19:45:15 -0500 Subject: [PATCH 01/28] Remove tiered chance boosting --- docs/content/Modpacks/Changes/v8.0.0.md | 3 +- .../capability/recipe/EURecipeCapability.java | 2 +- .../recipe/FluidRecipeCapability.java | 5 +- .../recipe/ItemRecipeCapability.java | 5 +- .../multiblock/MultiblockDisplayText.java | 13 ++-- .../gtceu/api/recipe/GTRecipeType.java | 4 -- .../gtceu/api/recipe/RecipeRunner.java | 9 +-- .../chance/boost/ChanceBoostFunction.java | 38 ------------ .../api/recipe/chance/logic/ChanceLogic.java | 49 +++++---------- .../gtceu/api/recipe/content/Content.java | 46 ++++----------- .../recipe/content/IContentSerializer.java | 8 +-- .../gtceu/common/data/GTRecipeTypes.java | 4 -- .../data/recipe/builder/GTRecipeBuilder.java | 2 +- .../jade/provider/RecipeOutputProvider.java | 13 ++-- .../kjs/recipe/GTRecipeSchema.java | 59 ++++++------------- .../kjs/recipe/components/ContentJS.java | 7 +-- .../xei/widgets/GTOreByProduct.java | 10 +--- .../xei/widgets/GTOreByProductWidget.java | 2 +- .../xei/widgets/GTRecipeWidget.java | 54 ++++------------- 19 files changed, 80 insertions(+), 253 deletions(-) delete mode 100644 src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java diff --git a/docs/content/Modpacks/Changes/v8.0.0.md b/docs/content/Modpacks/Changes/v8.0.0.md index 59b9b39bb30..556a36338a9 100644 --- a/docs/content/Modpacks/Changes/v8.0.0.md +++ b/docs/content/Modpacks/Changes/v8.0.0.md @@ -150,4 +150,5 @@ A few regexes for fixing all the MCMeta files is follows, run them in order: - Calling the battery buffer constructor with the following args gives the same behaviour as a charger machine: `(info, tier, inventorySize, BatteryBufferMachine.AMPS_PER_BATTERY_CHARGER, 0)` - Refactored Jade provider code. Use the `MachineInfoProvider` class for jade providers for a specific machine type, and `MachineTraitProvider` for providers for a specific machine trait. - `GTUtil.getMoltenFluid(Material)` has been moved to `Material.getHotFluid()`. -- `ICopyable::copyConfig`'s `CompoundTag` argument should now be mutated by reference instead of a new one returned (and thus, the return type has been changed to `void`). \ No newline at end of file +- `ICopyable::copyConfig`'s `CompoundTag` argument should now be mutated by reference instead of a new one returned (and thus, the return type has been changed to `void`). +- Tiered Chance Boosting has been formally removed from the API (as it was deprecated in v7.0.) `ChancedInput` and `ChancedOutput` kubeJS calls will throw errors if they still had chance boost values as arguments. \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java index c518228571c..e23df30d9da 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java @@ -133,7 +133,7 @@ public int getMaxParallelByInput(IRecipeCapabilityHolder holder, GTRecipe recipe */ public static List makeEUContent(EnergyStack eu) { return List.of( - new Content(eu, ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue(), 0)); + new Content(eu, ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue())); } /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java index 674fc117033..4b43c447141 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java @@ -381,8 +381,7 @@ public void applyWidgetInfo(@NotNull Widget widget, tank.setAllowClickDrained(!isXEI && io.support(IO.IN)); if (isXEI) tank.setShowAmount(false); if (content != null) { - float chance = (float) recipeType.getChanceFunction() - .getBoostedChance(content, recipeTier, chanceTier) / content.maxChance; + float chance = ((float) content.chance) / content.maxChance; tank.setXEIChance(chance); tank.setOnAddedTooltips((w, tooltips) -> { FluidIngredient ingredient = FluidRecipeCapability.CAP.of(content.content); @@ -398,7 +397,7 @@ public void applyWidgetInfo(@NotNull Widget widget, } GTRecipeWidget.setConsumedChance(content, recipe.getChanceLogicForCapability(this, io, isTickSlot(index, io, recipe)), - tooltips, recipeTier, chanceTier, recipeType.getChanceFunction()); + tooltips); if (isTickSlot(index, io, recipe)) { tooltips.add(Component.translatable("gtceu.gui.content.per_tick")); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index 239d8a9377b..4bddc093d0e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -464,13 +464,12 @@ public void applyWidgetInfo(@NotNull Widget widget, } } if (content != null) { - float chance = (float) recipeType.getChanceFunction() - .getBoostedChance(content, recipeTier, chanceTier) / content.maxChance; + float chance = ((float) content.chance) / content.maxChance; slot.setXEIChance(chance); slot.setOnAddedTooltips((w, tooltips) -> { GTRecipeWidget.setConsumedChance(content, recipe.getChanceLogicForCapability(this, io, isTickSlot(index, io, recipe)), - tooltips, recipeTier, chanceTier, recipeType.getChanceFunction()); + tooltips); // spotless:off if (this.of(content.content) instanceof IntProviderIngredient ingredient) { IntProvider countProvider = ingredient.getCountProvider(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 1b9abeb2afa..e62e0a2c156 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -424,7 +424,6 @@ public Builder addOutputLines(GTRecipe recipe) { if (recipe != null) { int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; - var function = recipe.getType().getChanceFunction(); double maxDurationSec = (double) recipe.duration / 20.0; var itemOutputs = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidOutputs = recipe.getOutputContents(FluidRecipeCapability.CAP); @@ -446,8 +445,7 @@ public Builder addOutputLines(GTRecipe recipe) { provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (item.chance < item.maxChance) { - countD = countD * runs * function.getBoostedChance(item, recipeTier, chanceTier) / - item.maxChance; + countD = countD * runs * item.chance / item.maxChance; } countD = countD * provider.getMidRoll(); } else { @@ -458,8 +456,7 @@ public Builder addOutputLines(GTRecipe recipe) { countD *= count; if (item.chance < item.maxChance) { rounded = true; - countD = countD * runs * function.getBoostedChance(item, recipeTier, chanceTier) / - item.maxChance; + countD = countD * runs * item.chance / item.maxChance; } count = Math.max(1, (int) Math.round(countD)); displaycount = Component.literal(String.valueOf(count)); @@ -490,8 +487,7 @@ public Builder addOutputLines(GTRecipe recipe) { provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (fluid.chance < fluid.maxChance) { - amountD = amountD * runs * function.getBoostedChance(fluid, recipeTier, chanceTier) / - fluid.maxChance; + amountD = amountD * runs * fluid.chance / fluid.maxChance; } amountD = amountD * provider.getMidRoll(); } else { @@ -502,8 +498,7 @@ public Builder addOutputLines(GTRecipe recipe) { amountD *= amount; if (fluid.chance < fluid.maxChance) { rounded = true; - amountD = amountD * runs * function.getBoostedChance(fluid, recipeTier, chanceTier) / - fluid.maxChance; + amountD = amountD * runs * fluid.chance / fluid.maxChance; } amount = Math.max(1, (int) Math.round(amountD)); displaycount = Component.literal(String.valueOf(amount)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java index 2f5e78e6acc..6a4a71b1815 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java @@ -4,7 +4,6 @@ import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.gui.SteamTexture; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.lookup.RecipeAdditionHandler; import com.gregtechceu.gtceu.api.recipe.lookup.RecipeDB; import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI; @@ -52,9 +51,6 @@ public class GTRecipeType implements RecipeType { private GTRecipeBuilder recipeBuilder; @Getter @Setter - private ChanceBoostFunction chanceFunction = ChanceBoostFunction.NONE; - @Getter - @Setter private GTRecipeTypeUI recipeUI = new GTRecipeTypeUI(this); @Setter @Getter diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java index d23fc3b5501..9c841645874 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java @@ -7,7 +7,6 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupColor; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; @@ -73,9 +72,6 @@ public ActionResult handle(Map, List> entries) { * Populates the content match list to know if conditions are satisfied. */ private void fillContentMatchList(Map, List> entries) { - ChanceBoostFunction function = recipe.getType().getChanceFunction(); - int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); - int chanceTier = recipeTier + recipe.ocLevel; for (var entry : entries.entrySet()) { RecipeCapability cap = entry.getKey(); if (!cap.doMatchInRecipe()) continue; @@ -97,7 +93,7 @@ private void fillContentMatchList(Map, List> entrie if (cont.chance >= cont.maxChance) { contentList.add(cont.content); - } else if (cont.chance > 0 || cont.tierChanceBoost > 0) { + } else if (cont.chance > 0) { chancedContents.add(cont); } // Do not add Non-Consumed ingredients; they'd just get dropped after the chance roll anyway @@ -106,8 +102,7 @@ private void fillContentMatchList(Map, List> entrie // add chanced contents to the recipe content map if (!chancedContents.isEmpty()) { var cache = this.chanceCaches.get(cap); - chancedContents = logic.roll(cap, chancedContents, function, recipeTier, chanceTier, cache, - recipe.getTotalRuns()); + chancedContents = logic.roll(cap, chancedContents, cache, recipe.getTotalRuns()); for (Content cont : chancedContents) { contentList.add(cont.content); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java deleted file mode 100644 index 5f6b16fba75..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gregtechceu.gtceu.api.recipe.chance.boost; - -import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.recipe.content.Content; - -import net.minecraft.util.Mth; - -import org.jetbrains.annotations.NotNull; - -/** - * A function used to boost a {@link Content}'s chance - */ -@FunctionalInterface -public interface ChanceBoostFunction { - - /** - * Chance boosting function based on the number of performed overclocks - */ - ChanceBoostFunction OVERCLOCK = (entry, recipeTier, chanceTier) -> { - int tierDiff = chanceTier - recipeTier; - if (tierDiff <= 0) return entry.chance; // equal or invalid tiers do not boost at all - if (recipeTier == GTValues.ULV) tierDiff--; // LV does not boost over ULV - return Mth.clamp(entry.chance + (entry.tierChanceBoost * tierDiff), 0, entry.maxChance); - }; - - /** - * Chance boosting function which performs no boosting - */ - ChanceBoostFunction NONE = (entry, recipeTier, chanceTier) -> entry.chance; - - /** - * @param entry the amount to boost by - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at - * @return the boosted chance - */ - int getBoostedChance(@NotNull Content entry, int recipeTier, int chanceTier); -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java index b797868153d..e3e0c98930c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.registry.GTRegistries; @@ -41,8 +40,7 @@ public abstract class ChanceLogic { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (Content entry : chancedEntries) { int maxChance = entry.maxChance; @@ -50,7 +48,7 @@ public abstract class ChanceLogic { // OR Chanced outputs are deterministic // If a large batch is being done we can calculate how many we expect to get. // Add the guaranteed part of that to the list, then roll for the remaining chanced part. - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int totalChance = times * newChance; int guaranteed = totalChance / maxChance; if (guaranteed > 0) builder.add(entry.copyChanced(cap, ContentModifier.multiplier(guaranteed))); @@ -87,13 +85,12 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < times; ++i) { boolean failed = false; for (Content entry : chancedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, entry.maxChance)) newChance -= entry.maxChance; @@ -127,13 +124,12 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < times; ++i) { Content selected = null; for (Content entry : chancedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, entry.maxChance)) { @@ -167,8 +163,7 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { // Have to set up a system where all chances are set to be out of 10000 IntList chancesOutOfTenThousand = new IntArrayList(); @@ -205,7 +200,7 @@ public String toString() { List normalizedEntries = new ArrayList<>(); for (int i = 0; i < chancesOutOfTenThousand.size(); i++) { normalizedEntries.add(new Content(chancedEntries.get(i).content, chancesOutOfTenThousand.getInt(i), - getMaxChancedValue(), chancedEntries.get(i).tierChanceBoost)); + getMaxChancedValue())); } // Use the new, normalized list for the logic @@ -214,7 +209,7 @@ public String toString() { int nonGuaranteedTimes = times; if (times > 1) { for (Content entry : normalizedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int totalChance = times * newChance; int guaranteed = totalChance / 10000; if (guaranteed > 0) { @@ -228,7 +223,7 @@ public String toString() { Content selected = null; int maxChance = getMaxChancedValue(); for (Content entry : normalizedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, maxChance)) { @@ -263,8 +258,7 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { return Collections.emptyList(); } @@ -284,15 +278,11 @@ public ChanceLogic(String id) { } /** - * @param entry the entry to get the complete chance for - * @param boostFunction the function boosting the entry's chance - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at + * @param entry the entry to get the complete chance for * @return the total chance for the entry */ - static int getChance(@NotNull Content entry, @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier) { - return boostFunction.getBoostedChance(entry, recipeTier, chanceTier); + static int getChance(@NotNull Content entry) { + return entry.chance; } /** @@ -338,35 +328,26 @@ static void updateCachedChance(Object ingredient, @Nullable Object2IntMap cac * Roll the chance and attempt to produce the output * * @param chancedEntries the list of entries to roll - * @param boostFunction the function to boost the entries' chances - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at * @param cache the cache of previously rolled chances, can be null * @param times the number of times to roll * @return a list of the produced outputs, empty if roll fails */ public abstract @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, - int recipeTier, int chanceTier, @Nullable Object2IntMap cache, int times); /** * Roll the chance and attempt to produce the output * * @param chancedEntries the list of entries to roll - * @param boostFunction the function to boost the entries' chances - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at * @param times the number of times to roll * @return a list of the produced outputs */ @Unmodifiable public List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, int chanceTier, int times) { - return roll(cap, chancedEntries, boostFunction, recipeTier, chanceTier, null, times); + return roll(cap, chancedEntries, null, times); } @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java index 59015b68e6e..95a5b7a0b95 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.content; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IntProviderFluidIngredient; @@ -26,7 +25,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.Getter; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class Content { @@ -34,13 +32,11 @@ public class Content { public final Object content; public final int chance; public final int maxChance; - public final int tierChanceBoost; - public Content(Object content, int chance, int maxChance, int tierChanceBoost) { + public Content(Object content, int chance, int maxChance) { this.content = content; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = fixBoost(tierChanceBoost); } public static Codec codec(RecipeCapability capability) { @@ -49,9 +45,7 @@ public static Codec codec(RecipeCapability capability) { ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("chance", ChanceLogic.getMaxChancedValue()) .forGetter(val -> val.chance), ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("maxChance", ChanceLogic.getMaxChancedValue()) - .forGetter(val -> val.maxChance), - Codec.INT.optionalFieldOf("tierChanceBoost", 0) - .forGetter(val -> val.tierChanceBoost)) + .forGetter(val -> val.maxChance)) .apply(instance, Content::new)); } @@ -59,7 +53,7 @@ public static Codec codec(RecipeCapability capability) { * Directly copies a Content. */ public Content copy(RecipeCapability capability) { - return new Content(capability.copyContent(content), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content), chance, maxChance); } /** @@ -69,7 +63,7 @@ public Content copy(RecipeCapability capability, @NotNull ContentModifier mod if (modifier == ContentModifier.IDENTITY || chance < maxChance) { return copy(capability); } else { - return new Content(capability.copyContent(content, modifier), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content, modifier), chance, maxChance); } } @@ -80,7 +74,7 @@ public Content copyChanced(RecipeCapability capability, @NotNull ContentModif if (modifier == ContentModifier.IDENTITY) { return copy(capability); } else { - return new Content(capability.copyContent(content, modifier), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content, modifier), chance, maxChance); } } @@ -88,30 +82,13 @@ public boolean isChanced() { return chance > 0 && chance < maxChance; } - /** - * Attempts to fix and round the given chance boost due to potential differences - * between the max chance and {@link ChanceLogic#getMaxChancedValue()}. - *
- * The worst case would be {@code 5,001 / 10,000} , meaning the boost would - * have to be halved to have the intended effect. - * - * @param chanceBoost the chance boost to be fixed - * @return the fixed chance boost - */ - private int fixBoost(int chanceBoost) { - float error = (float) ChanceLogic.getMaxChancedValue() / maxChance; - int fixed = Math.round(Math.abs(chanceBoost) / error); - return chanceBoost < 0 ? -fixed : fixed; - } - - public IGuiTexture createOverlay(boolean perTick, int recipeTier, int chanceTier, - @Nullable ChanceBoostFunction function) { + public IGuiTexture createOverlay(boolean perTick) { return new IGuiTexture() { @Override @OnlyIn(Dist.CLIENT) public void draw(GuiGraphics graphics, int mouseX, int mouseY, float x, float y, int width, int height) { - drawChance(graphics, x, y, width, height, recipeTier, chanceTier, function); + drawChance(graphics, x, y, width, height); drawRangeAmount(graphics, x, y, width, height); drawFluidAmount(graphics, x, y, width, height); if (perTick) { @@ -172,15 +149,13 @@ public void drawFluidAmount(GuiGraphics graphics, float x, float y, int width, i } @OnlyIn(Dist.CLIENT) - public void drawChance(GuiGraphics graphics, float x, float y, int width, int height, int recipeTier, - int chanceTier, @Nullable ChanceBoostFunction function) { + public void drawChance(GuiGraphics graphics, float x, float y, int width, int height) { if (chance == ChanceLogic.getMaxChancedValue()) return; graphics.pose().pushPose(); graphics.pose().translate(0, 0, 400); graphics.pose().scale(0.5f, 0.5f, 1); - var func = function == null ? ChanceBoostFunction.NONE : function; - int chance = func.getBoostedChance(this, recipeTier, chanceTier); - float chanceFloat = 1f * chance / this.maxChance; + + float chanceFloat = 1f * this.chance / this.maxChance; String percent = FormattingUtil.formatNumber2Places(100 * chanceFloat); String s = chance == 0 ? LocalizationUtils.format("gtceu.gui.content.chance_nc_short") : @@ -214,7 +189,6 @@ public String toString() { "content=" + content + ", chance=" + chance + ", maxChance=" + maxChance + - ", tierChanceBoost=" + tierChanceBoost + '}'; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java index 2186fb6d4ad..befc73bd069 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java @@ -40,15 +40,13 @@ default void toNetworkContent(FriendlyByteBuf buf, Content content) { toNetwork(buf, inner); buf.writeVarInt(content.chance); buf.writeVarInt(content.maxChance); - buf.writeVarInt(content.tierChanceBoost); } default Content fromNetworkContent(FriendlyByteBuf buf) { T inner = fromNetwork(buf); int chance = buf.readVarInt(); int maxChance = buf.readVarInt(); - int tierChanceBoost = buf.readVarInt(); - return new Content(inner, chance, maxChance, tierChanceBoost); + return new Content(inner, chance, maxChance); } Class contentClass(); @@ -61,7 +59,6 @@ default JsonElement toJsonContent(Content content) { json.add("content", toJson((T) content.getContent())); json.addProperty("chance", content.chance); json.addProperty("maxChance", content.maxChance); - json.addProperty("tierChanceBoost", content.tierChanceBoost); return json; } @@ -71,8 +68,7 @@ default Content fromJsonContent(JsonElement json) { int chance = jsonObject.has("chance") ? jsonObject.get("chance").getAsInt() : ChanceLogic.getMaxChancedValue(); int maxChance = jsonObject.has("maxChance") ? jsonObject.get("maxChance").getAsInt() : ChanceLogic.getMaxChancedValue(); - int tierChanceBoost = jsonObject.has("tierChanceBoost") ? jsonObject.get("tierChanceBoost").getAsInt() : 0; - return new Content(inner, chance, maxChance, tierChanceBoost); + return new Content(inner, chance, maxChance); } default Tag toNbt(T content) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index 35e97e539dc..9b48caff4cc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -571,10 +571,8 @@ public class GTRecipeTypes { if (shouldDivide && fluidsDivisible) { builder.chance(inputContent.chance) - .tierChanceBoost(inputContent.tierChanceBoost) .inputFluids(dividedInputFluid) .chance(outputContent.chance) - .tierChanceBoost(outputContent.tierChanceBoost) .outputFluids(dividedOutputFluid) .duration(Math.max(1, recipeDuration / ratio)); } else if (!shouldDivide) { @@ -583,10 +581,8 @@ public class GTRecipeTypes { } builder.conditions.addAll(recipeBuilder.conditions); builder.chance(inputContent.chance) - .tierChanceBoost(inputContent.tierChanceBoost) .inputFluids(input) .chance(outputContent.chance) - .tierChanceBoost(outputContent.tierChanceBoost) .outputFluids(output) .duration(recipeDuration) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 6887bcafc9e..937c1f731ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -182,7 +182,7 @@ public GTRecipeBuilder copyFrom(GTRecipeBuilder builder) { } protected Content makeContent(Object o) { - return new Content(o, chance, maxChance, tierChanceBoost); + return new Content(o, chance, maxChance); } public GTRecipeBuilder input(RecipeCapability capability, T obj) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java index e24235936c4..f4113bbd8b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java @@ -58,7 +58,6 @@ protected CompoundTag write(RecipeLogic recipeLogic) { if (recipe != null) { int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; - var function = recipe.getType().getChanceFunction(); var itemContents = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidContents = recipe.getOutputContents(FluidRecipeCapability.CAP); int runs = recipe.getTotalRuns(); @@ -70,8 +69,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { // don't roll for output but do copy for chance and batch IntProviderIngredient chanced = provider; if (item.chance < item.maxChance) { - double countD = (double) runs * - function.getBoostedChance(item, recipeTier, chanceTier) / item.maxChance; + double countD = ((double) runs * item.chance) / item.maxChance; chanced = (IntProviderIngredient) ItemRecipeCapability.CAP.copyWithModifier(provider, ContentModifier.multiplier(countD)); } @@ -84,8 +82,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { GTUtil.saveItemStack(stack, itemTag); if (item.chance < item.maxChance) { int count = stack.getCount(); - double countD = (double) count * runs * - function.getBoostedChance(item, recipeTier, chanceTier) / item.maxChance; + double countD = ((double) count * runs * item.chance) / item.maxChance; count = Math.max(1, (int) Math.round(countD)); itemTag.putInt("Count", count); } @@ -104,8 +101,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { // don't bother rolling output for nothing IntProviderFluidIngredient chanced = provider; if (fluid.chance < fluid.maxChance) { - double countD = (double) runs * - function.getBoostedChance(fluid, recipeTier, chanceTier) / fluid.maxChance; + double countD = ((double) runs * fluid.chance) / fluid.maxChance; chanced = (IntProviderFluidIngredient) FluidRecipeCapability.CAP.copyWithModifier(provider, ContentModifier.multiplier(countD)); } @@ -120,8 +116,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { if (fluid.chance < fluid.maxChance) { int amount = stacks[0].getAmount(); - double amountD = (double) amount * runs * - function.getBoostedChance(fluid, recipeTier, chanceTier) / fluid.maxChance; + double amountD = ((double) amount * runs * fluid.chance) / fluid.maxChance; amount = Math.max(1, (int) Math.round(amountD)); fluidTag.putInt("Amount", amount); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java index 74758b76dfb..40ab764d9cc 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java @@ -91,8 +91,6 @@ class GTRecipeJS extends RecipeJS { public int chance = ChanceLogic.getMaxChancedValue(); @Setter public int maxChance = ChanceLogic.getMaxChancedValue(); - @Setter - public int tierChanceBoost = 0; @Getter private ResourceLocation idWithoutType; @Setter @@ -139,7 +137,7 @@ public GTRecipeJS input(RecipeCapability capability, Object... obj) { id, (perTick ? "Tick " : ""), capability.name, recipeType.getMaxInputs(capability))); } for (Object object : obj) { - map.add(capability, new Content(object, chance, maxChance, tierChanceBoost)); + map.add(capability, new Content(object, chance, maxChance)); } } save(); @@ -164,7 +162,7 @@ public GTRecipeJS output(RecipeCapability capability, Object... obj) { id, (perTick ? "Tick " : ""), capability.name, recipeType.getMaxOutputs(capability))); } for (Object object : obj) { - map.add(capability, new Content(object, chance, maxChance, tierChanceBoost)); + map.add(capability, new Content(object, chance, maxChance)); } } save(); @@ -480,7 +478,7 @@ public GTRecipeJS circuit(int configuration) { return notConsumable(InputItem.of(IntCircuitIngredient.of(configuration), 1)); } - public GTRecipeJS chancedInput(InputItem stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedInput(InputItem stack, int chance) { validateItems("chanced input", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -489,17 +487,13 @@ public GTRecipeJS chancedInput(InputItem stack, int chance, int tierChanceBoost) ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, int chance, - int tierChanceBoost) { + public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, int chance) { validateFluids("chanced input", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -508,16 +502,13 @@ public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedOutput(ExtendedOutputItem stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedOutput(ExtendedOutputItem stack, int chance) { validateItems("chanced output", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -526,25 +517,21 @@ public GTRecipeJS chancedOutput(ExtendedOutputItem stack, int chance, int tierCh ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int chance, int tierChanceBoost) { - return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat), null), chance, tierChanceBoost); + public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int chance) { + return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat), null), chance); } - public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int count, int chance, int tierChanceBoost) { - return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat, count), null), chance, - tierChanceBoost); + public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int count, int chance) { + return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat, count), null), chance); } - public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction, int tierChanceBoost) { + public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction) { validateItems("chanced output", stack); String[] split = fraction.split("/"); @@ -565,7 +552,7 @@ public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction, int t "Fraction or number was not parsed correctly! Expected format is \"1/3\" or \"1000\". Actual: \"%s\".", fraction)); } - return chancedOutput(stack, chance, tierChanceBoost); + return chancedOutput(stack, chance); } try { chance = Integer.parseInt(split[0]); @@ -593,29 +580,25 @@ public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction, int t int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, int count, String fraction, - int tierChanceBoost) { + public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, int count, String fraction) { return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(prefix, material, count), null), - fraction, tierChanceBoost); + fraction); } - public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, String fraction, int tierChanceBoost) { - return chancedOutput(prefix, material, 1, fraction, tierChanceBoost); + public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, String fraction) { + return chancedOutput(prefix, material, 1, fraction); } - public GTRecipeJS chancedFluidOutput(FluidStackJS stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedFluidOutput(FluidStackJS stack, int chance) { validateFluids("chanced output", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -624,16 +607,13 @@ public GTRecipeJS chancedFluidOutput(FluidStackJS stack, int chance, int tierCha ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction, int tierChanceBoost) { + public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction) { validateFluids("chanced output", stack); if (stack.getAmount() == 0) { @@ -658,7 +638,7 @@ public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction, int ti "Fraction or number was not parsed correctly! Expected format is \"1/3\" or \"1000\". Actual: \"%s\".", fraction)); } - return chancedFluidOutput(stack, chance, tierChanceBoost); + return chancedFluidOutput(stack, chance); } try { @@ -687,14 +667,11 @@ public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction, int ti int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java index 3d9694d7b71..16bd3e3e5e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java @@ -34,7 +34,6 @@ public JsonElement write(RecipeJS recipe, Content value) { object.add("content", baseComponent.write(recipe, baseComponent.read(recipe, value.content))); object.addProperty("chance", value.chance); object.addProperty("maxChance", value.maxChance); - object.addProperty("tierChanceBoost", value.tierChanceBoost); return object; } @@ -46,7 +45,7 @@ else if (from instanceof JsonObject json) { int chance = GsonHelper.getAsInt(json, "chance", ChanceLogic.getMaxChancedValue()); int maxChance = GsonHelper.getAsInt(json, "maxChance", ChanceLogic.getMaxChancedValue()); int tierChanceBoost = GsonHelper.getAsInt(json, "tierChanceBoost", 0); - return new Content(content, chance, maxChance, tierChanceBoost); + return new Content(content, chance, maxChance); } return null; } @@ -65,14 +64,14 @@ public boolean isOutput(RecipeJS recipe, Content value, ReplacementMatch match) public Content replaceInput(RecipeJS recipe, Content original, ReplacementMatch match, InputReplacement with) { return isInput(recipe, original, match) ? new Content( baseComponent.replaceInput(recipe, baseComponent.read(recipe, original.content), match, with), - original.chance, original.maxChance, original.tierChanceBoost) : + original.chance, original.maxChance) : original; } @Override public Content replaceOutput(RecipeJS recipe, Content original, ReplacementMatch match, OutputReplacement with) { return isOutput(recipe, original, match) ? new Content(with.replaceOutput(recipe, match, with), - original.chance, original.maxChance, original.tierChanceBoost) : + original.chance, original.maxChance) : original; } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProduct.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProduct.java index 6e1f89112d0..68ff1e01fb3 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProduct.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProduct.java @@ -292,13 +292,7 @@ public void getTooltip(int slotIndex, List tooltips) { if (chances.containsKey(slotIndex)) { Content entry = chances.get(slotIndex); float chance = 100 * (float) entry.chance / entry.maxChance; - if (entry.tierChanceBoost != 0) { - float boost = entry.tierChanceBoost / 100.0f; - tooltips.add(FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_base", chance)); - tooltips.add(FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_tier_boost_plus", boost)); - } else { - tooltips.add(FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", chance)); - } + tooltips.add(FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", chance)); } } @@ -344,7 +338,7 @@ private void addToInputs(ItemStack stack) { private void addChance(int base, int tier) { // this is solely for the chance overlay and tooltip, neither of which care about the ItemStack chances.put(currentSlot - 1, - new Content(ItemStack.EMPTY, base, ChanceLogic.getMaxChancedValue(), tier)); + new Content(ItemStack.EMPTY, base, ChanceLogic.getMaxChancedValue())); } // make the code less :weary: diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProductWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProductWidget.java index 750baa14cc2..c57106a5e1e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProductWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProductWidget.java @@ -146,7 +146,7 @@ public void setRecipe(GTOreByProduct recipeWrapper) { IGuiTexture overlay = null; if (chance != null) { xeiChance = (float) chance.chance / chance.maxChance; - overlay = chance.createOverlay(false, 0, 0, null); + overlay = chance.createOverlay(false); } if (itemOutputs.get(slotIndex).isEmpty()) { itemOutputExists.add(false); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java index f08ffa59d66..f095ffb1e03 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java @@ -12,7 +12,6 @@ import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; @@ -294,51 +293,21 @@ private void setRecipeOverclockWidget(OverclockingLogic logic) { updateScreen(); } - public static void setConsumedChance(Content content, ChanceLogic logic, List tooltips, int recipeTier, - int chanceTier, ChanceBoostFunction function) { + public static void setConsumedChance(Content content, ChanceLogic logic, List tooltips) { if (content.chance < ChanceLogic.getMaxChancedValue()) { - int boostedChance = function.getBoostedChance(content, recipeTier, chanceTier); - if (boostedChance == 0) { + if (content.chance == 0) { tooltips.add(Component.translatable("gtceu.gui.content.chance_nc")); } else { float baseChanceFloat = 100f * content.chance / content.maxChance; - if (content.tierChanceBoost != 0) { - float boostedChanceFloat = 100f * boostedChance / content.maxChance; - - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltips.add(Component.translatable("gtceu.gui.content.chance_base_logic", - FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltips.add( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_base", - baseChanceFloat)); - } - - String key = "gtceu.gui.content.chance_tier_boost_" + - ((content.tierChanceBoost > 0) ? "plus" : "minus"); - tooltips.add(FormattingUtil.formatPercentage2Places(key, - Math.abs(100f * content.tierChanceBoost / content.maxChance))); - - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltips.add(Component.translatable("gtceu.gui.content.chance_boosted_logic", - FormattingUtil.formatNumber2Places(boostedChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltips.add( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_boosted", - boostedChanceFloat)); - } + + if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { + tooltips.add(Component.translatable("gtceu.gui.content.chance_no_boost_logic", + FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) + .withStyle(ChatFormatting.YELLOW)); } else { - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltips.add(Component.translatable("gtceu.gui.content.chance_no_boost_logic", - FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltips.add( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", - baseChanceFloat)); - } + tooltips.add( + FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", + baseChanceFloat)); } } } @@ -443,8 +412,7 @@ public void addSlots(Table, List> contentTable, cap.applyWidgetInfo(widget, index, true, io, null, recipe.getType(), recipe, content, null, minTier, tier); - widget.setOverlay(content.createOverlay(index >= nonTickCount, minTier, tier, - recipe.getType().getChanceFunction())); + widget.setOverlay(content.createOverlay(index >= nonTickCount)); } }); } From 62aab2bfd724cc4960c06d48c54d0b5f9b796233 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 17 Jun 2026 14:33:45 -0500 Subject: [PATCH 02/28] missed one --- .../data/recipe/builder/GTRecipeBuilder.java | 73 +++++++------------ 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 937c1f731ef..148fc3f45a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -102,8 +102,6 @@ public class GTRecipeBuilder { public int chance = ChanceLogic.getMaxChancedValue(); @Setter public int maxChance = ChanceLogic.getMaxChancedValue(); - @Setter - public int tierChanceBoost = 0; private boolean itemMaterialInfo = false; private boolean fluidMaterialInfo = false; private boolean removePreviousMatInfo = false; @@ -717,87 +715,75 @@ public GTRecipeBuilder circuitMeta(int configuration) { return notConsumable(IntCircuitIngredient.of(configuration)); } - public GTRecipeBuilder chancedInput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(Ingredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(FluidIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(FluidIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(Ingredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(FluidIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(FluidIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedInput(SizedIngredient.create(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedInput(ItemStack stack, int chance) { + return chancedInput(SizedIngredient.create(stack), chance); } - public GTRecipeBuilder chancedInput(FluidStack stack, int chance, int tierChanceBoost) { - return chancedInput(FluidIngredient.of(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedInput(FluidStack stack, int chance) { + return chancedInput(FluidIngredient.of(stack), chance); } - public GTRecipeBuilder chancedOutput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedOutput(SizedIngredient.create(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(ItemStack stack, int chance) { + return chancedOutput(SizedIngredient.create(stack), chance); } - public GTRecipeBuilder chancedOutput(FluidStack stack, int chance, int tierChanceBoost) { - return chancedOutput(FluidIngredient.of(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(FluidStack stack, int chance) { + return chancedOutput(FluidIngredient.of(stack), chance); } - public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int chance, int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(tag, mat), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int chance) { + return chancedOutput(ChemicalHelper.get(tag, mat), chance); } - public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int chance, int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(tag, mat, count), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int chance) { + return chancedOutput(ChemicalHelper.get(tag, mat, count), chance); } - public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction) { if (stack.isEmpty()) { return this; } @@ -837,36 +823,32 @@ public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction, int tierC int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, int count, String fraction, - int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(prefix, material, count), fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, int count, String fraction) { + return chancedOutput(ChemicalHelper.get(prefix, material, count), fraction); } - public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, String fraction, int tierChanceBoost) { - return chancedOutput(prefix, material, 1, fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, String fraction) { + return chancedOutput(prefix, material, 1, fraction); } - public GTRecipeBuilder chancedOutput(Item item, int count, String fraction, int tierChanceBoost) { - return chancedOutput(new ItemStack(item, count), fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(Item item, int count, String fraction) { + return chancedOutput(new ItemStack(item, count), fraction); } - public GTRecipeBuilder chancedOutput(Item item, String fraction, int tierChanceBoost) { - return chancedOutput(item, 1, fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(Item item, String fraction) { + return chancedOutput(item, 1, fraction); } - public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction, int tierChanceBoost) { + public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction) { if (stack.isEmpty()) { return this; } @@ -906,14 +888,11 @@ public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction, int int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } From ca59b8d7395143d898d24f6f88b7d4a8843d010b Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 17 Jun 2026 14:52:58 -0500 Subject: [PATCH 03/28] *now* it errors out --- .../generated/MaterialRecipeHandler.java | 2 +- .../recipe/generated/OreRecipeHandler.java | 56 +++++++++---------- .../data/recipe/misc/CircuitRecipes.java | 8 +-- .../data/recipe/misc/MachineRecipeLoader.java | 26 ++++----- .../data/recipe/misc/MiscRecipeLoader.java | 2 +- .../recipe/misc/VanillaStandardRecipes.java | 10 ++-- .../chemistry/GrowthMediumRecipes.java | 4 +- .../chemistry/PetrochemRecipes.java | 16 +++--- .../serialized/chemistry/ReactorRecipes.java | 16 +++--- .../chemistry/SeparationRecipes.java | 40 ++++++------- 10 files changed, 89 insertions(+), 91 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index ac7cfe04764..33f2a9c06b6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -74,7 +74,7 @@ private static void processDust(@NotNull Consumer provider, @Not AUTOCLAVE_RECIPES.recipeBuilder("autoclave_" + id + "_water") .inputItems(dustStack) .inputFluids(Water.getFluid(250)) - .chancedOutput(gemStack, 7500, 0) + .chancedOutput(gemStack, 7500) .duration(1200).EUt(24) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java index 7c1b53aa70e..cfdf12acd3c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java @@ -122,7 +122,7 @@ private static void processOre(@NotNull Consumer provider, @NotN .recipeBuilder("macerate_" + prefixString + material.getName() + "_ore_to_crushed_ore") .inputItems(inputStack) .outputItems(crushedStack.copyWithCount(crushedCount * 2)) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .EUt(2) .duration(400) .category(GTRecipeCategories.ORE_CRUSHING); @@ -130,7 +130,7 @@ private static void processOre(@NotNull Consumer provider, @NotN for (MaterialStack secondaryMaterial : orePrefix.secondaryMaterials()) { if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) { ItemStack dustStack = ChemicalHelper.getGem(secondaryMaterial); - builder.chancedOutput(dustStack, 6700, 0); + builder.chancedOutput(dustStack, 6700); } } @@ -195,7 +195,7 @@ private static void processRawOre(@NotNull Consumer provider, @N .recipeBuilder("macerate_raw_" + material.getName() + "_ore_to_crushed_ore") .inputItems(rawOre, material) .outputItems(crushedStack.copyWithCount(property.getOreMultiplier() * 2)) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .duration(400); @@ -258,8 +258,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .outputItems(impureDustStack) .duration(400).EUt(2) - .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400, - 0) + .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -282,7 +281,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputFluids(Water.getFluid(1000)) .circuitMeta(1) .outputItems(crushedPurifiedOre) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); @@ -290,7 +289,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .inputFluids(DistilledWater.getFluid(100)) .outputItems(crushedPurifiedOre) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .duration(200) .save(provider); @@ -299,7 +298,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .outputItems(crushedCentrifugedOre) .chancedOutput(TagPrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), - "1/3", 0) + "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); @@ -310,9 +309,8 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .inputFluids(washedInTuple.first().getFluid(washedInTuple.secondInt())) .outputItems(crushedPurifiedOre) - .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000, - 0) - .chancedOutput(ChemicalHelper.get(dust, Stone), 4000, 0) + .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000) + .chancedOutput(ChemicalHelper.get(dust, Stone), 4000) .duration(200).EUt(VA[LV]) .category(GTRecipeCategories.ORE_BATHING) .save(provider); @@ -343,7 +341,7 @@ private static void processCrushedCentrifuged(@NotNull Consumer MACERATOR_RECIPES.recipeBuilder("macerate_" + material.getName() + "_refined_ore_to_dust") .inputItems(crushedRefined, material) .outputItems(dustStack) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .duration(400).EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -378,7 +376,7 @@ private static void processCrushedPurified(@NotNull Consumer pro MACERATOR_RECIPES.recipeBuilder("macerate_" + material.getName() + "_crushed_ore_to_dust") .inputItems(crushedPurified, material) .outputItems(dustStack) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .duration(400).EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -392,7 +390,7 @@ private static void processCrushedPurified(@NotNull Consumer pro .recipeBuilder("centrifuge_" + material.getName() + "_purified_ore_to_refined_ore") .inputItems(crushedPurified, material) .outputItems(crushedCentrifugedStack) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .save(provider); } @@ -407,32 +405,32 @@ private static void processCrushedPurified(@NotNull Consumer pro GTRecipeBuilder builder = SIFTER_RECIPES .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(crushedPurified, material) - .chancedOutput(exquisiteStack, 500, 0) - .chancedOutput(flawlessStack, 1500, 0) - .chancedOutput(gemStack, 5000, 0) - .chancedOutput(dustStack, 2500, 0) + .chancedOutput(exquisiteStack, 500) + .chancedOutput(flawlessStack, 1500) + .chancedOutput(gemStack, 5000) + .chancedOutput(dustStack, 2500) .duration(400).EUt(16); if (!flawedStack.isEmpty()) - builder.chancedOutput(flawedStack, 2000, 0); + builder.chancedOutput(flawedStack, 2000); if (!chippedStack.isEmpty()) - builder.chancedOutput(chippedStack, 3000, 0); + builder.chancedOutput(chippedStack, 3000); builder.save(provider); } else { GTRecipeBuilder builder = SIFTER_RECIPES .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(crushedPurified, material) - .chancedOutput(exquisiteStack, 300, 0) - .chancedOutput(flawlessStack, 1000, 0) - .chancedOutput(gemStack, 3500, 0) - .chancedOutput(dustStack, 5000, 0) + .chancedOutput(exquisiteStack, 300) + .chancedOutput(flawlessStack, 1000) + .chancedOutput(gemStack, 3500) + .chancedOutput(dustStack, 5000) .duration(400).EUt(16); if (!flawedStack.isEmpty()) - builder.chancedOutput(flawedStack, 2500, 0); + builder.chancedOutput(flawedStack, 2500); if (!chippedStack.isEmpty()) - builder.chancedOutput(chippedStack, 3500, 0); + builder.chancedOutput(chippedStack, 3500); builder.save(provider); } @@ -456,7 +454,7 @@ private static void processDirtyDust(@NotNull Consumer provider, .duration((int) (material.getMass() * 4)).EUt(24); if (byproduct.hasProperty(PropertyKey.DUST)) { - builder.chancedOutput(TagPrefix.dust, byproduct, "1/9", 0); + builder.chancedOutput(TagPrefix.dust, byproduct, "1/9"); } else { builder.outputFluids(byproduct.getFluid(L / 9)); } @@ -495,7 +493,7 @@ private static void processPureDust(@NotNull Consumer provider, .inputItems(dustPure, material) .outputItems(dustStack) .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000, 0) - .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000, 0) + .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000) .duration(200).EUt(24) .save(provider); } @@ -503,7 +501,7 @@ private static void processPureDust(@NotNull Consumer provider, CENTRIFUGE_RECIPES.recipeBuilder("centrifuge_" + material.getName() + "_pure_dust_to_dust") .inputItems(dustPure, material) .outputItems(dustStack) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/9", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/9") .duration(100) .EUt(5) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java index 36f3b7e7a2e..941d3d89c30 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java @@ -692,14 +692,14 @@ private static void componentRecipes(Consumer provider) { AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_emerald") .inputItems(gemExquisite, Emerald) .inputFluids(Europium.getFluid(L / 9)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(320).save(provider); AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_olivine") .inputItems(gemExquisite, Olivine) .inputFluids(Europium.getFluid(L / 9)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(320).save(provider); @@ -718,14 +718,14 @@ private static void componentRecipes(Consumer provider) { AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_from_part_mutagen") .inputItems(RAW_CRYSTAL_CHIP_PART) .inputFluids(Mutagen.getFluid(250)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(VA[HV]).save(provider); AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_from_part_bacterial_sludge") .inputItems(RAW_CRYSTAL_CHIP_PART) .inputFluids(BacterialSludge.getFluid(250)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(VA[HV]).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 5371cbd9b1b..6cf6498e6e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -203,10 +203,10 @@ private static void registerPrimitiveBlastFurnaceRecipes(Consumer provider) private static void registerBlastFurnaceRecipes(Consumer provider) { BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_dust").duration(400).EUt(100).inputItems(dust, Ruby) - .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0).blastFurnaceTemp(1200) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9").blastFurnaceTemp(1200) .save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_gem").duration(320).EUt(100).inputItems(gem, Ruby) - .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0).blastFurnaceTemp(1200) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9").blastFurnaceTemp(1200) .save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_dust").duration(400).EUt(100) - .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0) + .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_gem").duration(320).EUt(100) - .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0) + .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_dust").duration(400).EUt(100).inputItems(dust, Sapphire) .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_gem").duration(320).EUt(100).inputItems(gem, Sapphire) .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("steel_from_iron").duration(500).EUt(VA[MV]).inputItems(ingot, Iron) - .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("steel_from_wrought_iron").duration(300).EUt(VA[MV]).inputItems(ingot, WroughtIron) - .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("tempered_glass_blasting") @@ -1159,7 +1159,7 @@ private static void registerBlastFurnaceMetallurgyRecipes(Consumer provider, .inputItems(dust, inputMaterial) .inputFluids(Oxygen.getFluid(3000)) .outputItems(dust, outputMaterial) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(SulfurDioxide.getFluid(sulfurDioxideAmount)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 8ea508e563c..072d3055d0e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -74,7 +74,7 @@ public static void init(Consumer provider) { .chancedOutput(gem, Flint, 9000, 0) .chancedOutput(gem, Flint, 8000, 0) .chancedOutput(gem, Flint, 6000, 0) - .chancedOutput(gem, Flint, "1/3", 0) + .chancedOutput(gem, Flint, "1/3") .chancedOutput(gem, Flint, 2500, 0) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index d9b8c06d767..2ef3195aea8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -280,7 +280,7 @@ private static void smashingRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("gravel_to_flint") .inputItems(new ItemStack(Blocks.GRAVEL, 1)) .outputItems(dust, Stone) - .chancedOutput(new ItemStack(Items.FLINT), 3300, 0) + .chancedOutput(new ItemStack(Items.FLINT), 3300) .duration(400).EUt(2) .save(provider); @@ -347,7 +347,7 @@ private static void smashingRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("macerate_melon_block") .inputItems(new ItemStack(Blocks.MELON)) .outputItems(new ItemStack(Items.MELON_SLICE, 8)) - .chancedOutput(new ItemStack(Items.MELON_SEEDS), 8500, 0) + .chancedOutput(new ItemStack(Items.MELON_SEEDS), 8500) .duration(400).EUt(2) .save(provider); @@ -366,9 +366,9 @@ private static void smashingRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("macerate_wool") .inputItems(ItemTags.WOOL) .outputItems(new ItemStack(Items.STRING)) - .chancedOutput(new ItemStack(Items.STRING), 9000, 0) - .chancedOutput(new ItemStack(Items.STRING), 5000, 0) - .chancedOutput(new ItemStack(Items.STRING), 2000, 0) + .chancedOutput(new ItemStack(Items.STRING), 9000) + .chancedOutput(new ItemStack(Items.STRING), 5000) + .chancedOutput(new ItemStack(Items.STRING), 2000) .duration(200).EUt(2) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java index 4f79034e331..0d668420870 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java @@ -23,8 +23,8 @@ public static void init(Consumer provider) { .inputItems(PLANT_BALL, 2) .outputItems(BIO_CHAFF) .outputItems(BIO_CHAFF) - .chancedOutput(BIO_CHAFF.asStack(), 5000, 0) - .chancedOutput(BIO_CHAFF.asStack(), 2500, 0) + .chancedOutput(BIO_CHAFF.asStack(), 5000) + .chancedOutput(BIO_CHAFF.asStack(), 2500) .save(provider); MACERATOR_RECIPES.recipeBuilder("dirt_from_bio_chaff").EUt(4).duration(300) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java index 69999459217..7d14178f614 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java @@ -235,7 +235,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_heavy_fuel") .inputFluids(LightlySteamCrackedHeavyFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(LightFuel.getFluid(300)) .outputFluids(Naphtha.getFluid(50)) .outputFluids(Toluene.getFluid(25)) @@ -251,7 +251,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_heavy_fuel") .inputFluids(SeverelySteamCrackedHeavyFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(LightFuel.getFluid(100)) .outputFluids(Naphtha.getFluid(125)) .outputFluids(Toluene.getFluid(80)) @@ -287,7 +287,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_light_fuel") .inputFluids(LightlySteamCrackedLightFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(HeavyFuel.getFluid(150)) .outputFluids(Naphtha.getFluid(400)) .outputFluids(Toluene.getFluid(40)) @@ -303,7 +303,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_light_fuel") .inputFluids(SeverelySteamCrackedLightFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(HeavyFuel.getFluid(50)) .outputFluids(Naphtha.getFluid(100)) .outputFluids(Toluene.getFluid(30)) @@ -335,7 +335,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_naphtha") .inputFluids(LightlySteamCrackedNaphtha.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(HeavyFuel.getFluid(75)) .outputFluids(LightFuel.getFluid(150)) .outputFluids(Toluene.getFluid(40)) @@ -351,7 +351,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_naphtha") .inputFluids(SeverelySteamCrackedNaphtha.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(HeavyFuel.getFluid(25)) .outputFluids(LightFuel.getFluid(50)) .outputFluids(Toluene.getFluid(20)) @@ -381,7 +381,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_gas") .inputFluids(LightlySteamCrackedGas.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(Propene.getFluid(45)) .outputFluids(Ethane.getFluid(8)) .outputFluids(Ethylene.getFluid(85)) @@ -391,7 +391,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_gas") .inputFluids(SeverelySteamCrackedGas.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(Propene.getFluid(8)) .outputFluids(Ethane.getFluid(45)) .outputFluids(Ethylene.getFluid(92)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java index 66bb796dd48..28f3ae5ccc9 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java @@ -377,7 +377,7 @@ public static void init(Consumer provider) { .circuitMeta(1) .inputItems(gem, Charcoal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -385,7 +385,7 @@ public static void init(Consumer provider) { .circuitMeta(1) .inputItems(gem, Coal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -393,7 +393,7 @@ public static void init(Consumer provider) { .circuitMeta(1) .inputItems(dust, Charcoal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -402,7 +402,7 @@ public static void init(Consumer provider) { .inputItems(dust, Coal) .circuitMeta(1) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .save(provider); @@ -447,7 +447,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(gem, Charcoal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -455,7 +455,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(gem, Coal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -463,7 +463,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(dust, Charcoal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -471,7 +471,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(dust, Coal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java index 533fa43cce2..71c3ee221d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java @@ -49,13 +49,13 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("oilsands_ore_separation") .inputItems(ore, Oilsands) - .chancedOutput(new ItemStack(Blocks.SAND), 7500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 7500) .outputFluids(OilHeavy.getFluid(2000)) .duration(200).EUt(30).save(provider); CENTRIFUGE_RECIPES.recipeBuilder("oilsands_dust_separation") .inputItems(dust, Oilsands) - .chancedOutput(new ItemStack(Blocks.SAND), 7500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 7500) .outputFluids(OilHeavy.getFluid(2000)) .duration(200).EUt(30).save(provider); @@ -105,14 +105,14 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("sticky_resin_separation").duration(400).EUt(5) .inputItems(STICKY_RESIN) .outputItems(dust, RawRubber, 3) - .chancedOutput(PLANT_BALL.asStack(), 1500, 0) + .chancedOutput(PLANT_BALL.asStack(), 1500) .outputFluids(Glue.getFluid(100)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("rubber_log_separation").duration(200).EUt(5) .inputItems(GTBlocks.RUBBER_LOG.asStack()) - .chancedOutput(STICKY_RESIN.asStack(), 6400, 0) - .chancedOutput(PLANT_BALL.asStack(), 4000, 0) + .chancedOutput(STICKY_RESIN.asStack(), 6400) + .chancedOutput(PLANT_BALL.asStack(), 4000) .chancedOutput(dust, Carbon, 3000, 0) .chancedOutput(dust, Wood, 3000, 0) .outputFluids(Methane.getFluid(60)) @@ -121,23 +121,23 @@ public static void init(Consumer provider) { // TODO Other kinds of dirt? CENTRIFUGE_RECIPES.recipeBuilder("dirt_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.DIRT.asItem()) - .chancedOutput(PLANT_BALL.asStack(), 1400, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 6000, 0) + .chancedOutput(PLANT_BALL.asStack(), 1400) + .chancedOutput(new ItemStack(Blocks.SAND), 6000) .chancedOutput(dust, Clay, 550, 0) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("grass_block_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.GRASS_BLOCK.asItem()) - .chancedOutput(PLANT_BALL.asStack(), 3500, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 5500, 0) + .chancedOutput(PLANT_BALL.asStack(), 3500) + .chancedOutput(new ItemStack(Blocks.SAND), 5500) .chancedOutput(dust, Clay, 550, 0) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("mycelium_separation").duration(650).EUt(VA[LV]) .inputItems(new ItemStack(Blocks.MYCELIUM)) - .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800, 0) - .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 6200, 0) + .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800) + .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800) + .chancedOutput(new ItemStack(Blocks.SAND), 6200) .chancedOutput(dust, Clay, 550, 0) .save(provider); @@ -182,7 +182,7 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("endstone_separation").duration(320).EUt(20) .inputItems(dust, Endstone) - .chancedOutput(new ItemStack(Blocks.SAND), 9000, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 9000) .chancedOutput(dust, Tungstate, 445, 0) .chancedOutput(dust, Platinum, 80, 0) .outputFluids(Helium.getFluid(120)) @@ -198,7 +198,7 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("soul_sand_separation").duration(200).EUt(80) .inputItems(Blocks.SOUL_SAND.asItem()) - .chancedOutput(new ItemStack(Blocks.SAND), 9250, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 9250) .chancedOutput(dust, Saltpeter, 2250, 0) .chancedOutput(dust, Coal, 225, 0) .outputFluids(Oil.getFluid(80)) @@ -228,7 +228,7 @@ public static void init(Consumer provider) { .inputItems(Blocks.RED_SAND.asItem()) .chancedOutput(dust, Iron, 5000, 0) .chancedOutput(dust, Diamond, 35, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 8500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 8500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("hydrogen_separation").duration(160).EUt(20) @@ -269,8 +269,8 @@ public static void init(Consumer provider) { .inputItems(dust, Stone) .chancedOutput(dust, Quartzite, 2500, 0) .chancedOutput(dust, PotassiumFeldspar, 2500, 0) - .chancedOutput(dust, Marble, "2/9", 0) - .chancedOutput(dust, Biotite, "1/9", 0) + .chancedOutput(dust, Marble, "2/9") + .chancedOutput(dust, Biotite, "1/9") .chancedOutput(dust, MetalMixture, 925, 0) .chancedOutput(dust, Sodalite, 650, 0) .save(provider); @@ -279,8 +279,8 @@ public static void init(Consumer provider) { .inputItems(dust, MetalMixture) .chancedOutput(dust, Hematite, 2500, 0) .chancedOutput(dust, Bauxite, 2500, 0) - .chancedOutput(dust, Pyrolusite, "2/9", 0) - .chancedOutput(dust, Barite, "1/9", 0) + .chancedOutput(dust, Pyrolusite, "2/9") + .chancedOutput(dust, Barite, "1/9") .chancedOutput(dust, Chromite, 855, 0) .chancedOutput(dust, Ilmenite, 575, 0) .save(provider); @@ -544,7 +544,7 @@ public static void init(Consumer provider) { EXTRACTOR_RECIPES.recipeBuilder("wood_dust_extraction").duration(16).EUt(4) .inputItems(dust, Wood) - .chancedOutput(PLANT_BALL.asStack(), 225, 0) + .chancedOutput(PLANT_BALL.asStack(), 225) .outputFluids(Creosote.getFluid(5)) .save(provider); From a0c769e155ecd6e2032eb6fb4e913efffcabf843 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 17 Jun 2026 21:16:44 -0500 Subject: [PATCH 04/28] OUT OF DOLLS, ELF? --- .../generated/MaterialRecipeHandler.java | 8 +- .../recipe/generated/OreRecipeHandler.java | 2 +- .../data/recipe/misc/MachineRecipeLoader.java | 34 +++---- .../data/recipe/misc/MiscRecipeLoader.java | 8 +- .../recipe/misc/VanillaStandardRecipes.java | 2 +- .../data/recipe/misc/WoodMachineRecipes.java | 6 +- .../chemistry/DistillationRecipes.java | 14 +-- .../chemistry/GemSlurryRecipes.java | 20 ++-- .../serialized/chemistry/NaquadahRecipes.java | 4 +- .../chemistry/PetrochemRecipes.java | 12 +-- .../chemistry/SeparationRecipes.java | 94 +++++++++---------- .../serialized/chemistry/TitaniumRecipes.java | 20 ++-- 12 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index 33f2a9c06b6..83b07075abf 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -90,28 +90,28 @@ private static void processDust(@NotNull Consumer provider, @Not IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_powderbarrel") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(new ItemStack(GTBlocks.POWDERBARREL, 8)) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_tnt") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesAmount(4) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_dynamite") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(GTItems.DYNAMITE.asStack(2)) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_itnt") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java index cfdf12acd3c..f7be9ab2482 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java @@ -492,7 +492,7 @@ private static void processPureDust(@NotNull Consumer provider, ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("separate_" + material.getName() + "_pure_dust_to_dust") .inputItems(dustPure, material) .outputItems(dustStack) - .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000, 0) + .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000) .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000) .duration(200).EUt(24) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 6cf6498e6e2..8e1d6c83ca1 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -326,7 +326,7 @@ private static void registerMixingCrystallizationRecipes(Consumer provider) MACERATOR_RECIPES.recipeBuilder("macerate_end_stone") .inputItems(new ItemStack(Blocks.END_STONE)) .outputItems(dust, Endstone) - .chancedOutput(dust, Tungstate, 330, 0) + .chancedOutput(dust, Tungstate, 330) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_netherrack") .inputItems(new ItemStack(Blocks.NETHERRACK)) .outputItems(dust, Netherrack) - .chancedOutput(nugget, Gold, 750, 0) + .chancedOutput(nugget, Gold, 750) .duration(150).EUt(2) .save(provider); @@ -1267,7 +1267,7 @@ private static void registerRecyclingRecipes(Consumer provider) // MACERATOR_RECIPES.recipeBuilder() // .inputItems(stone, Soapstone) // .outputItems(dustImpure, Talc) - // .chancedOutput(dust, Chromite, "1/90", 0) + // .chancedOutput(dust, Chromite, "1/90") // .duration(150).EUt(2) // .save(provider); @@ -1275,63 +1275,63 @@ private static void registerRecyclingRecipes(Consumer provider) // MACERATOR_RECIPES.recipeBuilder() // .inputItems(stone, Redrock) // .outputItems(dust, Redrock) - // .chancedOutput(dust, Redrock, 1000, 0) + // .chancedOutput(dust, Redrock, 1000) // .duration(150).EUt(2) // .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_marble") .inputItems(rock, Marble) .outputItems(dust, Marble) - .chancedOutput(dust, Marble, 1500, 0) + .chancedOutput(dust, Marble, 1500) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_basalt") .inputItems(Blocks.BASALT.asItem()) .outputItems(dust, Basalt) - .chancedOutput(dust, Basalt, 1500, 0) + .chancedOutput(dust, Basalt, 1500) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_deepslate") .inputItems(Blocks.DEEPSLATE.asItem()) .outputItems(dust, Deepslate) - .chancedOutput(dust, Thorium, 150, 0) + .chancedOutput(dust, Thorium, 150) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_red_granite") .inputItems(rock, GraniteRed) .outputItems(dust, GraniteRed) - .chancedOutput(dust, Uranium238, 25, 0) + .chancedOutput(dust, Uranium238, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_andesite") .inputItems(Blocks.ANDESITE.asItem()) .outputItems(dust, Andesite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_diorite") .inputItems(Blocks.DIORITE.asItem()) .outputItems(dust, Diorite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_granite") .inputItems(Blocks.GRANITE.asItem()) .outputItems(dust, Granite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_calcite") .inputItems(Blocks.CALCITE.asItem()) .outputItems(dust, Calcite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); @@ -1351,14 +1351,14 @@ private static void registerRecyclingRecipes(Consumer provider) MACERATOR_RECIPES.recipeBuilder("macerate_pork_chop") .inputItems(new ItemStack(Items.PORKCHOP)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 6500, 0) + .chancedOutput(dust, Meat, 6500) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_fish") .inputItems(ItemTags.FISHES) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); @@ -1371,14 +1371,14 @@ private static void registerRecyclingRecipes(Consumer provider) MACERATOR_RECIPES.recipeBuilder("macerate_steak") .inputItems(new ItemStack(Items.BEEF)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_rabbit") .inputItems(new ItemStack(Items.RABBIT)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 072d3055d0e..9a33cc92079 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -71,11 +71,11 @@ public static void init(Consumer provider) { SIFTER_RECIPES.recipeBuilder("gravel_sifting").duration(100).EUt(16) .inputItems(new ItemStack(Blocks.GRAVEL)) .outputItems(gem, Flint) - .chancedOutput(gem, Flint, 9000, 0) - .chancedOutput(gem, Flint, 8000, 0) - .chancedOutput(gem, Flint, 6000, 0) + .chancedOutput(gem, Flint, 9000) + .chancedOutput(gem, Flint, 8000) + .chancedOutput(gem, Flint, 6000) .chancedOutput(gem, Flint, "1/3") - .chancedOutput(gem, Flint, 2500, 0) + .chancedOutput(gem, Flint, 2500) .save(provider); PACKER_RECIPES.recipeBuilder("matchbox") diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index 2ef3195aea8..8240fa9d09a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -380,7 +380,7 @@ private static void woodRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("macerate_logs") .inputItems(ItemTags.LOGS) .outputItems(dust, Wood, 6) - .chancedOutput(dust, Wood, 8500, 0) + .chancedOutput(dust, Wood, 8500) .duration(150).EUt(2) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java index ff506e8778a..e2809b304a8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java @@ -1215,21 +1215,21 @@ private static void registerPyrolyseOvenRecipes(Consumer provide // COAL TAR ============================================ PYROLYSE_RECIPES.recipeBuilder("charcoal_to_coal_tar").circuitMeta(8) .inputItems(Items.CHARCOAL, 32) - .chancedOutput(dust, Ash, 5000, 0) + .chancedOutput(dust, Ash, 5000) .outputFluids(CoalTar.getFluid(1000)) .duration(640).EUt(64) .save(provider); PYROLYSE_RECIPES.recipeBuilder("coal_to_coal_tar").circuitMeta(8) .inputItems(Items.COAL, 12) - .chancedOutput(dust, DarkAsh, 5000, 0) + .chancedOutput(dust, DarkAsh, 5000) .outputFluids(CoalTar.getFluid(3000)) .duration(320).EUt(96) .save(provider); PYROLYSE_RECIPES.recipeBuilder("coke_to_coal_tar").circuitMeta(8) .inputItems(gem, Coke, 8) - .chancedOutput(dust, Ash, 7500, 0) + .chancedOutput(dust, Ash, 7500) .outputFluids(CoalTar.getFluid(4000)) .duration(320).EUt(96) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java index 8e8d7a00945..6ffbe21117e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java @@ -33,7 +33,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_charcoal_byproducts") .inputFluids(CharcoalByproducts.getFluid(1000)) - .chancedOutput(dust, Charcoal, 2500, 0) + .chancedOutput(dust, Charcoal, 2500) .outputFluids(WoodTar.getFluid(250)) .outputFluids(WoodVinegar.getFluid(400)) .outputFluids(WoodGas.getFluid(250)) @@ -117,14 +117,14 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_biomass") .inputFluids(Biomass.getFluid(1000)) - .chancedOutput(dust, Wood, 5000, 0) + .chancedOutput(dust, Wood, 5000) .outputFluids(Ethanol.getFluid(600)) .outputFluids(Water.getFluid(300)) .duration(32).EUt(400).save(provider); DISTILLATION_RECIPES.recipeBuilder("distill_coal_gas") .inputFluids(CoalGas.getFluid(1000)) - .chancedOutput(dust, Coke, 2500, 0) + .chancedOutput(dust, Coke, 2500) .outputFluids(CoalTar.getFluid(200)) .outputFluids(Ammonia.getFluid(300)) .outputFluids(Ethylbenzene.getFluid(250)) @@ -134,7 +134,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_coal_tar") .inputFluids(CoalTar.getFluid(1000)) - .chancedOutput(dust, Coke, 2500, 0) + .chancedOutput(dust, Coke, 2500) .outputFluids(Naphthalene.getFluid(400)) .outputFluids(HydrogenSulfide.getFluid(300)) .outputFluids(Creosote.getFluid(200)) @@ -149,7 +149,7 @@ public static void init(Consumer provider) { .outputFluids(CarbonDioxide.getFluid(2500)) .outputFluids(Helium.getFluid(1000)) .outputFluids(Argon.getFluid(500)) - .chancedOutput(dust, Ice, 9000, 0) + .chancedOutput(dust, Ice, 9000) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[HV]).save(provider); @@ -161,7 +161,7 @@ public static void init(Consumer provider) { .outputFluids(SulfurDioxide.getFluid(7500)) .outputFluids(Helium3.getFluid(2500)) .outputFluids(Neon.getFluid(500)) - .chancedOutput(dust, Ash, 2250, 0) + .chancedOutput(dust, Ash, 2250) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[EV]).save(provider); @@ -174,7 +174,7 @@ public static void init(Consumer provider) { .outputFluids(Krypton.getFluid(1000)) .outputFluids(Xenon.getFluid(1000)) .outputFluids(Radon.getFluid(1000)) - .chancedOutput(dust, EnderPearl, 1000, 0) + .chancedOutput(dust, EnderPearl, 1000) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[IV]).save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java index 9dd5dbfc532..5d741368770 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java @@ -30,9 +30,9 @@ public static void init(Consumer provider) { .inputFluids(RubySlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) .outputItems(dust, Chromium) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); @@ -52,9 +52,9 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(SapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); @@ -74,10 +74,10 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("green_sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(GreenSapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) - .chancedOutput(dust, Beryllium, 200, 0) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Beryllium, 200) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java index 654cfcb03e2..f6d7cd02a69 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java @@ -89,7 +89,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("enriched_naquadah_waste_separation").EUt(VA[HV]).duration(300) .inputFluids(EnrichedNaquadahWaste.getFluid(2000)) - .chancedOutput(dust, BariumSulfide, 5000, 0) + .chancedOutput(dust, BariumSulfide, 5000) .outputFluids(SulfuricAcid.getFluid(500)) .outputFluids(EnrichedNaquadahSolution.getFluid(250)) .outputFluids(NaquadriaSolution.getFluid(100)) @@ -126,7 +126,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("naquadria_waste_separation").EUt(VA[HV]).duration(300) .inputFluids(NaquadriaWaste.getFluid(2000)) - .chancedOutput(dust, GalliumSulfide, 5000, 0) + .chancedOutput(dust, GalliumSulfide, 5000) .outputFluids(SulfuricAcid.getFluid(500)) .outputFluids(NaquadriaSolution.getFluid(250)) .outputFluids(EnrichedNaquadahSolution.getFluid(100)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java index 7d14178f614..738e978c7e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java @@ -123,7 +123,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_ethane") .inputFluids(SteamCrackedEthane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Ethylene.getFluid(250)) .outputFluids(Methane.getFluid(1250)) .duration(120).EUt(VA[MV]).save(provider); @@ -148,7 +148,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_propene") .inputFluids(SteamCrackedPropene.getFluid(1000)) - .chancedOutput(dust, Carbon, 5000, 0) + .chancedOutput(dust, Carbon, 5000) .outputFluids(Ethylene.getFluid(1000)) .outputFluids(Methane.getFluid(500)) .duration(120).EUt(VA[MV]).save(provider); @@ -161,7 +161,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_propane") .inputFluids(SteamCrackedPropane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Ethylene.getFluid(750)) .outputFluids(Methane.getFluid(1250)) .duration(120).EUt(VA[MV]).save(provider); @@ -175,7 +175,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butane") .inputFluids(SteamCrackedButane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Propane.getFluid(125)) .outputFluids(Ethane.getFluid(750)) .outputFluids(Ethylene.getFluid(750)) @@ -193,7 +193,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butene") .inputFluids(SteamCrackedButene.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Propene.getFluid(250)) .outputFluids(Ethylene.getFluid(1500)) .outputFluids(Methane.getFluid(250)) @@ -207,7 +207,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butadiene") .inputFluids(SteamCrackedButadiene.getFluid(1000)) - .chancedOutput(dust, Carbon, 5000, 0) + .chancedOutput(dust, Carbon, 5000) .outputFluids(Propene.getFluid(125)) .outputFluids(Ethylene.getFluid(250)) .outputFluids(Methane.getFluid(1125)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java index 71c3ee221d7..45abc9e9e85 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java @@ -113,8 +113,8 @@ public static void init(Consumer provider) { .inputItems(GTBlocks.RUBBER_LOG.asStack()) .chancedOutput(STICKY_RESIN.asStack(), 6400) .chancedOutput(PLANT_BALL.asStack(), 4000) - .chancedOutput(dust, Carbon, 3000, 0) - .chancedOutput(dust, Wood, 3000, 0) + .chancedOutput(dust, Carbon, 3000) + .chancedOutput(dust, Wood, 3000) .outputFluids(Methane.getFluid(60)) .save(provider); @@ -123,14 +123,14 @@ public static void init(Consumer provider) { .inputItems(Blocks.DIRT.asItem()) .chancedOutput(PLANT_BALL.asStack(), 1400) .chancedOutput(new ItemStack(Blocks.SAND), 6000) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("grass_block_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.GRASS_BLOCK.asItem()) .chancedOutput(PLANT_BALL.asStack(), 3500) .chancedOutput(new ItemStack(Blocks.SAND), 5500) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("mycelium_separation").duration(650).EUt(VA[LV]) @@ -138,17 +138,17 @@ public static void init(Consumer provider) { .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800) .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800) .chancedOutput(new ItemStack(Blocks.SAND), 6200) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("ash_separation").duration(240).EUt(VA[LV]) .inputItems(dust, Ash) - .chancedOutput(dust, Quicklime, 4950, 0) - .chancedOutput(dust, Potash, 1600, 0) - .chancedOutput(dust, Magnesia, 1500, 0) - .chancedOutput(dust, PhosphorusPentoxide, 60, 0) - .chancedOutput(dust, SodaAsh, 600, 0) - .chancedOutput(dust, Hematite, 275, 0) + .chancedOutput(dust, Quicklime, 4950) + .chancedOutput(dust, Potash, 1600) + .chancedOutput(dust, Magnesia, 1500) + .chancedOutput(dust, PhosphorusPentoxide, 60) + .chancedOutput(dust, SodaAsh, 600) + .chancedOutput(dust, Hematite, 275) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("dark_ash_separation").duration(250).EUt(6) @@ -170,64 +170,64 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("uranium_238_separation").duration(800).EUt(320) .inputItems(dust, Uranium238) - .chancedOutput(dustTiny, Plutonium239, 280, 0) - .chancedOutput(dustTiny, Uranium235, 2300, 0) + .chancedOutput(dustTiny, Plutonium239, 280) + .chancedOutput(dustTiny, Uranium235, 2300) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("plutonium_239_separation").duration(1600).EUt(320) .inputItems(dust, Plutonium239) - .chancedOutput(dustTiny, Uranium238, 3400, 0) - .chancedOutput(dust, Plutonium241, 2500, 0) + .chancedOutput(dustTiny, Uranium238, 3400) + .chancedOutput(dust, Plutonium241, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("endstone_separation").duration(320).EUt(20) .inputItems(dust, Endstone) .chancedOutput(new ItemStack(Blocks.SAND), 9000) - .chancedOutput(dust, Tungstate, 445, 0) - .chancedOutput(dust, Platinum, 80, 0) + .chancedOutput(dust, Tungstate, 445) + .chancedOutput(dust, Platinum, 80) .outputFluids(Helium.getFluid(120)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("netherrack_separation").duration(160).EUt(20) .inputItems(dust, Netherrack) - .chancedOutput(dust, Redstone, 700, 0) - .chancedOutput(dust, Gold, 75, 0) - .chancedOutput(dust, Sulfur, 2500, 0) - .chancedOutput(dust, Coal, 700, 0) + .chancedOutput(dust, Redstone, 700) + .chancedOutput(dust, Gold, 75) + .chancedOutput(dust, Sulfur, 2500) + .chancedOutput(dust, Coal, 700) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("soul_sand_separation").duration(200).EUt(80) .inputItems(Blocks.SOUL_SAND.asItem()) .chancedOutput(new ItemStack(Blocks.SAND), 9250) - .chancedOutput(dust, Saltpeter, 2250, 0) - .chancedOutput(dust, Coal, 225, 0) + .chancedOutput(dust, Saltpeter, 2250) + .chancedOutput(dust, Coal, 225) .outputFluids(Oil.getFluid(80)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("lava_separation").duration(80).EUt(80) .inputFluids(Lava.getFluid(100)) - .chancedOutput(dust, SiliconDioxide, 1250, 0) - .chancedOutput(dust, Magnesia, 250, 0) - .chancedOutput(dust, Quicklime, 250, 0) - .chancedOutput(nugget, Gold, 250, 0) - .chancedOutput(dust, Sapphire, 315, 0) - .chancedOutput(dust, Tantalite, 125, 0) + .chancedOutput(dust, SiliconDioxide, 1250) + .chancedOutput(dust, Magnesia, 250) + .chancedOutput(dust, Quicklime, 250) + .chancedOutput(nugget, Gold, 250) + .chancedOutput(dust, Sapphire, 315) + .chancedOutput(dust, Tantalite, 125) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("rare_earth_separation").duration(64).EUt(20) .inputItems(dust, RareEarth) - .chancedOutput(dustSmall, Cadmium, 3500, 0) - .chancedOutput(dustSmall, Neodymium, 4500, 0) - .chancedOutput(dustSmall, Samarium, 3500, 0) - .chancedOutput(dustSmall, Cerium, 5500, 0) - .chancedOutput(dustSmall, Yttrium, 3500, 0) - .chancedOutput(dustSmall, Lanthanum, 2500, 0) + .chancedOutput(dustSmall, Cadmium, 3500) + .chancedOutput(dustSmall, Neodymium, 4500) + .chancedOutput(dustSmall, Samarium, 3500) + .chancedOutput(dustSmall, Cerium, 5500) + .chancedOutput(dustSmall, Yttrium, 3500) + .chancedOutput(dustSmall, Lanthanum, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("red_sand_separation").duration(50).EUt(VA[LV]) .inputItems(Blocks.RED_SAND.asItem()) - .chancedOutput(dust, Iron, 5000, 0) - .chancedOutput(dust, Diamond, 35, 0) + .chancedOutput(dust, Iron, 5000) + .chancedOutput(dust, Diamond, 35) .chancedOutput(new ItemStack(Blocks.SAND), 8500) .save(provider); @@ -267,28 +267,28 @@ public static void init(Consumer provider) { // Stone Dust CENTRIFUGE_RECIPES.recipeBuilder("stone_dust_separation").duration(480).EUt(VA[MV]) .inputItems(dust, Stone) - .chancedOutput(dust, Quartzite, 2500, 0) - .chancedOutput(dust, PotassiumFeldspar, 2500, 0) + .chancedOutput(dust, Quartzite, 2500) + .chancedOutput(dust, PotassiumFeldspar, 2500) .chancedOutput(dust, Marble, "2/9") .chancedOutput(dust, Biotite, "1/9") - .chancedOutput(dust, MetalMixture, 925, 0) - .chancedOutput(dust, Sodalite, 650, 0) + .chancedOutput(dust, MetalMixture, 925) + .chancedOutput(dust, Sodalite, 650) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("metal_mixture_separation").duration(1000).EUt(900) .inputItems(dust, MetalMixture) - .chancedOutput(dust, Hematite, 2500, 0) - .chancedOutput(dust, Bauxite, 2500, 0) + .chancedOutput(dust, Hematite, 2500) + .chancedOutput(dust, Bauxite, 2500) .chancedOutput(dust, Pyrolusite, "2/9") .chancedOutput(dust, Barite, "1/9") - .chancedOutput(dust, Chromite, 855, 0) - .chancedOutput(dust, Ilmenite, 575, 0) + .chancedOutput(dust, Chromite, 855) + .chancedOutput(dust, Ilmenite, 575) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("quartz_sand_separation").duration(60).EUt(VA[LV]) .inputItems(dust, QuartzSand, 2) .outputItems(dust, Quartzite) - .chancedOutput(dust, CertusQuartz, 2500, 0) + .chancedOutput(dust, CertusQuartz, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("red_alloy_separation").duration(900).EUt(VA[LV]) @@ -339,7 +339,7 @@ public static void init(Consumer provider) { .inputItems(dust, Sphalerite, 2) .outputItems(dust, Zinc) .outputItems(dust, Sulfur) - .chancedOutput(dust, Gallium, 750, 0) + .chancedOutput(dust, Gallium, 750) .duration(200).EUt(VA[LV]).save(provider); ELECTROLYZER_RECIPES.recipeBuilder("water_electrolysis") diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java index 9eda4fbbccd..91bcf4f690f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java @@ -138,8 +138,8 @@ private static void bauxiteProcess(Consumer provider) { ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("bauxite_slag_separation") .inputItems(dust, BauxiteSlag) .outputItems(dust, Salt) - .chancedOutput(dust, Neodymium, 2000, 0) - .chancedOutput(dust, Chromium, 1000, 0) + .chancedOutput(dust, Neodymium, 2000) + .chancedOutput(dust, Chromium, 1000) .duration(50).EUt(VA[MV]).save(provider); // Bauxite Sludge -> Calcite (looped) + Decalcified Bauxite Sludge @@ -154,11 +154,11 @@ private static void bauxiteProcess(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("bauxite_sludge_centrifuge") .inputFluids(DecalcifiedBauxiteSludge.getFluid(250)) .outputItems(dust, Rutile, 2) - .chancedOutput(dust, Gallium, 5000, 0) - .chancedOutput(dust, Gallium, 3000, 0) - .chancedOutput(dust, Gallium, 1000, 0) - .chancedOutput(dust, SiliconDioxide, 9000, 0) - .chancedOutput(dust, Iron, 8000, 0) + .chancedOutput(dust, Gallium, 5000) + .chancedOutput(dust, Gallium, 3000) + .chancedOutput(dust, Gallium, 1000) + .chancedOutput(dust, SiliconDioxide, 9000) + .chancedOutput(dust, Iron, 8000) .outputFluids(Water.getFluid(250)) .duration(100).EUt(VA[MV]).save(provider); } @@ -167,9 +167,9 @@ private static void ilmeniteProcess(Consumer provider) { // Byproduct separation for Ilmenite ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("ilmenite_separation") .inputItems(dust, IlmeniteSlag) - .chancedOutput(dust, Iron, 8000, 0) - .chancedOutput(dust, Tantalum, 2000, 0) - .chancedOutput(dust, Niobium, 500, 0) + .chancedOutput(dust, Iron, 8000) + .chancedOutput(dust, Tantalum, 200) + .chancedOutput(dust, Niobium, 50) .duration(50).EUt(VA[MV]).save(provider); } } From 6407448af06f97f8d4705fb6492590ab631241f9 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Tue, 16 Jun 2026 19:45:15 -0500 Subject: [PATCH 05/28] Remove tiered chance boosting --- docs/content/Modpacks/Changes/v8.0.0.md | 3 +- .../capability/recipe/EURecipeCapability.java | 2 +- .../multiblock/MultiblockDisplayText.java | 13 ++-- .../gtceu/api/recipe/GTRecipeType.java | 4 -- .../gtceu/api/recipe/RecipeRunner.java | 9 +-- .../chance/boost/ChanceBoostFunction.java | 38 ------------ .../api/recipe/chance/logic/ChanceLogic.java | 49 +++++---------- .../gtceu/api/recipe/content/Content.java | 61 +++++-------------- .../recipe/content/IContentSerializer.java | 8 +-- .../gtceu/common/data/GTRecipeTypes.java | 4 -- .../data/recipe/builder/GTRecipeBuilder.java | 2 +- .../jade/provider/RecipeOutputProvider.java | 13 ++-- .../kjs/recipe/GTRecipeSchema.java | 59 ++++++------------ .../kjs/recipe/components/ContentJS.java | 7 +-- .../recipeviewer/widgets/GTOreByProduct.java | 15 ++--- 15 files changed, 70 insertions(+), 217 deletions(-) delete mode 100644 src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java diff --git a/docs/content/Modpacks/Changes/v8.0.0.md b/docs/content/Modpacks/Changes/v8.0.0.md index f56cdf0faf8..b96292c0563 100644 --- a/docs/content/Modpacks/Changes/v8.0.0.md +++ b/docs/content/Modpacks/Changes/v8.0.0.md @@ -153,4 +153,5 @@ Previously, `handleRecipeInner` should return `null` when there's nothing left t - Calling the battery buffer constructor with the following args gives the same behaviour as a charger machine: `(info, tier, inventorySize, BatteryBufferMachine.AMPS_PER_BATTERY_CHARGER, 0)` - Refactored Jade provider code. Use the `MachineInfoProvider` class for jade providers for a specific machine type, and `MachineTraitProvider` for providers for a specific machine trait. - `GTUtil.getMoltenFluid(Material)` has been moved to `Material.getHotFluid()`. -- `ICopyable::copyConfig`'s `CompoundTag` argument should now be mutated by reference instead of a new one returned (and thus, the return type has been changed to `void`). \ No newline at end of file +- `ICopyable::copyConfig`'s `CompoundTag` argument should now be mutated by reference instead of a new one returned (and thus, the return type has been changed to `void`). +- Tiered Chance Boosting has been formally removed from the API (as it was deprecated in v7.0.) `ChancedInput` and `ChancedOutput` kubeJS calls will throw errors if they still had chance boost values as arguments. \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java index e99308b001d..523762c66ce 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java @@ -146,7 +146,7 @@ public List getCapabilityHandlers(MetaMachine machine */ public static List makeEUContent(EnergyStack eu) { return List.of( - new Content(eu, ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue(), 0)); + new Content(eu, ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue())); } /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 623c907ae0b..36be5f72dbd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -424,7 +424,6 @@ public Builder addOutputLines(GTRecipe recipe) { if (recipe != null) { int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; - var function = recipe.getType().getChanceFunction(); double maxDurationSec = (double) recipe.duration / 20.0; var itemOutputs = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidOutputs = recipe.getOutputContents(FluidRecipeCapability.CAP); @@ -446,8 +445,7 @@ public Builder addOutputLines(GTRecipe recipe) { provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (item.chance() < item.maxChance()) { - countD = countD * runs * function.getBoostedChance(item, recipeTier, chanceTier) / - item.maxChance(); + countD = countD * runs * item.chance() / item.maxChance(); } countD = countD * provider.getMidRoll(); } else { @@ -458,8 +456,7 @@ public Builder addOutputLines(GTRecipe recipe) { countD *= count; if (item.chance() < item.maxChance()) { rounded = true; - countD = countD * runs * function.getBoostedChance(item, recipeTier, chanceTier) / - item.maxChance(); + countD = countD * runs * item.chance() / item.maxChance(); } count = Math.max(1, (int) Math.round(countD)); displaycount = Component.literal(String.valueOf(count)); @@ -490,8 +487,7 @@ public Builder addOutputLines(GTRecipe recipe) { provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (fluid.chance() < fluid.maxChance()) { - amountD = amountD * runs * function.getBoostedChance(fluid, recipeTier, chanceTier) / - fluid.maxChance(); + amountD = amountD * runs * fluid.chance() / fluid.maxChance(); } amountD = amountD * provider.getMidRoll(); } else { @@ -502,8 +498,7 @@ public Builder addOutputLines(GTRecipe recipe) { amountD *= amount; if (fluid.chance() < fluid.maxChance()) { rounded = true; - amountD = amountD * runs * function.getBoostedChance(fluid, recipeTier, chanceTier) / - fluid.maxChance(); + amountD = amountD * runs * fluid.chance() / fluid.maxChance(); } amount = Math.max(1, (int) Math.round(amountD)); displaycount = Component.literal(String.valueOf(amount)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java index ece41915d49..cd815819743 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeTypeUILayout; import com.gregtechceu.gtceu.api.recipe.lookup.RecipeAdditionHandler; import com.gregtechceu.gtceu.api.recipe.lookup.RecipeDB; @@ -44,9 +43,6 @@ public class GTRecipeType implements RecipeType { RecipeCapability.COMPARATOR); @Setter private GTRecipeBuilder recipeBuilder; - @Getter - @Setter - private ChanceBoostFunction chanceFunction = ChanceBoostFunction.NONE; @Setter @Getter private GTRecipeType smallRecipeMap; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java index 0bc6050ace0..53dae26ab7b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java @@ -7,7 +7,6 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupColor; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; @@ -73,9 +72,6 @@ public ActionResult handle(Map, List> entries) { * Populates the content match list to know if conditions are satisfied. */ private void fillContentMatchList(Map, List> entries) { - ChanceBoostFunction function = recipe.getType().getChanceFunction(); - int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); - int chanceTier = recipeTier + recipe.ocLevel; for (var entry : entries.entrySet()) { RecipeCapability cap = entry.getKey(); if (!cap.doMatchInRecipe()) continue; @@ -97,7 +93,7 @@ private void fillContentMatchList(Map, List> entrie if (cont.chance() >= cont.maxChance()) { contentList.add(cont.content()); - } else if (cont.chance() > 0 || cont.tierChanceBoost() > 0) { + } else if (cont.chance() > 0) { chancedContents.add(cont); } // Do not add Non-Consumed ingredients; they'd just get dropped after the chance roll anyway @@ -106,8 +102,7 @@ private void fillContentMatchList(Map, List> entrie // add chanced contents to the recipe content map if (!chancedContents.isEmpty()) { var cache = this.chanceCaches.get(cap); - chancedContents = logic.roll(cap, chancedContents, function, recipeTier, chanceTier, cache, - recipe.getTotalRuns()); + chancedContents = logic.roll(cap, chancedContents, cache, recipe.getTotalRuns()); for (Content cont : chancedContents) { contentList.add(cont.content()); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java deleted file mode 100644 index 39825e62f13..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gregtechceu.gtceu.api.recipe.chance.boost; - -import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.recipe.content.Content; - -import net.minecraft.util.Mth; - -import org.jetbrains.annotations.NotNull; - -/** - * A function used to boost a {@link Content}'s chance - */ -@FunctionalInterface -public interface ChanceBoostFunction { - - /** - * Chance boosting function based on the number of performed overclocks - */ - ChanceBoostFunction OVERCLOCK = (entry, recipeTier, chanceTier) -> { - int tierDiff = chanceTier - recipeTier; - if (tierDiff <= 0) return entry.chance(); // equal or invalid tiers do not boost at all - if (recipeTier == GTValues.ULV) tierDiff--; // LV does not boost over ULV - return Mth.clamp(entry.chance() + (entry.tierChanceBoost() * tierDiff), 0, entry.maxChance()); - }; - - /** - * Chance boosting function which performs no boosting - */ - ChanceBoostFunction NONE = (entry, recipeTier, chanceTier) -> entry.chance(); - - /** - * @param entry the amount to boost by - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at - * @return the boosted chance - */ - int getBoostedChance(@NotNull Content entry, int recipeTier, int chanceTier); -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java index dbbb640e704..5d10f8a46ed 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.registry.GTRegistries; @@ -41,8 +40,7 @@ public abstract class ChanceLogic { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (Content entry : chancedEntries) { int maxChance = entry.maxChance(); @@ -50,7 +48,7 @@ public abstract class ChanceLogic { // OR Chanced outputs are deterministic // If a large batch is being done we can calculate how many we expect to get. // Add the guaranteed part of that to the list, then roll for the remaining chanced part. - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int totalChance = times * newChance; int guaranteed = totalChance / maxChance; if (guaranteed > 0) builder.add(entry.copyChanced(cap, ContentModifier.multiplier(guaranteed))); @@ -87,13 +85,12 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < times; ++i) { boolean failed = false; for (Content entry : chancedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, entry.maxChance())) newChance -= entry.maxChance(); @@ -127,13 +124,12 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < times; ++i) { Content selected = null; for (Content entry : chancedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, entry.maxChance())) { @@ -167,8 +163,7 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { // Have to set up a system where all chances are set to be out of 10000 IntList chancesOutOfTenThousand = new IntArrayList(); @@ -206,7 +201,7 @@ public String toString() { List normalizedEntries = new ArrayList<>(); for (int i = 0; i < chancesOutOfTenThousand.size(); i++) { normalizedEntries.add(new Content(chancedEntries.get(i).content(), chancesOutOfTenThousand.getInt(i), - getMaxChancedValue(), chancedEntries.get(i).tierChanceBoost())); + getMaxChancedValue())); } // Use the new, normalized list for the logic @@ -215,7 +210,7 @@ public String toString() { int nonGuaranteedTimes = times; if (times > 1) { for (Content entry : normalizedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int totalChance = times * newChance; int guaranteed = totalChance / 10000; if (guaranteed > 0) { @@ -229,7 +224,7 @@ public String toString() { Content selected = null; int maxChance = getMaxChancedValue(); for (Content entry : normalizedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, maxChance)) { @@ -264,8 +259,7 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { return Collections.emptyList(); } @@ -285,15 +279,11 @@ public ChanceLogic(String id) { } /** - * @param entry the entry to get the complete chance for - * @param boostFunction the function boosting the entry's chance - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at + * @param entry the entry to get the complete chance for * @return the total chance for the entry */ - static int getChance(@NotNull Content entry, @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier) { - return boostFunction.getBoostedChance(entry, recipeTier, chanceTier); + static int getChance(@NotNull Content entry) { + return entry.chance; } /** @@ -339,35 +329,26 @@ static void updateCachedChance(Object ingredient, @Nullable Object2IntMap cac * Roll the chance and attempt to produce the output * * @param chancedEntries the list of entries to roll - * @param boostFunction the function to boost the entries' chances - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at * @param cache the cache of previously rolled chances, can be null * @param times the number of times to roll * @return a list of the produced outputs, empty if roll fails */ public abstract @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, - int recipeTier, int chanceTier, @Nullable Object2IntMap cache, int times); /** * Roll the chance and attempt to produce the output * * @param chancedEntries the list of entries to roll - * @param boostFunction the function to boost the entries' chances - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at * @param times the number of times to roll * @return a list of the produced outputs */ @Unmodifiable public List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, int chanceTier, int times) { - return roll(cap, chancedEntries, boostFunction, recipeTier, chanceTier, null, times); + return roll(cap, chancedEntries, null, times); } @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java index 84d15ab11b4..3a383303110 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.content; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.utils.FormattingUtil; @@ -14,13 +13,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import org.jetbrains.annotations.NotNull; -public record Content(Object content, int chance, int maxChance, int tierChanceBoost) { +public record Content(Object content, int chance, int maxChance) { - public Content(Object content, int chance, int maxChance, int tierChanceBoost) { + public Content(Object content, int chance, int maxChance) { this.content = content; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = fixBoost(tierChanceBoost); } public static Codec codec(RecipeCapability capability) { @@ -29,9 +27,7 @@ public static Codec codec(RecipeCapability capability) { ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("chance", ChanceLogic.getMaxChancedValue()) .forGetter(val -> val.chance), ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("maxChance", ChanceLogic.getMaxChancedValue()) - .forGetter(val -> val.maxChance), - Codec.INT.optionalFieldOf("tierChanceBoost", 0) - .forGetter(val -> val.tierChanceBoost)) + .forGetter(val -> val.maxChance)) .apply(instance, Content::new)); } @@ -39,7 +35,7 @@ public static Codec codec(RecipeCapability capability) { * Directly copies a Content. */ public Content copy(RecipeCapability capability) { - return new Content(capability.copyContent(content), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content), chance, maxChance); } /** @@ -49,7 +45,7 @@ public Content copy(RecipeCapability capability, @NotNull ContentModifier mod if (modifier == ContentModifier.IDENTITY || chance < maxChance) { return copy(capability); } else { - return new Content(capability.copyContent(content, modifier), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content, modifier), chance, maxChance); } } @@ -60,7 +56,7 @@ public Content copyChanced(RecipeCapability capability, @NotNull ContentModif if (modifier == ContentModifier.IDENTITY) { return copy(capability); } else { - return new Content(capability.copyContent(content, modifier), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content, modifier), chance, maxChance); } } @@ -84,51 +80,22 @@ private int fixBoost(int chanceBoost) { return chanceBoost < 0 ? -fixed : fixed; } - public static void addChanceTooltips(RichTooltip tooltip, Content content, ChanceLogic logic, int recipeTier, - int chanceTier, ChanceBoostFunction function) { + public static void addChanceTooltips(RichTooltip tooltip, Content content, ChanceLogic logic) { if (content.chance() < ChanceLogic.getMaxChancedValue()) { int boostedChance = function.getBoostedChance(content, recipeTier, chanceTier); if (boostedChance == 0) { tooltip.addLine(Component.translatable("gtceu.gui.content.chance_nc")); } else { float baseChanceFloat = 100f * content.chance() / content.maxChance(); - if (content.tierChanceBoost() != 0) { - float boostedChanceFloat = 100f * boostedChance / content.maxChance(); - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltip.addLine(Component.translatable("gtceu.gui.content.chance_base_logic", - FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_base", - baseChanceFloat)); - } - - String key = "gtceu.gui.content.chance_tier_boost_" + - ((content.tierChanceBoost() > 0) ? "plus" : "minus"); - tooltip.addLine(FormattingUtil.formatPercentage2Places(key, - Math.abs(100f * content.tierChanceBoost() / content.maxChance()))); - - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltip.addLine(Component.translatable("gtceu.gui.content.chance_boosted_logic", - FormattingUtil.formatNumber2Places(boostedChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_boosted", - boostedChanceFloat)); - } + if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { + tooltip.addLine(Component.translatable("gtceu.gui.content.chance_no_boost_logic", + FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) + .withStyle(ChatFormatting.YELLOW)); } else { - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltip.addLine(Component.translatable("gtceu.gui.content.chance_no_boost_logic", - FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", - baseChanceFloat)); - } + tooltip.addLine( + FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", + baseChanceFloat)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java index 8a468fefcf5..10370feea23 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java @@ -40,15 +40,13 @@ default void toNetworkContent(FriendlyByteBuf buf, Content content) { toNetwork(buf, inner); buf.writeVarInt(content.chance()); buf.writeVarInt(content.maxChance()); - buf.writeVarInt(content.tierChanceBoost()); } default Content fromNetworkContent(FriendlyByteBuf buf) { T inner = fromNetwork(buf); int chance = buf.readVarInt(); int maxChance = buf.readVarInt(); - int tierChanceBoost = buf.readVarInt(); - return new Content(inner, chance, maxChance, tierChanceBoost); + return new Content(inner, chance, maxChance); } Class contentClass(); @@ -61,7 +59,6 @@ default JsonElement toJsonContent(Content content) { json.add("content", toJson((T) content.content())); json.addProperty("chance", content.chance()); json.addProperty("maxChance", content.maxChance()); - json.addProperty("tierChanceBoost", content.tierChanceBoost()); return json; } @@ -71,8 +68,7 @@ default Content fromJsonContent(JsonElement json) { int chance = jsonObject.has("chance") ? jsonObject.get("chance").getAsInt() : ChanceLogic.getMaxChancedValue(); int maxChance = jsonObject.has("maxChance") ? jsonObject.get("maxChance").getAsInt() : ChanceLogic.getMaxChancedValue(); - int tierChanceBoost = jsonObject.has("tierChanceBoost") ? jsonObject.get("tierChanceBoost").getAsInt() : 0; - return new Content(inner, chance, maxChance, tierChanceBoost); + return new Content(inner, chance, maxChance); } default Tag toNbt(T content) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index f6d21d5306a..5bd68562b82 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -596,10 +596,8 @@ public class GTRecipeTypes { if (shouldDivide && fluidsDivisible) { builder.chance(inputContent.chance()) - .tierChanceBoost(inputContent.tierChanceBoost()) .inputFluids(dividedInputFluid) .chance(outputContent.chance()) - .tierChanceBoost(outputContent.tierChanceBoost()) .outputFluids(dividedOutputFluid) .duration(Math.max(1, recipeDuration / ratio)); } else if (!shouldDivide) { @@ -608,10 +606,8 @@ public class GTRecipeTypes { } builder.conditions.addAll(recipeBuilder.conditions); builder.chance(inputContent.chance()) - .tierChanceBoost(inputContent.tierChanceBoost()) .inputFluids(input) .chance(outputContent.chance()) - .tierChanceBoost(outputContent.tierChanceBoost()) .outputFluids(output) .duration(recipeDuration) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 8f18074b2a2..41b27730628 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -182,7 +182,7 @@ public GTRecipeBuilder copyFrom(GTRecipeBuilder builder) { } protected Content makeContent(Object o) { - return new Content(o, chance, maxChance, tierChanceBoost); + return new Content(o, chance, maxChance); } public GTRecipeBuilder input(RecipeCapability capability, T obj) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java index c77c1c2a6ab..d6d8d2b2fdb 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java @@ -58,7 +58,6 @@ protected CompoundTag write(RecipeLogic recipeLogic) { if (recipe != null) { int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; - var function = recipe.getType().getChanceFunction(); var itemContents = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidContents = recipe.getOutputContents(FluidRecipeCapability.CAP); int runs = recipe.getTotalRuns(); @@ -70,8 +69,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { // don't roll for output but do copy for chance and batch IntProviderIngredient chanced = provider; if (item.chance() < item.maxChance()) { - double countD = (double) runs * - function.getBoostedChance(item, recipeTier, chanceTier) / item.maxChance(); + double countD = ((double) runs * item.chance()) / item.maxChance(); chanced = (IntProviderIngredient) ItemRecipeCapability.CAP.copyWithModifier(provider, ContentModifier.multiplier(countD)); } @@ -84,8 +82,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { GTUtil.saveItemStack(stack, itemTag); if (item.chance() < item.maxChance()) { int count = stack.getCount(); - double countD = (double) count * runs * - function.getBoostedChance(item, recipeTier, chanceTier) / item.maxChance(); + double countD = ((double) count * runs * item.chance()) / item.maxChance(); count = Math.max(1, (int) Math.round(countD)); itemTag.putInt("Count", count); } @@ -104,8 +101,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { // don't bother rolling output for nothing IntProviderFluidIngredient chanced = provider; if (fluid.chance() < fluid.maxChance()) { - double countD = (double) runs * - function.getBoostedChance(fluid, recipeTier, chanceTier) / fluid.maxChance(); + double countD = ((double) runs * fluid.chance()) / fluid.maxChance(); chanced = (IntProviderFluidIngredient) FluidRecipeCapability.CAP.copyWithModifier(provider, ContentModifier.multiplier(countD)); } @@ -120,8 +116,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { if (fluid.chance() < fluid.maxChance()) { int amount = stacks[0].getAmount(); - double amountD = (double) amount * runs * - function.getBoostedChance(fluid, recipeTier, chanceTier) / fluid.maxChance(); + double amountD = ((double) amount * runs * fluid.chance()) / fluid.maxChance(); amount = Math.max(1, (int) Math.round(amountD)); fluidTag.putInt("Amount", amount); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java index 3dc78a51447..46db6965b24 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java @@ -91,8 +91,6 @@ class GTRecipeJS extends RecipeJS { public int chance = ChanceLogic.getMaxChancedValue(); @Setter public int maxChance = ChanceLogic.getMaxChancedValue(); - @Setter - public int tierChanceBoost = 0; @Getter private ResourceLocation idWithoutType; @Setter @@ -139,7 +137,7 @@ public GTRecipeJS input(RecipeCapability capability, Object... obj) { id, (perTick ? "Tick " : ""), capability.name, recipeType.getMaxInputs(capability))); } for (Object object : obj) { - map.add(capability, new Content(object, chance, maxChance, tierChanceBoost)); + map.add(capability, new Content(object, chance, maxChance)); } } save(); @@ -164,7 +162,7 @@ public GTRecipeJS output(RecipeCapability capability, Object... obj) { id, (perTick ? "Tick " : ""), capability.name, recipeType.getMaxOutputs(capability))); } for (Object object : obj) { - map.add(capability, new Content(object, chance, maxChance, tierChanceBoost)); + map.add(capability, new Content(object, chance, maxChance)); } } save(); @@ -480,7 +478,7 @@ public GTRecipeJS circuit(int configuration) { return notConsumable(InputItem.of(IntCircuitIngredient.of(configuration), 1)); } - public GTRecipeJS chancedInput(InputItem stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedInput(InputItem stack, int chance) { validateItems("chanced input", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -489,17 +487,13 @@ public GTRecipeJS chancedInput(InputItem stack, int chance, int tierChanceBoost) ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, int chance, - int tierChanceBoost) { + public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, int chance) { validateFluids("chanced input", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -508,16 +502,13 @@ public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedOutput(ExtendedOutputItem stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedOutput(ExtendedOutputItem stack, int chance) { validateItems("chanced output", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -526,25 +517,21 @@ public GTRecipeJS chancedOutput(ExtendedOutputItem stack, int chance, int tierCh ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int chance, int tierChanceBoost) { - return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat), null), chance, tierChanceBoost); + public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int chance) { + return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat), null), chance); } - public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int count, int chance, int tierChanceBoost) { - return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat, count), null), chance, - tierChanceBoost); + public GTRecipeJS chancedOutput(TagPrefix tag, Material mat, int count, int chance) { + return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(tag, mat, count), null), chance); } - public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction, int tierChanceBoost) { + public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction) { validateItems("chanced output", stack); String[] split = fraction.split("/"); @@ -565,7 +552,7 @@ public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction, int t "Fraction or number was not parsed correctly! Expected format is \"1/3\" or \"1000\". Actual: \"%s\".", fraction)); } - return chancedOutput(stack, chance, tierChanceBoost); + return chancedOutput(stack, chance); } try { chance = Integer.parseInt(split[0]); @@ -593,29 +580,25 @@ public GTRecipeJS chancedOutput(ExtendedOutputItem stack, String fraction, int t int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, int count, String fraction, - int tierChanceBoost) { + public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, int count, String fraction) { return chancedOutput(new ExtendedOutputItem(ChemicalHelper.get(prefix, material, count), null), - fraction, tierChanceBoost); + fraction); } - public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, String fraction, int tierChanceBoost) { - return chancedOutput(prefix, material, 1, fraction, tierChanceBoost); + public GTRecipeJS chancedOutput(TagPrefix prefix, Material material, String fraction) { + return chancedOutput(prefix, material, 1, fraction); } - public GTRecipeJS chancedFluidOutput(FluidStackJS stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedFluidOutput(FluidStackJS stack, int chance) { validateFluids("chanced output", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -624,16 +607,13 @@ public GTRecipeJS chancedFluidOutput(FluidStackJS stack, int chance, int tierCha ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction, int tierChanceBoost) { + public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction) { validateFluids("chanced output", stack); if (stack.getAmount() == 0) { @@ -658,7 +638,7 @@ public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction, int ti "Fraction or number was not parsed correctly! Expected format is \"1/3\" or \"1000\". Actual: \"%s\".", fraction)); } - return chancedFluidOutput(stack, chance, tierChanceBoost); + return chancedFluidOutput(stack, chance); } try { @@ -687,14 +667,11 @@ public GTRecipeJS chancedFluidOutput(FluidStackJS stack, String fraction, int ti int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java index 753ca4c0fbf..4d3acf6b190 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java @@ -34,7 +34,6 @@ public JsonElement write(RecipeJS recipe, Content value) { object.add("content", baseComponent.write(recipe, baseComponent.read(recipe, value.content()))); object.addProperty("chance", value.chance()); object.addProperty("maxChance", value.maxChance()); - object.addProperty("tierChanceBoost", value.tierChanceBoost()); return object; } @@ -46,7 +45,7 @@ else if (from instanceof JsonObject json) { int chance = GsonHelper.getAsInt(json, "chance", ChanceLogic.getMaxChancedValue()); int maxChance = GsonHelper.getAsInt(json, "maxChance", ChanceLogic.getMaxChancedValue()); int tierChanceBoost = GsonHelper.getAsInt(json, "tierChanceBoost", 0); - return new Content(content, chance, maxChance, tierChanceBoost); + return new Content(content, chance, maxChance); } return null; } @@ -65,14 +64,14 @@ public boolean isOutput(RecipeJS recipe, Content value, ReplacementMatch match) public Content replaceInput(RecipeJS recipe, Content original, ReplacementMatch match, InputReplacement with) { return isInput(recipe, original, match) ? new Content( baseComponent.replaceInput(recipe, baseComponent.read(recipe, original.content()), match, with), - original.chance(), original.maxChance(), original.tierChanceBoost()) : + original.chance(), original.maxChance()) : original; } @Override public Content replaceOutput(RecipeJS recipe, Content original, ReplacementMatch match, OutputReplacement with) { return isOutput(recipe, original, match) ? new Content(with.replaceOutput(recipe, match, with), - original.chance(), original.maxChance(), original.tierChanceBoost()) : + original.chance(), original.maxChance()) : original; } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java index 8d9496a3de4..41e09da14c1 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java @@ -299,15 +299,8 @@ public Consumer getTooltip(int slotIndex) { if (chances.containsKey(slotIndex)) { Content entry = chances.get(slotIndex); float chance = 100 * (float) entry.chance() / entry.maxChance(); - if (entry.tierChanceBoost() != 0) { - float boost = entry.tierChanceBoost() / 100.0f; - tooltip.addLine(FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_base", chance)); - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_tier_boost_plus", boost)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", chance)); - } + tooltip.addLine( + FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", chance)); } }; } @@ -351,10 +344,10 @@ private void addToInputs(ItemStack stack) { itemInputs.add(ItemStackList.of(stack)); } - private void addChance(int base, int tier) { + private void addChance(int base) { // this is solely for the chance overlay and tooltip, neither of which care about the ItemStack chances.put(currentSlot - 1, - new Content(ItemStack.EMPTY, base, ChanceLogic.getMaxChancedValue(), tier)); + new Content(ItemStack.EMPTY, base, ChanceLogic.getMaxChancedValue())); } // make the code less :weary: From f52d2c82101bf1f235b59ed3397f8668f60acb92 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 17 Jun 2026 14:33:45 -0500 Subject: [PATCH 06/28] missed one --- .../data/recipe/builder/GTRecipeBuilder.java | 73 +++++++------------ 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 41b27730628..75e58e23f33 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -102,8 +102,6 @@ public class GTRecipeBuilder { public int chance = ChanceLogic.getMaxChancedValue(); @Setter public int maxChance = ChanceLogic.getMaxChancedValue(); - @Setter - public int tierChanceBoost = 0; private boolean itemMaterialInfo = false; private boolean fluidMaterialInfo = false; private boolean removePreviousMatInfo = false; @@ -717,87 +715,75 @@ public GTRecipeBuilder circuitMeta(int configuration) { return notConsumable(IntCircuitIngredient.of(configuration)); } - public GTRecipeBuilder chancedInput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(Ingredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(FluidIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(FluidIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(Ingredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(FluidIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(FluidIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedInput(SizedIngredient.create(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedInput(ItemStack stack, int chance) { + return chancedInput(SizedIngredient.create(stack), chance); } - public GTRecipeBuilder chancedInput(FluidStack stack, int chance, int tierChanceBoost) { - return chancedInput(FluidIngredient.of(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedInput(FluidStack stack, int chance) { + return chancedInput(FluidIngredient.of(stack), chance); } - public GTRecipeBuilder chancedOutput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedOutput(SizedIngredient.create(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(ItemStack stack, int chance) { + return chancedOutput(SizedIngredient.create(stack), chance); } - public GTRecipeBuilder chancedOutput(FluidStack stack, int chance, int tierChanceBoost) { - return chancedOutput(FluidIngredient.of(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(FluidStack stack, int chance) { + return chancedOutput(FluidIngredient.of(stack), chance); } - public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int chance, int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(tag, mat), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int chance) { + return chancedOutput(ChemicalHelper.get(tag, mat), chance); } - public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int chance, int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(tag, mat, count), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int chance) { + return chancedOutput(ChemicalHelper.get(tag, mat, count), chance); } - public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction) { if (stack.isEmpty()) { return this; } @@ -837,36 +823,32 @@ public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction, int tierC int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, int count, String fraction, - int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(prefix, material, count), fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, int count, String fraction) { + return chancedOutput(ChemicalHelper.get(prefix, material, count), fraction); } - public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, String fraction, int tierChanceBoost) { - return chancedOutput(prefix, material, 1, fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, String fraction) { + return chancedOutput(prefix, material, 1, fraction); } - public GTRecipeBuilder chancedOutput(Item item, int count, String fraction, int tierChanceBoost) { - return chancedOutput(new ItemStack(item, count), fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(Item item, int count, String fraction) { + return chancedOutput(new ItemStack(item, count), fraction); } - public GTRecipeBuilder chancedOutput(Item item, String fraction, int tierChanceBoost) { - return chancedOutput(item, 1, fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(Item item, String fraction) { + return chancedOutput(item, 1, fraction); } - public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction, int tierChanceBoost) { + public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction) { if (stack.isEmpty()) { return this; } @@ -906,14 +888,11 @@ public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction, int int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } From c7947e097457b8ebb200ba24eed2143d144d3434 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 17 Jun 2026 14:52:58 -0500 Subject: [PATCH 07/28] *now* it errors out --- .../generated/MaterialRecipeHandler.java | 2 +- .../recipe/generated/OreRecipeHandler.java | 56 +++++++++---------- .../data/recipe/misc/CircuitRecipes.java | 8 +-- .../data/recipe/misc/MachineRecipeLoader.java | 26 ++++----- .../data/recipe/misc/MiscRecipeLoader.java | 2 +- .../recipe/misc/VanillaStandardRecipes.java | 10 ++-- .../chemistry/GrowthMediumRecipes.java | 4 +- .../chemistry/PetrochemRecipes.java | 16 +++--- .../serialized/chemistry/ReactorRecipes.java | 16 +++--- .../chemistry/SeparationRecipes.java | 40 ++++++------- 10 files changed, 89 insertions(+), 91 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index ac7cfe04764..33f2a9c06b6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -74,7 +74,7 @@ private static void processDust(@NotNull Consumer provider, @Not AUTOCLAVE_RECIPES.recipeBuilder("autoclave_" + id + "_water") .inputItems(dustStack) .inputFluids(Water.getFluid(250)) - .chancedOutput(gemStack, 7500, 0) + .chancedOutput(gemStack, 7500) .duration(1200).EUt(24) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java index 7c1b53aa70e..cfdf12acd3c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java @@ -122,7 +122,7 @@ private static void processOre(@NotNull Consumer provider, @NotN .recipeBuilder("macerate_" + prefixString + material.getName() + "_ore_to_crushed_ore") .inputItems(inputStack) .outputItems(crushedStack.copyWithCount(crushedCount * 2)) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .EUt(2) .duration(400) .category(GTRecipeCategories.ORE_CRUSHING); @@ -130,7 +130,7 @@ private static void processOre(@NotNull Consumer provider, @NotN for (MaterialStack secondaryMaterial : orePrefix.secondaryMaterials()) { if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) { ItemStack dustStack = ChemicalHelper.getGem(secondaryMaterial); - builder.chancedOutput(dustStack, 6700, 0); + builder.chancedOutput(dustStack, 6700); } } @@ -195,7 +195,7 @@ private static void processRawOre(@NotNull Consumer provider, @N .recipeBuilder("macerate_raw_" + material.getName() + "_ore_to_crushed_ore") .inputItems(rawOre, material) .outputItems(crushedStack.copyWithCount(property.getOreMultiplier() * 2)) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .duration(400); @@ -258,8 +258,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .outputItems(impureDustStack) .duration(400).EUt(2) - .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400, - 0) + .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -282,7 +281,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputFluids(Water.getFluid(1000)) .circuitMeta(1) .outputItems(crushedPurifiedOre) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); @@ -290,7 +289,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .inputFluids(DistilledWater.getFluid(100)) .outputItems(crushedPurifiedOre) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .duration(200) .save(provider); @@ -299,7 +298,7 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .outputItems(crushedCentrifugedOre) .chancedOutput(TagPrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), - "1/3", 0) + "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); @@ -310,9 +309,8 @@ private static void processCrushedOre(@NotNull Consumer provider .inputItems(crushed, material) .inputFluids(washedInTuple.first().getFluid(washedInTuple.secondInt())) .outputItems(crushedPurifiedOre) - .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000, - 0) - .chancedOutput(ChemicalHelper.get(dust, Stone), 4000, 0) + .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000) + .chancedOutput(ChemicalHelper.get(dust, Stone), 4000) .duration(200).EUt(VA[LV]) .category(GTRecipeCategories.ORE_BATHING) .save(provider); @@ -343,7 +341,7 @@ private static void processCrushedCentrifuged(@NotNull Consumer MACERATOR_RECIPES.recipeBuilder("macerate_" + material.getName() + "_refined_ore_to_dust") .inputItems(crushedRefined, material) .outputItems(dustStack) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .duration(400).EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -378,7 +376,7 @@ private static void processCrushedPurified(@NotNull Consumer pro MACERATOR_RECIPES.recipeBuilder("macerate_" + material.getName() + "_crushed_ore_to_dust") .inputItems(crushedPurified, material) .outputItems(dustStack) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .duration(400).EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -392,7 +390,7 @@ private static void processCrushedPurified(@NotNull Consumer pro .recipeBuilder("centrifuge_" + material.getName() + "_purified_ore_to_refined_ore") .inputItems(crushedPurified, material) .outputItems(crushedCentrifugedStack) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .save(provider); } @@ -407,32 +405,32 @@ private static void processCrushedPurified(@NotNull Consumer pro GTRecipeBuilder builder = SIFTER_RECIPES .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(crushedPurified, material) - .chancedOutput(exquisiteStack, 500, 0) - .chancedOutput(flawlessStack, 1500, 0) - .chancedOutput(gemStack, 5000, 0) - .chancedOutput(dustStack, 2500, 0) + .chancedOutput(exquisiteStack, 500) + .chancedOutput(flawlessStack, 1500) + .chancedOutput(gemStack, 5000) + .chancedOutput(dustStack, 2500) .duration(400).EUt(16); if (!flawedStack.isEmpty()) - builder.chancedOutput(flawedStack, 2000, 0); + builder.chancedOutput(flawedStack, 2000); if (!chippedStack.isEmpty()) - builder.chancedOutput(chippedStack, 3000, 0); + builder.chancedOutput(chippedStack, 3000); builder.save(provider); } else { GTRecipeBuilder builder = SIFTER_RECIPES .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(crushedPurified, material) - .chancedOutput(exquisiteStack, 300, 0) - .chancedOutput(flawlessStack, 1000, 0) - .chancedOutput(gemStack, 3500, 0) - .chancedOutput(dustStack, 5000, 0) + .chancedOutput(exquisiteStack, 300) + .chancedOutput(flawlessStack, 1000) + .chancedOutput(gemStack, 3500) + .chancedOutput(dustStack, 5000) .duration(400).EUt(16); if (!flawedStack.isEmpty()) - builder.chancedOutput(flawedStack, 2500, 0); + builder.chancedOutput(flawedStack, 2500); if (!chippedStack.isEmpty()) - builder.chancedOutput(chippedStack, 3500, 0); + builder.chancedOutput(chippedStack, 3500); builder.save(provider); } @@ -456,7 +454,7 @@ private static void processDirtyDust(@NotNull Consumer provider, .duration((int) (material.getMass() * 4)).EUt(24); if (byproduct.hasProperty(PropertyKey.DUST)) { - builder.chancedOutput(TagPrefix.dust, byproduct, "1/9", 0); + builder.chancedOutput(TagPrefix.dust, byproduct, "1/9"); } else { builder.outputFluids(byproduct.getFluid(L / 9)); } @@ -495,7 +493,7 @@ private static void processPureDust(@NotNull Consumer provider, .inputItems(dustPure, material) .outputItems(dustStack) .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000, 0) - .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000, 0) + .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000) .duration(200).EUt(24) .save(provider); } @@ -503,7 +501,7 @@ private static void processPureDust(@NotNull Consumer provider, CENTRIFUGE_RECIPES.recipeBuilder("centrifuge_" + material.getName() + "_pure_dust_to_dust") .inputItems(dustPure, material) .outputItems(dustStack) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/9", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/9") .duration(100) .EUt(5) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java index 36f3b7e7a2e..941d3d89c30 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java @@ -692,14 +692,14 @@ private static void componentRecipes(Consumer provider) { AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_emerald") .inputItems(gemExquisite, Emerald) .inputFluids(Europium.getFluid(L / 9)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(320).save(provider); AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_olivine") .inputItems(gemExquisite, Olivine) .inputFluids(Europium.getFluid(L / 9)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(320).save(provider); @@ -718,14 +718,14 @@ private static void componentRecipes(Consumer provider) { AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_from_part_mutagen") .inputItems(RAW_CRYSTAL_CHIP_PART) .inputFluids(Mutagen.getFluid(250)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(VA[HV]).save(provider); AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_from_part_bacterial_sludge") .inputItems(RAW_CRYSTAL_CHIP_PART) .inputFluids(BacterialSludge.getFluid(250)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(VA[HV]).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 5371cbd9b1b..6cf6498e6e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -203,10 +203,10 @@ private static void registerPrimitiveBlastFurnaceRecipes(Consumer provider) private static void registerBlastFurnaceRecipes(Consumer provider) { BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_dust").duration(400).EUt(100).inputItems(dust, Ruby) - .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0).blastFurnaceTemp(1200) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9").blastFurnaceTemp(1200) .save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_gem").duration(320).EUt(100).inputItems(gem, Ruby) - .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0).blastFurnaceTemp(1200) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9").blastFurnaceTemp(1200) .save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_dust").duration(400).EUt(100) - .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0) + .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_gem").duration(320).EUt(100) - .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0) + .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_dust").duration(400).EUt(100).inputItems(dust, Sapphire) .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_gem").duration(320).EUt(100).inputItems(gem, Sapphire) .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("steel_from_iron").duration(500).EUt(VA[MV]).inputItems(ingot, Iron) - .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("steel_from_wrought_iron").duration(300).EUt(VA[MV]).inputItems(ingot, WroughtIron) - .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("tempered_glass_blasting") @@ -1159,7 +1159,7 @@ private static void registerBlastFurnaceMetallurgyRecipes(Consumer provider, .inputItems(dust, inputMaterial) .inputFluids(Oxygen.getFluid(3000)) .outputItems(dust, outputMaterial) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(SulfurDioxide.getFluid(sulfurDioxideAmount)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 8ea508e563c..072d3055d0e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -74,7 +74,7 @@ public static void init(Consumer provider) { .chancedOutput(gem, Flint, 9000, 0) .chancedOutput(gem, Flint, 8000, 0) .chancedOutput(gem, Flint, 6000, 0) - .chancedOutput(gem, Flint, "1/3", 0) + .chancedOutput(gem, Flint, "1/3") .chancedOutput(gem, Flint, 2500, 0) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index d9b8c06d767..2ef3195aea8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -280,7 +280,7 @@ private static void smashingRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("gravel_to_flint") .inputItems(new ItemStack(Blocks.GRAVEL, 1)) .outputItems(dust, Stone) - .chancedOutput(new ItemStack(Items.FLINT), 3300, 0) + .chancedOutput(new ItemStack(Items.FLINT), 3300) .duration(400).EUt(2) .save(provider); @@ -347,7 +347,7 @@ private static void smashingRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("macerate_melon_block") .inputItems(new ItemStack(Blocks.MELON)) .outputItems(new ItemStack(Items.MELON_SLICE, 8)) - .chancedOutput(new ItemStack(Items.MELON_SEEDS), 8500, 0) + .chancedOutput(new ItemStack(Items.MELON_SEEDS), 8500) .duration(400).EUt(2) .save(provider); @@ -366,9 +366,9 @@ private static void smashingRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("macerate_wool") .inputItems(ItemTags.WOOL) .outputItems(new ItemStack(Items.STRING)) - .chancedOutput(new ItemStack(Items.STRING), 9000, 0) - .chancedOutput(new ItemStack(Items.STRING), 5000, 0) - .chancedOutput(new ItemStack(Items.STRING), 2000, 0) + .chancedOutput(new ItemStack(Items.STRING), 9000) + .chancedOutput(new ItemStack(Items.STRING), 5000) + .chancedOutput(new ItemStack(Items.STRING), 2000) .duration(200).EUt(2) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java index 4f79034e331..0d668420870 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java @@ -23,8 +23,8 @@ public static void init(Consumer provider) { .inputItems(PLANT_BALL, 2) .outputItems(BIO_CHAFF) .outputItems(BIO_CHAFF) - .chancedOutput(BIO_CHAFF.asStack(), 5000, 0) - .chancedOutput(BIO_CHAFF.asStack(), 2500, 0) + .chancedOutput(BIO_CHAFF.asStack(), 5000) + .chancedOutput(BIO_CHAFF.asStack(), 2500) .save(provider); MACERATOR_RECIPES.recipeBuilder("dirt_from_bio_chaff").EUt(4).duration(300) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java index 69999459217..7d14178f614 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java @@ -235,7 +235,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_heavy_fuel") .inputFluids(LightlySteamCrackedHeavyFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(LightFuel.getFluid(300)) .outputFluids(Naphtha.getFluid(50)) .outputFluids(Toluene.getFluid(25)) @@ -251,7 +251,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_heavy_fuel") .inputFluids(SeverelySteamCrackedHeavyFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(LightFuel.getFluid(100)) .outputFluids(Naphtha.getFluid(125)) .outputFluids(Toluene.getFluid(80)) @@ -287,7 +287,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_light_fuel") .inputFluids(LightlySteamCrackedLightFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(HeavyFuel.getFluid(150)) .outputFluids(Naphtha.getFluid(400)) .outputFluids(Toluene.getFluid(40)) @@ -303,7 +303,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_light_fuel") .inputFluids(SeverelySteamCrackedLightFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(HeavyFuel.getFluid(50)) .outputFluids(Naphtha.getFluid(100)) .outputFluids(Toluene.getFluid(30)) @@ -335,7 +335,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_naphtha") .inputFluids(LightlySteamCrackedNaphtha.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(HeavyFuel.getFluid(75)) .outputFluids(LightFuel.getFluid(150)) .outputFluids(Toluene.getFluid(40)) @@ -351,7 +351,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_naphtha") .inputFluids(SeverelySteamCrackedNaphtha.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(HeavyFuel.getFluid(25)) .outputFluids(LightFuel.getFluid(50)) .outputFluids(Toluene.getFluid(20)) @@ -381,7 +381,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_gas") .inputFluids(LightlySteamCrackedGas.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(Propene.getFluid(45)) .outputFluids(Ethane.getFluid(8)) .outputFluids(Ethylene.getFluid(85)) @@ -391,7 +391,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_gas") .inputFluids(SeverelySteamCrackedGas.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(Propene.getFluid(8)) .outputFluids(Ethane.getFluid(45)) .outputFluids(Ethylene.getFluid(92)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java index 66bb796dd48..28f3ae5ccc9 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java @@ -377,7 +377,7 @@ public static void init(Consumer provider) { .circuitMeta(1) .inputItems(gem, Charcoal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -385,7 +385,7 @@ public static void init(Consumer provider) { .circuitMeta(1) .inputItems(gem, Coal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -393,7 +393,7 @@ public static void init(Consumer provider) { .circuitMeta(1) .inputItems(dust, Charcoal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -402,7 +402,7 @@ public static void init(Consumer provider) { .inputItems(dust, Coal) .circuitMeta(1) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .save(provider); @@ -447,7 +447,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(gem, Charcoal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -455,7 +455,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(gem, Coal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -463,7 +463,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(dust, Charcoal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -471,7 +471,7 @@ public static void init(Consumer provider) { .circuitMeta(2) .inputItems(dust, Coal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java index 533fa43cce2..71c3ee221d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java @@ -49,13 +49,13 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("oilsands_ore_separation") .inputItems(ore, Oilsands) - .chancedOutput(new ItemStack(Blocks.SAND), 7500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 7500) .outputFluids(OilHeavy.getFluid(2000)) .duration(200).EUt(30).save(provider); CENTRIFUGE_RECIPES.recipeBuilder("oilsands_dust_separation") .inputItems(dust, Oilsands) - .chancedOutput(new ItemStack(Blocks.SAND), 7500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 7500) .outputFluids(OilHeavy.getFluid(2000)) .duration(200).EUt(30).save(provider); @@ -105,14 +105,14 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("sticky_resin_separation").duration(400).EUt(5) .inputItems(STICKY_RESIN) .outputItems(dust, RawRubber, 3) - .chancedOutput(PLANT_BALL.asStack(), 1500, 0) + .chancedOutput(PLANT_BALL.asStack(), 1500) .outputFluids(Glue.getFluid(100)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("rubber_log_separation").duration(200).EUt(5) .inputItems(GTBlocks.RUBBER_LOG.asStack()) - .chancedOutput(STICKY_RESIN.asStack(), 6400, 0) - .chancedOutput(PLANT_BALL.asStack(), 4000, 0) + .chancedOutput(STICKY_RESIN.asStack(), 6400) + .chancedOutput(PLANT_BALL.asStack(), 4000) .chancedOutput(dust, Carbon, 3000, 0) .chancedOutput(dust, Wood, 3000, 0) .outputFluids(Methane.getFluid(60)) @@ -121,23 +121,23 @@ public static void init(Consumer provider) { // TODO Other kinds of dirt? CENTRIFUGE_RECIPES.recipeBuilder("dirt_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.DIRT.asItem()) - .chancedOutput(PLANT_BALL.asStack(), 1400, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 6000, 0) + .chancedOutput(PLANT_BALL.asStack(), 1400) + .chancedOutput(new ItemStack(Blocks.SAND), 6000) .chancedOutput(dust, Clay, 550, 0) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("grass_block_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.GRASS_BLOCK.asItem()) - .chancedOutput(PLANT_BALL.asStack(), 3500, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 5500, 0) + .chancedOutput(PLANT_BALL.asStack(), 3500) + .chancedOutput(new ItemStack(Blocks.SAND), 5500) .chancedOutput(dust, Clay, 550, 0) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("mycelium_separation").duration(650).EUt(VA[LV]) .inputItems(new ItemStack(Blocks.MYCELIUM)) - .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800, 0) - .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 6200, 0) + .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800) + .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800) + .chancedOutput(new ItemStack(Blocks.SAND), 6200) .chancedOutput(dust, Clay, 550, 0) .save(provider); @@ -182,7 +182,7 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("endstone_separation").duration(320).EUt(20) .inputItems(dust, Endstone) - .chancedOutput(new ItemStack(Blocks.SAND), 9000, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 9000) .chancedOutput(dust, Tungstate, 445, 0) .chancedOutput(dust, Platinum, 80, 0) .outputFluids(Helium.getFluid(120)) @@ -198,7 +198,7 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("soul_sand_separation").duration(200).EUt(80) .inputItems(Blocks.SOUL_SAND.asItem()) - .chancedOutput(new ItemStack(Blocks.SAND), 9250, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 9250) .chancedOutput(dust, Saltpeter, 2250, 0) .chancedOutput(dust, Coal, 225, 0) .outputFluids(Oil.getFluid(80)) @@ -228,7 +228,7 @@ public static void init(Consumer provider) { .inputItems(Blocks.RED_SAND.asItem()) .chancedOutput(dust, Iron, 5000, 0) .chancedOutput(dust, Diamond, 35, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 8500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 8500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("hydrogen_separation").duration(160).EUt(20) @@ -269,8 +269,8 @@ public static void init(Consumer provider) { .inputItems(dust, Stone) .chancedOutput(dust, Quartzite, 2500, 0) .chancedOutput(dust, PotassiumFeldspar, 2500, 0) - .chancedOutput(dust, Marble, "2/9", 0) - .chancedOutput(dust, Biotite, "1/9", 0) + .chancedOutput(dust, Marble, "2/9") + .chancedOutput(dust, Biotite, "1/9") .chancedOutput(dust, MetalMixture, 925, 0) .chancedOutput(dust, Sodalite, 650, 0) .save(provider); @@ -279,8 +279,8 @@ public static void init(Consumer provider) { .inputItems(dust, MetalMixture) .chancedOutput(dust, Hematite, 2500, 0) .chancedOutput(dust, Bauxite, 2500, 0) - .chancedOutput(dust, Pyrolusite, "2/9", 0) - .chancedOutput(dust, Barite, "1/9", 0) + .chancedOutput(dust, Pyrolusite, "2/9") + .chancedOutput(dust, Barite, "1/9") .chancedOutput(dust, Chromite, 855, 0) .chancedOutput(dust, Ilmenite, 575, 0) .save(provider); @@ -544,7 +544,7 @@ public static void init(Consumer provider) { EXTRACTOR_RECIPES.recipeBuilder("wood_dust_extraction").duration(16).EUt(4) .inputItems(dust, Wood) - .chancedOutput(PLANT_BALL.asStack(), 225, 0) + .chancedOutput(PLANT_BALL.asStack(), 225) .outputFluids(Creosote.getFluid(5)) .save(provider); From 6362dd5314341fa685170ad783304105d460c5c1 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 17 Jun 2026 21:16:44 -0500 Subject: [PATCH 08/28] OUT OF DOLLS, ELF? --- .../generated/MaterialRecipeHandler.java | 8 +- .../recipe/generated/OreRecipeHandler.java | 2 +- .../data/recipe/misc/MachineRecipeLoader.java | 34 +++---- .../data/recipe/misc/MiscRecipeLoader.java | 8 +- .../recipe/misc/VanillaStandardRecipes.java | 2 +- .../data/recipe/misc/WoodMachineRecipes.java | 6 +- .../chemistry/DistillationRecipes.java | 14 +-- .../chemistry/GemSlurryRecipes.java | 20 ++-- .../serialized/chemistry/NaquadahRecipes.java | 4 +- .../chemistry/PetrochemRecipes.java | 12 +-- .../chemistry/SeparationRecipes.java | 94 +++++++++---------- .../serialized/chemistry/TitaniumRecipes.java | 20 ++-- 12 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index 33f2a9c06b6..83b07075abf 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -90,28 +90,28 @@ private static void processDust(@NotNull Consumer provider, @Not IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_powderbarrel") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(new ItemStack(GTBlocks.POWDERBARREL, 8)) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_tnt") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesAmount(4) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_dynamite") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(GTItems.DYNAMITE.asStack(2)) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_itnt") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java index cfdf12acd3c..f7be9ab2482 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java @@ -492,7 +492,7 @@ private static void processPureDust(@NotNull Consumer provider, ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("separate_" + material.getName() + "_pure_dust_to_dust") .inputItems(dustPure, material) .outputItems(dustStack) - .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000, 0) + .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000) .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000) .duration(200).EUt(24) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 6cf6498e6e2..8e1d6c83ca1 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -326,7 +326,7 @@ private static void registerMixingCrystallizationRecipes(Consumer provider) MACERATOR_RECIPES.recipeBuilder("macerate_end_stone") .inputItems(new ItemStack(Blocks.END_STONE)) .outputItems(dust, Endstone) - .chancedOutput(dust, Tungstate, 330, 0) + .chancedOutput(dust, Tungstate, 330) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_netherrack") .inputItems(new ItemStack(Blocks.NETHERRACK)) .outputItems(dust, Netherrack) - .chancedOutput(nugget, Gold, 750, 0) + .chancedOutput(nugget, Gold, 750) .duration(150).EUt(2) .save(provider); @@ -1267,7 +1267,7 @@ private static void registerRecyclingRecipes(Consumer provider) // MACERATOR_RECIPES.recipeBuilder() // .inputItems(stone, Soapstone) // .outputItems(dustImpure, Talc) - // .chancedOutput(dust, Chromite, "1/90", 0) + // .chancedOutput(dust, Chromite, "1/90") // .duration(150).EUt(2) // .save(provider); @@ -1275,63 +1275,63 @@ private static void registerRecyclingRecipes(Consumer provider) // MACERATOR_RECIPES.recipeBuilder() // .inputItems(stone, Redrock) // .outputItems(dust, Redrock) - // .chancedOutput(dust, Redrock, 1000, 0) + // .chancedOutput(dust, Redrock, 1000) // .duration(150).EUt(2) // .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_marble") .inputItems(rock, Marble) .outputItems(dust, Marble) - .chancedOutput(dust, Marble, 1500, 0) + .chancedOutput(dust, Marble, 1500) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_basalt") .inputItems(Blocks.BASALT.asItem()) .outputItems(dust, Basalt) - .chancedOutput(dust, Basalt, 1500, 0) + .chancedOutput(dust, Basalt, 1500) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_deepslate") .inputItems(Blocks.DEEPSLATE.asItem()) .outputItems(dust, Deepslate) - .chancedOutput(dust, Thorium, 150, 0) + .chancedOutput(dust, Thorium, 150) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_red_granite") .inputItems(rock, GraniteRed) .outputItems(dust, GraniteRed) - .chancedOutput(dust, Uranium238, 25, 0) + .chancedOutput(dust, Uranium238, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_andesite") .inputItems(Blocks.ANDESITE.asItem()) .outputItems(dust, Andesite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_diorite") .inputItems(Blocks.DIORITE.asItem()) .outputItems(dust, Diorite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_granite") .inputItems(Blocks.GRANITE.asItem()) .outputItems(dust, Granite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_calcite") .inputItems(Blocks.CALCITE.asItem()) .outputItems(dust, Calcite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); @@ -1351,14 +1351,14 @@ private static void registerRecyclingRecipes(Consumer provider) MACERATOR_RECIPES.recipeBuilder("macerate_pork_chop") .inputItems(new ItemStack(Items.PORKCHOP)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 6500, 0) + .chancedOutput(dust, Meat, 6500) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_fish") .inputItems(ItemTags.FISHES) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); @@ -1371,14 +1371,14 @@ private static void registerRecyclingRecipes(Consumer provider) MACERATOR_RECIPES.recipeBuilder("macerate_steak") .inputItems(new ItemStack(Items.BEEF)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_rabbit") .inputItems(new ItemStack(Items.RABBIT)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 072d3055d0e..9a33cc92079 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -71,11 +71,11 @@ public static void init(Consumer provider) { SIFTER_RECIPES.recipeBuilder("gravel_sifting").duration(100).EUt(16) .inputItems(new ItemStack(Blocks.GRAVEL)) .outputItems(gem, Flint) - .chancedOutput(gem, Flint, 9000, 0) - .chancedOutput(gem, Flint, 8000, 0) - .chancedOutput(gem, Flint, 6000, 0) + .chancedOutput(gem, Flint, 9000) + .chancedOutput(gem, Flint, 8000) + .chancedOutput(gem, Flint, 6000) .chancedOutput(gem, Flint, "1/3") - .chancedOutput(gem, Flint, 2500, 0) + .chancedOutput(gem, Flint, 2500) .save(provider); PACKER_RECIPES.recipeBuilder("matchbox") diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index 2ef3195aea8..8240fa9d09a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -380,7 +380,7 @@ private static void woodRecipes(Consumer provider) { MACERATOR_RECIPES.recipeBuilder("macerate_logs") .inputItems(ItemTags.LOGS) .outputItems(dust, Wood, 6) - .chancedOutput(dust, Wood, 8500, 0) + .chancedOutput(dust, Wood, 8500) .duration(150).EUt(2) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java index ff506e8778a..e2809b304a8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java @@ -1215,21 +1215,21 @@ private static void registerPyrolyseOvenRecipes(Consumer provide // COAL TAR ============================================ PYROLYSE_RECIPES.recipeBuilder("charcoal_to_coal_tar").circuitMeta(8) .inputItems(Items.CHARCOAL, 32) - .chancedOutput(dust, Ash, 5000, 0) + .chancedOutput(dust, Ash, 5000) .outputFluids(CoalTar.getFluid(1000)) .duration(640).EUt(64) .save(provider); PYROLYSE_RECIPES.recipeBuilder("coal_to_coal_tar").circuitMeta(8) .inputItems(Items.COAL, 12) - .chancedOutput(dust, DarkAsh, 5000, 0) + .chancedOutput(dust, DarkAsh, 5000) .outputFluids(CoalTar.getFluid(3000)) .duration(320).EUt(96) .save(provider); PYROLYSE_RECIPES.recipeBuilder("coke_to_coal_tar").circuitMeta(8) .inputItems(gem, Coke, 8) - .chancedOutput(dust, Ash, 7500, 0) + .chancedOutput(dust, Ash, 7500) .outputFluids(CoalTar.getFluid(4000)) .duration(320).EUt(96) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java index 8e8d7a00945..6ffbe21117e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java @@ -33,7 +33,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_charcoal_byproducts") .inputFluids(CharcoalByproducts.getFluid(1000)) - .chancedOutput(dust, Charcoal, 2500, 0) + .chancedOutput(dust, Charcoal, 2500) .outputFluids(WoodTar.getFluid(250)) .outputFluids(WoodVinegar.getFluid(400)) .outputFluids(WoodGas.getFluid(250)) @@ -117,14 +117,14 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_biomass") .inputFluids(Biomass.getFluid(1000)) - .chancedOutput(dust, Wood, 5000, 0) + .chancedOutput(dust, Wood, 5000) .outputFluids(Ethanol.getFluid(600)) .outputFluids(Water.getFluid(300)) .duration(32).EUt(400).save(provider); DISTILLATION_RECIPES.recipeBuilder("distill_coal_gas") .inputFluids(CoalGas.getFluid(1000)) - .chancedOutput(dust, Coke, 2500, 0) + .chancedOutput(dust, Coke, 2500) .outputFluids(CoalTar.getFluid(200)) .outputFluids(Ammonia.getFluid(300)) .outputFluids(Ethylbenzene.getFluid(250)) @@ -134,7 +134,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_coal_tar") .inputFluids(CoalTar.getFluid(1000)) - .chancedOutput(dust, Coke, 2500, 0) + .chancedOutput(dust, Coke, 2500) .outputFluids(Naphthalene.getFluid(400)) .outputFluids(HydrogenSulfide.getFluid(300)) .outputFluids(Creosote.getFluid(200)) @@ -149,7 +149,7 @@ public static void init(Consumer provider) { .outputFluids(CarbonDioxide.getFluid(2500)) .outputFluids(Helium.getFluid(1000)) .outputFluids(Argon.getFluid(500)) - .chancedOutput(dust, Ice, 9000, 0) + .chancedOutput(dust, Ice, 9000) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[HV]).save(provider); @@ -161,7 +161,7 @@ public static void init(Consumer provider) { .outputFluids(SulfurDioxide.getFluid(7500)) .outputFluids(Helium3.getFluid(2500)) .outputFluids(Neon.getFluid(500)) - .chancedOutput(dust, Ash, 2250, 0) + .chancedOutput(dust, Ash, 2250) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[EV]).save(provider); @@ -174,7 +174,7 @@ public static void init(Consumer provider) { .outputFluids(Krypton.getFluid(1000)) .outputFluids(Xenon.getFluid(1000)) .outputFluids(Radon.getFluid(1000)) - .chancedOutput(dust, EnderPearl, 1000, 0) + .chancedOutput(dust, EnderPearl, 1000) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[IV]).save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java index 9dd5dbfc532..5d741368770 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java @@ -30,9 +30,9 @@ public static void init(Consumer provider) { .inputFluids(RubySlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) .outputItems(dust, Chromium) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); @@ -52,9 +52,9 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(SapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); @@ -74,10 +74,10 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("green_sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(GreenSapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) - .chancedOutput(dust, Beryllium, 200, 0) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Beryllium, 200) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java index 654cfcb03e2..f6d7cd02a69 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java @@ -89,7 +89,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("enriched_naquadah_waste_separation").EUt(VA[HV]).duration(300) .inputFluids(EnrichedNaquadahWaste.getFluid(2000)) - .chancedOutput(dust, BariumSulfide, 5000, 0) + .chancedOutput(dust, BariumSulfide, 5000) .outputFluids(SulfuricAcid.getFluid(500)) .outputFluids(EnrichedNaquadahSolution.getFluid(250)) .outputFluids(NaquadriaSolution.getFluid(100)) @@ -126,7 +126,7 @@ public static void init(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("naquadria_waste_separation").EUt(VA[HV]).duration(300) .inputFluids(NaquadriaWaste.getFluid(2000)) - .chancedOutput(dust, GalliumSulfide, 5000, 0) + .chancedOutput(dust, GalliumSulfide, 5000) .outputFluids(SulfuricAcid.getFluid(500)) .outputFluids(NaquadriaSolution.getFluid(250)) .outputFluids(EnrichedNaquadahSolution.getFluid(100)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java index 7d14178f614..738e978c7e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java @@ -123,7 +123,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_ethane") .inputFluids(SteamCrackedEthane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Ethylene.getFluid(250)) .outputFluids(Methane.getFluid(1250)) .duration(120).EUt(VA[MV]).save(provider); @@ -148,7 +148,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_propene") .inputFluids(SteamCrackedPropene.getFluid(1000)) - .chancedOutput(dust, Carbon, 5000, 0) + .chancedOutput(dust, Carbon, 5000) .outputFluids(Ethylene.getFluid(1000)) .outputFluids(Methane.getFluid(500)) .duration(120).EUt(VA[MV]).save(provider); @@ -161,7 +161,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_propane") .inputFluids(SteamCrackedPropane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Ethylene.getFluid(750)) .outputFluids(Methane.getFluid(1250)) .duration(120).EUt(VA[MV]).save(provider); @@ -175,7 +175,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butane") .inputFluids(SteamCrackedButane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Propane.getFluid(125)) .outputFluids(Ethane.getFluid(750)) .outputFluids(Ethylene.getFluid(750)) @@ -193,7 +193,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butene") .inputFluids(SteamCrackedButene.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Propene.getFluid(250)) .outputFluids(Ethylene.getFluid(1500)) .outputFluids(Methane.getFluid(250)) @@ -207,7 +207,7 @@ private static void distillationRecipes(Consumer provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butadiene") .inputFluids(SteamCrackedButadiene.getFluid(1000)) - .chancedOutput(dust, Carbon, 5000, 0) + .chancedOutput(dust, Carbon, 5000) .outputFluids(Propene.getFluid(125)) .outputFluids(Ethylene.getFluid(250)) .outputFluids(Methane.getFluid(1125)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java index 71c3ee221d7..45abc9e9e85 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java @@ -113,8 +113,8 @@ public static void init(Consumer provider) { .inputItems(GTBlocks.RUBBER_LOG.asStack()) .chancedOutput(STICKY_RESIN.asStack(), 6400) .chancedOutput(PLANT_BALL.asStack(), 4000) - .chancedOutput(dust, Carbon, 3000, 0) - .chancedOutput(dust, Wood, 3000, 0) + .chancedOutput(dust, Carbon, 3000) + .chancedOutput(dust, Wood, 3000) .outputFluids(Methane.getFluid(60)) .save(provider); @@ -123,14 +123,14 @@ public static void init(Consumer provider) { .inputItems(Blocks.DIRT.asItem()) .chancedOutput(PLANT_BALL.asStack(), 1400) .chancedOutput(new ItemStack(Blocks.SAND), 6000) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("grass_block_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.GRASS_BLOCK.asItem()) .chancedOutput(PLANT_BALL.asStack(), 3500) .chancedOutput(new ItemStack(Blocks.SAND), 5500) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("mycelium_separation").duration(650).EUt(VA[LV]) @@ -138,17 +138,17 @@ public static void init(Consumer provider) { .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800) .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800) .chancedOutput(new ItemStack(Blocks.SAND), 6200) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("ash_separation").duration(240).EUt(VA[LV]) .inputItems(dust, Ash) - .chancedOutput(dust, Quicklime, 4950, 0) - .chancedOutput(dust, Potash, 1600, 0) - .chancedOutput(dust, Magnesia, 1500, 0) - .chancedOutput(dust, PhosphorusPentoxide, 60, 0) - .chancedOutput(dust, SodaAsh, 600, 0) - .chancedOutput(dust, Hematite, 275, 0) + .chancedOutput(dust, Quicklime, 4950) + .chancedOutput(dust, Potash, 1600) + .chancedOutput(dust, Magnesia, 1500) + .chancedOutput(dust, PhosphorusPentoxide, 60) + .chancedOutput(dust, SodaAsh, 600) + .chancedOutput(dust, Hematite, 275) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("dark_ash_separation").duration(250).EUt(6) @@ -170,64 +170,64 @@ public static void init(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("uranium_238_separation").duration(800).EUt(320) .inputItems(dust, Uranium238) - .chancedOutput(dustTiny, Plutonium239, 280, 0) - .chancedOutput(dustTiny, Uranium235, 2300, 0) + .chancedOutput(dustTiny, Plutonium239, 280) + .chancedOutput(dustTiny, Uranium235, 2300) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("plutonium_239_separation").duration(1600).EUt(320) .inputItems(dust, Plutonium239) - .chancedOutput(dustTiny, Uranium238, 3400, 0) - .chancedOutput(dust, Plutonium241, 2500, 0) + .chancedOutput(dustTiny, Uranium238, 3400) + .chancedOutput(dust, Plutonium241, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("endstone_separation").duration(320).EUt(20) .inputItems(dust, Endstone) .chancedOutput(new ItemStack(Blocks.SAND), 9000) - .chancedOutput(dust, Tungstate, 445, 0) - .chancedOutput(dust, Platinum, 80, 0) + .chancedOutput(dust, Tungstate, 445) + .chancedOutput(dust, Platinum, 80) .outputFluids(Helium.getFluid(120)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("netherrack_separation").duration(160).EUt(20) .inputItems(dust, Netherrack) - .chancedOutput(dust, Redstone, 700, 0) - .chancedOutput(dust, Gold, 75, 0) - .chancedOutput(dust, Sulfur, 2500, 0) - .chancedOutput(dust, Coal, 700, 0) + .chancedOutput(dust, Redstone, 700) + .chancedOutput(dust, Gold, 75) + .chancedOutput(dust, Sulfur, 2500) + .chancedOutput(dust, Coal, 700) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("soul_sand_separation").duration(200).EUt(80) .inputItems(Blocks.SOUL_SAND.asItem()) .chancedOutput(new ItemStack(Blocks.SAND), 9250) - .chancedOutput(dust, Saltpeter, 2250, 0) - .chancedOutput(dust, Coal, 225, 0) + .chancedOutput(dust, Saltpeter, 2250) + .chancedOutput(dust, Coal, 225) .outputFluids(Oil.getFluid(80)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("lava_separation").duration(80).EUt(80) .inputFluids(Lava.getFluid(100)) - .chancedOutput(dust, SiliconDioxide, 1250, 0) - .chancedOutput(dust, Magnesia, 250, 0) - .chancedOutput(dust, Quicklime, 250, 0) - .chancedOutput(nugget, Gold, 250, 0) - .chancedOutput(dust, Sapphire, 315, 0) - .chancedOutput(dust, Tantalite, 125, 0) + .chancedOutput(dust, SiliconDioxide, 1250) + .chancedOutput(dust, Magnesia, 250) + .chancedOutput(dust, Quicklime, 250) + .chancedOutput(nugget, Gold, 250) + .chancedOutput(dust, Sapphire, 315) + .chancedOutput(dust, Tantalite, 125) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("rare_earth_separation").duration(64).EUt(20) .inputItems(dust, RareEarth) - .chancedOutput(dustSmall, Cadmium, 3500, 0) - .chancedOutput(dustSmall, Neodymium, 4500, 0) - .chancedOutput(dustSmall, Samarium, 3500, 0) - .chancedOutput(dustSmall, Cerium, 5500, 0) - .chancedOutput(dustSmall, Yttrium, 3500, 0) - .chancedOutput(dustSmall, Lanthanum, 2500, 0) + .chancedOutput(dustSmall, Cadmium, 3500) + .chancedOutput(dustSmall, Neodymium, 4500) + .chancedOutput(dustSmall, Samarium, 3500) + .chancedOutput(dustSmall, Cerium, 5500) + .chancedOutput(dustSmall, Yttrium, 3500) + .chancedOutput(dustSmall, Lanthanum, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("red_sand_separation").duration(50).EUt(VA[LV]) .inputItems(Blocks.RED_SAND.asItem()) - .chancedOutput(dust, Iron, 5000, 0) - .chancedOutput(dust, Diamond, 35, 0) + .chancedOutput(dust, Iron, 5000) + .chancedOutput(dust, Diamond, 35) .chancedOutput(new ItemStack(Blocks.SAND), 8500) .save(provider); @@ -267,28 +267,28 @@ public static void init(Consumer provider) { // Stone Dust CENTRIFUGE_RECIPES.recipeBuilder("stone_dust_separation").duration(480).EUt(VA[MV]) .inputItems(dust, Stone) - .chancedOutput(dust, Quartzite, 2500, 0) - .chancedOutput(dust, PotassiumFeldspar, 2500, 0) + .chancedOutput(dust, Quartzite, 2500) + .chancedOutput(dust, PotassiumFeldspar, 2500) .chancedOutput(dust, Marble, "2/9") .chancedOutput(dust, Biotite, "1/9") - .chancedOutput(dust, MetalMixture, 925, 0) - .chancedOutput(dust, Sodalite, 650, 0) + .chancedOutput(dust, MetalMixture, 925) + .chancedOutput(dust, Sodalite, 650) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("metal_mixture_separation").duration(1000).EUt(900) .inputItems(dust, MetalMixture) - .chancedOutput(dust, Hematite, 2500, 0) - .chancedOutput(dust, Bauxite, 2500, 0) + .chancedOutput(dust, Hematite, 2500) + .chancedOutput(dust, Bauxite, 2500) .chancedOutput(dust, Pyrolusite, "2/9") .chancedOutput(dust, Barite, "1/9") - .chancedOutput(dust, Chromite, 855, 0) - .chancedOutput(dust, Ilmenite, 575, 0) + .chancedOutput(dust, Chromite, 855) + .chancedOutput(dust, Ilmenite, 575) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("quartz_sand_separation").duration(60).EUt(VA[LV]) .inputItems(dust, QuartzSand, 2) .outputItems(dust, Quartzite) - .chancedOutput(dust, CertusQuartz, 2500, 0) + .chancedOutput(dust, CertusQuartz, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("red_alloy_separation").duration(900).EUt(VA[LV]) @@ -339,7 +339,7 @@ public static void init(Consumer provider) { .inputItems(dust, Sphalerite, 2) .outputItems(dust, Zinc) .outputItems(dust, Sulfur) - .chancedOutput(dust, Gallium, 750, 0) + .chancedOutput(dust, Gallium, 750) .duration(200).EUt(VA[LV]).save(provider); ELECTROLYZER_RECIPES.recipeBuilder("water_electrolysis") diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java index 9eda4fbbccd..91bcf4f690f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java @@ -138,8 +138,8 @@ private static void bauxiteProcess(Consumer provider) { ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("bauxite_slag_separation") .inputItems(dust, BauxiteSlag) .outputItems(dust, Salt) - .chancedOutput(dust, Neodymium, 2000, 0) - .chancedOutput(dust, Chromium, 1000, 0) + .chancedOutput(dust, Neodymium, 2000) + .chancedOutput(dust, Chromium, 1000) .duration(50).EUt(VA[MV]).save(provider); // Bauxite Sludge -> Calcite (looped) + Decalcified Bauxite Sludge @@ -154,11 +154,11 @@ private static void bauxiteProcess(Consumer provider) { CENTRIFUGE_RECIPES.recipeBuilder("bauxite_sludge_centrifuge") .inputFluids(DecalcifiedBauxiteSludge.getFluid(250)) .outputItems(dust, Rutile, 2) - .chancedOutput(dust, Gallium, 5000, 0) - .chancedOutput(dust, Gallium, 3000, 0) - .chancedOutput(dust, Gallium, 1000, 0) - .chancedOutput(dust, SiliconDioxide, 9000, 0) - .chancedOutput(dust, Iron, 8000, 0) + .chancedOutput(dust, Gallium, 5000) + .chancedOutput(dust, Gallium, 3000) + .chancedOutput(dust, Gallium, 1000) + .chancedOutput(dust, SiliconDioxide, 9000) + .chancedOutput(dust, Iron, 8000) .outputFluids(Water.getFluid(250)) .duration(100).EUt(VA[MV]).save(provider); } @@ -167,9 +167,9 @@ private static void ilmeniteProcess(Consumer provider) { // Byproduct separation for Ilmenite ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("ilmenite_separation") .inputItems(dust, IlmeniteSlag) - .chancedOutput(dust, Iron, 8000, 0) - .chancedOutput(dust, Tantalum, 2000, 0) - .chancedOutput(dust, Niobium, 500, 0) + .chancedOutput(dust, Iron, 8000) + .chancedOutput(dust, Tantalum, 200) + .chancedOutput(dust, Niobium, 50) .duration(50).EUt(VA[MV]).save(provider); } } From f3d2568eb36c8de83491ae4c04aa98b9de06683b Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sun, 21 Jun 2026 12:57:07 -0500 Subject: [PATCH 09/28] MUI2 Merge Conflict Resolver --- .../api/recipe/chance/logic/ChanceLogic.java | 2 +- .../gtceu/api/recipe/content/Content.java | 3 +- .../recipe/gui/CapabilityContentBuilder.java | 13 +++--- .../gtceu/api/recipe/gui/ContentOverlay.java | 18 +++------ .../common/mui/GTMultiblockTextUtil.java | 14 ++----- .../recipeviewer/emi/recipe/GTEmiRecipe.java | 20 ++-------- .../rei/recipe/GTRecipeDisplay.java | 20 ++-------- .../recipeviewer/widgets/GTOreByProduct.java | 40 +++++++++---------- .../widgets/OreProcessingRecipeWidget.java | 2 +- 9 files changed, 46 insertions(+), 86 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java index 5d10f8a46ed..aef78fc83d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java @@ -283,7 +283,7 @@ public ChanceLogic(String id) { * @return the total chance for the entry */ static int getChance(@NotNull Content entry) { - return entry.chance; + return entry.chance(); } /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java index 3a383303110..898a6f482b1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java @@ -82,8 +82,7 @@ private int fixBoost(int chanceBoost) { public static void addChanceTooltips(RichTooltip tooltip, Content content, ChanceLogic logic) { if (content.chance() < ChanceLogic.getMaxChancedValue()) { - int boostedChance = function.getBoostedChance(content, recipeTier, chanceTier); - if (boostedChance == 0) { + if (content.chance() == 0) { tooltip.addLine(Component.translatable("gtceu.gui.content.chance_nc")); } else { float baseChanceFloat = 100f * content.chance() / content.maxChance(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java index 25aca9e0626..0996b98c810 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java @@ -55,13 +55,12 @@ void buildWidgetContent(IWidget widget, Content content, IO io, boolean perTick, recipeType, recipe, chanceTier, recipeTier) -> { if (!(widget instanceof RecipeViewerSlotWidget recipeViewerSlotWidget)) return; - float chance = (float) recipeType.getChanceFunction() - .getBoostedChance(content, recipeTier, chanceTier) / content.maxChance(); + float chance = (float) content.chance() / content.maxChance(); var innerContent = ItemRecipeCapability.CAP.of(content.content()); recipeViewerSlotWidget.value(ItemRecipeCapability.mapIngredientToEntryList(innerContent)); recipeViewerSlotWidget - .overlay(new ContentOverlay(content, perTick, recipeTier, chanceTier, recipeType.getChanceFunction())); + .overlay(new ContentOverlay(content, perTick)); recipeViewerSlotWidget.chance(chance); if (io == IO.IN && (content.chance() == 0 || innerContent instanceof IntCircuitIngredient)) { @@ -75,8 +74,7 @@ void buildWidgetContent(IWidget widget, Content content, IO io, boolean perTick, recipeViewerSlotWidget.tooltipBuilder((tooltip) -> { Content.addChanceTooltips(tooltip, content, - recipe.getChanceLogicForCapability(ItemRecipeCapability.CAP, io, perTick), - recipeTier, chanceTier, recipeType.getChanceFunction()); + recipe.getChanceLogicForCapability(ItemRecipeCapability.CAP, io, perTick)); if (innerContent instanceof IntProviderIngredient ingredient) { IntProvider countProvider = ingredient.getCountProvider(); @@ -101,13 +99,12 @@ void buildWidgetContent(IWidget widget, Content content, IO io, boolean perTick, recipeType, recipe, chanceTier, recipeTier) -> { if (!(widget instanceof RecipeViewerSlotWidget recipeViewerSlotWidget)) return; - float chance = (float) recipeType.getChanceFunction() - .getBoostedChance(content, recipeTier, chanceTier) / content.maxChance(); + float chance = (float) content.chance() / content.maxChance(); FluidIngredient ingredient = FluidRecipeCapability.CAP.of(content.content()); recipeViewerSlotWidget.value(FluidRecipeCapability.mapIngredientToEntryList(ingredient)); recipeViewerSlotWidget - .overlay(new ContentOverlay(content, perTick, recipeTier, chanceTier, recipeType.getChanceFunction())); + .overlay(new ContentOverlay(content, perTick)); recipeViewerSlotWidget.chance(chance); recipeViewerSlotWidget.tooltipBuilder((tooltip) -> { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java index 818fc9fceb6..6ecf1483e16 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.recipe.gui; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; @@ -22,16 +21,14 @@ import brachy.modularui.screen.viewport.GuiContext; import brachy.modularui.theme.WidgetTheme; import com.mojang.blaze3d.systems.RenderSystem; -import org.jetbrains.annotations.Nullable; @OnlyIn(Dist.CLIENT) -public record ContentOverlay(Content content, boolean perTick, int recipeTier, int chanceTier, - @Nullable ChanceBoostFunction function) +public record ContentOverlay(Content content, boolean perTick) implements IDrawable { @Override public void draw(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme) { - drawChance(context.getGraphics(), x, y, width, height, recipeTier, chanceTier, function); + drawChance(context.getGraphics(), x, y, width, height); drawRangeAmount(context.getGraphics(), x, y, width, height); drawFluidAmount(context.getGraphics(), x, y, width, height); if (perTick) { @@ -87,21 +84,18 @@ public void drawFluidAmount(GuiGraphics graphics, float x, float y, int width, i } } - public void drawChance(GuiGraphics graphics, float x, float y, int width, int height, int recipeTier, - int chanceTier, @Nullable ChanceBoostFunction function) { + public void drawChance(GuiGraphics graphics, float x, float y, int width, int height) { if (content.chance() == ChanceLogic.getMaxChancedValue()) return; graphics.pose().pushPose(); graphics.pose().translate(0, 0, 400); graphics.pose().scale(0.5f, 0.5f, 1); - var func = function == null ? ChanceBoostFunction.NONE : function; - int chance = func.getBoostedChance(content, recipeTier, chanceTier); - float chanceFloat = 1f * chance / content.maxChance(); + float chanceFloat = 1f * content.chance() / content.maxChance(); String percent = FormattingUtil.formatNumber2Places(100 * chanceFloat); - Component s = chance == 0 ? Component.translatable("gtceu.gui.content.chance_nc_short") : + Component s = content.chance() == 0 ? Component.translatable("gtceu.gui.content.chance_nc_short") : Component.literal(percent + "%"); - int color = chance == 0 ? 0xFF0000 : GradientUtil.toRGB(Mth.lerp(chanceFloat, 29f, 167f), 100f, 50f); + int color = content.chance() == 0 ? 0xFF0000 : GradientUtil.toRGB(Mth.lerp(chanceFloat, 29f, 167f), 100f, 50f); Font fontRenderer = Minecraft.getInstance().font; graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 23), (int) ((y + (height / 3f) + 6) * 2 - height), color, true); diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java index 265032618f5..9a2934e1394 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java @@ -373,7 +373,6 @@ public static DynamicSyncedWidget addOutputLines(WorkableMultiblockMachine rl public static Optional> createItemLineForOutput(Content itemOutput, GTRecipe recipe) { int runs = recipe.getTotalRuns(); - var function = recipe.getType().getChanceFunction(); int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; @@ -394,8 +393,7 @@ public static Optional> createItemLineForOutput(Content itemOutput, GT provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (itemOutput.chance() < itemOutput.maxChance()) { - countD = countD * runs * function.getBoostedChance(itemOutput, recipeTier, chanceTier) / - itemOutput.maxChance(); + countD = countD * runs * itemOutput.chance() / itemOutput.maxChance(); } countD = countD * provider.getMidRoll(); } else { @@ -406,8 +404,7 @@ public static Optional> createItemLineForOutput(Content itemOutput, GT countD *= count; if (itemOutput.chance() < itemOutput.maxChance()) { rounded = true; - countD = countD * runs * function.getBoostedChance(itemOutput, recipeTier, chanceTier) / - itemOutput.maxChance(); + countD = countD * runs * itemOutput.chance() / itemOutput.maxChance(); } count = Math.max(1, (int) Math.round(countD)); displaycount = Component.literal(String.valueOf(count)); @@ -441,7 +438,6 @@ public static Optional> createItemLineForOutput(Content itemOutput, GT public static Optional> createFluidLineForOutput(Content fluidOutput, GTRecipe recipe) { int runs = recipe.getTotalRuns(); - var function = recipe.getType().getChanceFunction(); int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; @@ -462,8 +458,7 @@ public static Optional> createFluidLineForOutput(Content fluidOutput, provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (fluidOutput.chance() < fluidOutput.maxChance()) { - amountD = amountD * runs * function.getBoostedChance(fluidOutput, recipeTier, chanceTier) / - fluidOutput.maxChance(); + amountD = amountD * runs * fluidOutput.chance() / fluidOutput.maxChance(); } amountD = amountD * provider.getMidRoll(); } else { @@ -474,8 +469,7 @@ public static Optional> createFluidLineForOutput(Content fluidOutput, amountD *= amount; if (fluidOutput.chance() < fluidOutput.maxChance()) { rounded = true; - amountD = amountD * runs * function.getBoostedChance(fluidOutput, recipeTier, chanceTier) / - fluidOutput.maxChance(); + amountD = amountD * runs * fluidOutput.chance() / fluidOutput.maxChance(); } amount = Math.max(1, (int) Math.round(amountD)); displaycount = Component.literal(String.valueOf(amount)); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java index d1c62354fec..f778a656923 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java @@ -39,10 +39,7 @@ public List getInputs() { var fluids = recipe.getInputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(itemContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - itemContent.maxChance(); + float chance = (float) itemContent.chance() / itemContent.maxChance(); var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -51,10 +48,7 @@ public List getInputs() { } for (var fluidContent : fluids) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(fluidContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - fluidContent.maxChance(); + float chance = (float) fluidContent.chance() / fluidContent.maxChance(); var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); @@ -73,10 +67,7 @@ public List getOutputs() { var fluids = recipe.getOutputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(itemContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - itemContent.maxChance(); + float chance = (float) itemContent.chance() / itemContent.maxChance(); var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -85,10 +76,7 @@ public List getOutputs() { } for (var fluidContent : fluids) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(fluidContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - fluidContent.maxChance(); + float chance = (float) fluidContent.chance() / fluidContent.maxChance(); var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java index a705f478c67..3905ea32f92 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java @@ -40,10 +40,7 @@ private List getInputs() { var fluids = recipe.getInputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(itemContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - itemContent.maxChance(); + float chance = (float) itemContent.chance() / itemContent.maxChance(); var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -52,10 +49,7 @@ private List getInputs() { } for (var fluidContent : fluids) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(fluidContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - fluidContent.maxChance(); + float chance = (float) fluidContent.chance() / fluidContent.maxChance(); var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); @@ -89,10 +83,7 @@ public List getOutputEntries() { var fluids = recipe.getOutputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(itemContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - itemContent.maxChance(); + float chance = (float) itemContent.chance() / itemContent.maxChance(); var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -102,10 +93,7 @@ public List getOutputEntries() { } for (var fluidContent : fluids) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(fluidContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - fluidContent.maxChance(); + float chance = (float) fluidContent.chance() / fluidContent.maxChance(); var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java index 41e09da14c1..ca04be0efa0 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java @@ -182,22 +182,22 @@ public GTOreByProduct(Material material) { } else { addToOutputs(byproducts[0], TagPrefix.dust, 1); } - addChance(1400, 0); + addChance(1400); // macerate crushed -> impure addToOutputs(material, TagPrefix.dustImpure, 1); addToOutputs(byproducts[0], TagPrefix.dust, byproductMultiplier); - addChance(1400, 0); + addChance(1400); // centrifuge impure -> dust addToOutputs(material, TagPrefix.dust, 1); addToOutputs(byproducts[0], TagPrefix.dust, 1); - addChance(1111, 0); + addChance(1111); // ore wash crushed -> crushed purified addToOutputs(material, TagPrefix.crushedPurified, 1); addToOutputs(byproducts[0], TagPrefix.dust, 1); - addChance(3333, 0); + addChance(3333); FluidTagList tagList = new FluidTagList(); tagList.add(GTMaterials.Water.getFluidTag(), 1000, null); tagList.add(GTMaterials.DistilledWater.getFluidTag(), 100, null); @@ -206,22 +206,22 @@ public GTOreByProduct(Material material) { // TC crushed/crushed purified -> centrifuged addToOutputs(material, TagPrefix.crushedRefined, 1); addToOutputs(byproducts[1], TagPrefix.dust, byproductMultiplier); - addChance(3333, 0); + addChance(3333); // macerate centrifuged -> dust addToOutputs(material, TagPrefix.dust, 1); addToOutputs(byproducts[2], TagPrefix.dust, 1); - addChance(1400, 0); + addChance(1400); // macerate crushed purified -> purified addToOutputs(material, TagPrefix.dustPure, 1); addToOutputs(byproducts[1], TagPrefix.dust, 1); - addChance(1400, 0); + addChance(1400); // centrifuge purified -> dust addToOutputs(material, TagPrefix.dust, 1); addToOutputs(byproducts[1], TagPrefix.dust, 1); - addChance(1111, 0); + addChance(1111); // cauldron/simple washer addToOutputs(material, TagPrefix.crushed, 1); @@ -237,7 +237,7 @@ public GTOreByProduct(Material material) { if (hasChemBath) { addToOutputs(material, TagPrefix.crushedPurified, 1); addToOutputs(byproducts[3], TagPrefix.dust, byproductMultiplier); - addChance(7000, 0); + addChance(7000); fluidInputs.add(FluidTagList.of(washedIn.first().getFluidTag(), washedIn.secondInt(), null)); } else { addEmptyOutputs(2); @@ -255,9 +255,9 @@ public GTOreByProduct(Material material) { addToOutputs(material, TagPrefix.dust, 1); addToOutputs(separatedInto.get(0), TagPrefix.dust, 1); - addChance(1000, 0); + addChance(1000); addToOutputs(separatedStack2); - addChance(prefix == TagPrefix.dust ? 500 : 2000, 0); + addChance(prefix == TagPrefix.dust ? 500 : 2000); } else { addEmptyOutputs(3); } @@ -269,23 +269,23 @@ public GTOreByProduct(Material material) { ItemStack chippedStack = ChemicalHelper.get(TagPrefix.gemChipped, material); addToOutputs(material, TagPrefix.gemExquisite, 1); - addGemChance(300, 0, 500, 0, highOutput); + addGemChance(300, 500, highOutput); addToOutputs(material, TagPrefix.gemFlawless, 1); - addGemChance(1000, 0, 1500, 0, highOutput); + addGemChance(1000, 1500, highOutput); addToOutputs(material, TagPrefix.gem, 1); - addGemChance(3500, 0, 5000, 0, highOutput); + addGemChance(3500, 5000, highOutput); addToOutputs(material, TagPrefix.dustPure, 1); - addGemChance(5000, 0, 2500, 0, highOutput); + addGemChance(5000, 2500, highOutput); if (!flawedStack.isEmpty()) { addToOutputs(flawedStack); - addGemChance(2500, 0, 2000, 0, highOutput); + addGemChance(2500, 2000, highOutput); } else { addEmptyOutputs(1); } if (!chippedStack.isEmpty()) { addToOutputs(chippedStack); - addGemChance(3500, 0, 3000, 0, highOutput); + addGemChance(3500, 3000, highOutput); } else { addEmptyOutputs(1); } @@ -351,11 +351,11 @@ private void addChance(int base) { } // make the code less :weary: - private void addGemChance(int baseLow, int tierLow, int baseHigh, int tierHigh, boolean high) { + private void addGemChance(int baseLow, int baseHigh, boolean high) { if (high) { - addChance(baseHigh, tierHigh); + addChance(baseHigh); } else { - addChance(baseLow, tierLow); + addChance(baseLow); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java index bc63f722a91..4e7c7f68f6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java @@ -128,7 +128,7 @@ public void setRecipe(GTOreByProduct recipeWrapper) { Content chance = recipeWrapper.getChance(i / 2 + itemInputs.size()); IDrawable overlay = null; if (chance != null) { - overlay = new ContentOverlay(chance, false, 0, 0, null); + overlay = new ContentOverlay(chance, false); } if (itemOutputs.get(slotIndex).isEmpty()) { continue; From bc36ec105f5ad6763c9ee9e4b7a60d75eb664d54 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sun, 21 Jun 2026 13:25:28 -0500 Subject: [PATCH 10/28] spotl4ss --- .../recipeviewer/emi/recipe/GTEmiRecipe.java | 1 - .../recipeviewer/rei/recipe/GTRecipeDisplay.java | 1 - .../recipeviewer/widgets/GTOreByProduct.java | 10 +++++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java index f778a656923..0d29194f93d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeViewerWidget; import brachy.modularui.integration.emi.EmiStackConverter; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java index 3905ea32f92..b26a7406f6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeViewerWidget; import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java index ca04be0efa0..aa84d57fc9f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java @@ -269,23 +269,23 @@ public GTOreByProduct(Material material) { ItemStack chippedStack = ChemicalHelper.get(TagPrefix.gemChipped, material); addToOutputs(material, TagPrefix.gemExquisite, 1); - addGemChance(300, 500, highOutput); + addGemChance(300, 500, highOutput); addToOutputs(material, TagPrefix.gemFlawless, 1); addGemChance(1000, 1500, highOutput); addToOutputs(material, TagPrefix.gem, 1); - addGemChance(3500, 5000, highOutput); + addGemChance(3500, 5000, highOutput); addToOutputs(material, TagPrefix.dustPure, 1); - addGemChance(5000, 2500, highOutput); + addGemChance(5000, 2500, highOutput); if (!flawedStack.isEmpty()) { addToOutputs(flawedStack); - addGemChance(2500, 2000, highOutput); + addGemChance(2500, 2000, highOutput); } else { addEmptyOutputs(1); } if (!chippedStack.isEmpty()) { addToOutputs(chippedStack); - addGemChance(3500, 3000, highOutput); + addGemChance(3500, 3000, highOutput); } else { addEmptyOutputs(1); } From 2b228e7f50da88fe93891fd8dbf3f43579526a5b Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sun, 21 Jun 2026 18:39:31 -0500 Subject: [PATCH 11/28] don't need to do that calc --- .../integration/recipeviewer/rei/recipe/GTRecipeDisplay.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java index b26a7406f6f..2c3968db55e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/rei/recipe/GTRecipeDisplay.java @@ -82,8 +82,6 @@ public List getOutputEntries() { var fluids = recipe.getOutputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) itemContent.chance() / itemContent.maxChance(); - var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -92,8 +90,6 @@ public List getOutputEntries() { } for (var fluidContent : fluids) { - float chance = (float) fluidContent.chance() / fluidContent.maxChance(); - var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); var fluid = mapped.getStacks().get(0); From 70c6bfece02caf62512ebf236646e5f17fc09f23 Mon Sep 17 00:00:00 2001 From: Dilithium Thoride Date: Tue, 7 Oct 2025 16:52:30 -0500 Subject: [PATCH 12/28] preset for range prerolls (stolen from chance prerolls) --- .../gtceu/api/machine/trait/RecipeLogic.java | 20 ++++ .../gtceu/api/recipe/GTRecipe.java | 94 +++++++++++++++++++ .../gtceu/api/recipe/RecipeRunner.java | 20 +--- .../api/recipe/content/ContentModifier.java | 2 +- 4 files changed, 116 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index 500fdc6f2af..334d66d971b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -101,6 +101,10 @@ public enum Status implements StringRepresentable { @SaveField @SyncToClient protected GTRecipe lastRecipe; +// @Getter +// @SaveField +// @SyncToClient +// protected GTRecipe lastDisplayedRecipe = null; @Getter @SaveField @SyncToClient @@ -165,6 +169,7 @@ protected void onStatusSynced() { public void resetRecipeLogic() { recipeDirty = false; lastRecipe = null; +// lastDisplayedRecipe = null; lastOriginRecipe = null; consecutiveRecipes = 0; progress = 0; @@ -354,16 +359,19 @@ public void findAndHandleRecipe() { if (!recipeDirty && lastRecipe != null && checkRecipe(lastRecipe).isSuccess()) { GTRecipe recipe = lastRecipe; lastRecipe = null; +// lastDisplayedRecipe = null; lastOriginRecipe = null; setupRecipe(recipe); } else { // try to find and handle a new recipe failureReasonMap.clear(); lastRecipe = null; +// lastDisplayedRecipe = null; lastOriginRecipe = null; handleSearchingRecipes(searchRecipe()); } syncDataHolder.markClientSyncFieldDirty("lastRecipe"); +// syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); recipeDirty = false; } @@ -393,6 +401,8 @@ public ActionResult handleTickRecipe(GTRecipe recipe) { var result = RecipeHelper.matchTickRecipe(getRLMachine(), recipe); if (!result.isSuccess()) return result; + recipe.doTickPrerolls(this.chanceCaches); + result = handleTickRecipeIO(recipe, IO.IN); if (!result.isSuccess()) return result; @@ -410,6 +420,11 @@ public void setupRecipe(GTRecipe recipe) { syncDataHolder.resyncAllFields(); return; } + if (lastRecipe != null && !recipe.equals(lastRecipe)) { + chanceCaches.clear(); + } +// lastDisplayedRecipe = recipe.copy(); + recipe.doPrerolls(this.chanceCaches); var handledIO = handleRecipeIO(recipe, IO.IN); if (handledIO.isSuccess()) { if (lastRecipe != null && !recipe.equals(lastRecipe)) { @@ -424,6 +439,9 @@ public void setupRecipe(GTRecipe recipe) { isActive = true; syncDataHolder.resyncAllFields(); } +// else { +// lastDisplayedRecipe = null; +// } } public void setStatus(Status status) { @@ -541,6 +559,7 @@ public void onRecipeFinish() { isActive = false; // Force a recipe recheck. lastRecipe = null; +// lastDisplayedRecipe = null; syncDataHolder.resyncAllFields(); return; } @@ -552,6 +571,7 @@ public void onRecipeFinish() { } else { lastRecipe = modified; syncDataHolder.markClientSyncFieldDirty("lastRecipe"); +// syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); } } else { markLastRecipeDirty(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index 762e6e5c463..73d2564acf2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; @@ -22,6 +23,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.stream.Stream; import javax.annotation.ParametersAreNonnullByDefault; @@ -231,6 +233,98 @@ public ChanceLogic getChanceLogicForCapability(RecipeCapability cap, IO io, b return new EnergyStack(v, a); } + + + public void doPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { + // TODO: roll for chances, modify input/output maps +// var chancedContents = getFullContents() +// .map(Content::getContent) +// .map(Content.class::cast) +// .filter(Content::isChanced); + + var chancedInputMap = new HashMap, Content[]>(); + for (var entry : inputs.entrySet()) { + RecipeCapability cap = entry.getKey(); + if (!cap.doMatchInRecipe()) continue; + if (entry.getValue().isEmpty()) continue; + Content[] ingredients = new Content[entry.getValue().size()]; + int i=0; + for (var ingredient : entry.getValue()){ + if (ingredient.isChanced()){ + ingredients[i] = ingredient; + } + i++; + } + chancedInputMap.put(cap, ingredients); + } + var chancedOutputMap = new HashMap, Content[]>(); + for (var entry : inputs.entrySet()) { + RecipeCapability cap = entry.getKey(); + if (!cap.doMatchInRecipe()) continue; + if (entry.getValue().isEmpty()) continue; + Content[] ingredients = new Content[entry.getValue().size()]; + int i=0; + for (var ingredient : entry.getValue()){ + if (ingredient.isChanced()){ + ingredients[i] = ingredient; + } + i++; + } + chancedOutputMap.put(cap, ingredients); + } + + + prerollChances(chancedInputMap, chancedOutputMap, chanceCaches); + } + + public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches){ + // TODO: copy and roll tick chances, flatmap + var chancedTickContents = getFullTickContents() + .map(Content::getContent) + .map(Content.class::cast) + .filter(Content::isChanced) + .toList(); + + prerollTickChances(chancedTickContents); + } + + private void prerollChances(HashMap, Content[]> chancedInputMap, HashMap, Content[]> chancedOutputMap, IdentityHashMap, Object2IntMap> chanceCaches) { + + for (var entry: chancedInputMap.entrySet()){ + RecipeCapability cap = entry.getKey(); + ChanceLogic logic = this.getChanceLogicForCapability(cap, IO.IN, false); + // TODO: this also breaks, logic.roll() cannot have nulls + // TODO: examine AssemblyLineMachine.checkItemInputs() + var chancedContents = logic.roll(cap, List.of(entry.getValue()), chanceCaches.get(cap), this.getTotalRuns()); +// entry.setValue(chancedContents); //TODO: THIS BREAKS UNCHANCED OUTPUTS + } + for (var entry: chancedOutputMap.entrySet()){ + RecipeCapability cap = entry.getKey(); + ChanceLogic logic = this.getChanceLogicForCapability(cap, IO.OUT, false); + var chancedContents = logic.roll(cap, List.of(entry.getValue()), chanceCaches.get(cap), this.getTotalRuns()); +// entry.setValue(chancedContents); //TODO: THIS BREAKS UNCHANCED OUTPUTS + } + + } + + private void prerollTickChances(List chancedTickContents) { +// ChanceLogic logic = this.getChanceLogicForCapability(cap, this.io, true); + } + + public Stream getFullContents(){ + return Stream.concat( + inputs.values().stream(), + outputs.values().stream()) + .flatMap(List::stream); + } + + public Stream getFullTickContents(){ + return Stream.concat( + tickInputs.values().stream(), + tickOutputs.values().stream()) + .flatMap(List::stream); + } + public int getTotalRuns() { return parallels * subtickParallels * batchParallels; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java index 0bc6050ace0..4d6d70079f3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java @@ -7,7 +7,6 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupColor; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; @@ -73,9 +72,6 @@ public ActionResult handle(Map, List> entries) { * Populates the content match list to know if conditions are satisfied. */ private void fillContentMatchList(Map, List> entries) { - ChanceBoostFunction function = recipe.getType().getChanceFunction(); - int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); - int chanceTier = recipeTier + recipe.ocLevel; for (var entry : entries.entrySet()) { RecipeCapability cap = entry.getKey(); if (!cap.doMatchInRecipe()) continue; @@ -95,21 +91,7 @@ private void fillContentMatchList(Map, List> entrie // searchRecipeContents == recipeContents, so all contents, chanced and unchanced, must match if (simulated) continue; - if (cont.chance() >= cont.maxChance()) { - contentList.add(cont.content()); - } else if (cont.chance() > 0 || cont.tierChanceBoost() > 0) { - chancedContents.add(cont); - } - // Do not add Non-Consumed ingredients; they'd just get dropped after the chance roll anyway - } - - // add chanced contents to the recipe content map - if (!chancedContents.isEmpty()) { - var cache = this.chanceCaches.get(cap); - chancedContents = logic.roll(cap, chancedContents, function, recipeTier, chanceTier, cache, - recipe.getTotalRuns()); - - for (Content cont : chancedContents) { + if (cont.chance() > 0) { contentList.add(cont.content()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java index 3ec1fb025fe..01003c75221 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java @@ -42,7 +42,7 @@ public double apply(double number) { * @return A new Content map that is the modified version of the argument */ public Map, List> applyContents(Map, List> contents) { - if (this == IDENTITY) return new HashMap<>(contents); +// if (this == IDENTITY) return new HashMap<>(contents); Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var contentList = entry.getValue(); From f39763f58653224d8f5fcedffe6ae3ddbb933344 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sun, 28 Jun 2026 14:32:05 -0500 Subject: [PATCH 13/28] Do Ranged Prerolls --- .../gtceu/api/recipe/GTRecipe.java | 76 +++---------------- 1 file changed, 10 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index 73d2564acf2..33079087af9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; +import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import it.unimi.dsi.fastutil.objects.Object2IntMap; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.RegistryAccess; @@ -236,80 +237,23 @@ public ChanceLogic getChanceLogicForCapability(RecipeCapability cap, IO io, b public void doPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { - // TODO: roll for chances, modify input/output maps -// var chancedContents = getFullContents() -// .map(Content::getContent) -// .map(Content.class::cast) -// .filter(Content::isChanced); - - var chancedInputMap = new HashMap, Content[]>(); - for (var entry : inputs.entrySet()) { - RecipeCapability cap = entry.getKey(); - if (!cap.doMatchInRecipe()) continue; - if (entry.getValue().isEmpty()) continue; - Content[] ingredients = new Content[entry.getValue().size()]; - int i=0; - for (var ingredient : entry.getValue()){ - if (ingredient.isChanced()){ - ingredients[i] = ingredient; - } - i++; - } - chancedInputMap.put(cap, ingredients); - } - var chancedOutputMap = new HashMap, Content[]>(); - for (var entry : inputs.entrySet()) { - RecipeCapability cap = entry.getKey(); - if (!cap.doMatchInRecipe()) continue; - if (entry.getValue().isEmpty()) continue; - Content[] ingredients = new Content[entry.getValue().size()]; - int i=0; - for (var ingredient : entry.getValue()){ - if (ingredient.isChanced()){ - ingredients[i] = ingredient; - } - i++; - } - chancedOutputMap.put(cap, ingredients); + var rangedContents = getFullContents() + .filter(i -> i.content() instanceof IRangedIngredient) + .toList(); + for (var item : rangedContents){ + ((IRangedIngredient) item.content()).rollSampledCount(); } - - - prerollChances(chancedInputMap, chancedOutputMap, chanceCaches); } public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches){ - // TODO: copy and roll tick chances, flatmap - var chancedTickContents = getFullTickContents() - .map(Content::getContent) - .map(Content.class::cast) - .filter(Content::isChanced) + var rangedContents = getFullTickContents() + .filter(i -> i.content() instanceof IRangedIngredient) .toList(); - - prerollTickChances(chancedTickContents); - } - - private void prerollChances(HashMap, Content[]> chancedInputMap, HashMap, Content[]> chancedOutputMap, IdentityHashMap, Object2IntMap> chanceCaches) { - - for (var entry: chancedInputMap.entrySet()){ - RecipeCapability cap = entry.getKey(); - ChanceLogic logic = this.getChanceLogicForCapability(cap, IO.IN, false); - // TODO: this also breaks, logic.roll() cannot have nulls - // TODO: examine AssemblyLineMachine.checkItemInputs() - var chancedContents = logic.roll(cap, List.of(entry.getValue()), chanceCaches.get(cap), this.getTotalRuns()); -// entry.setValue(chancedContents); //TODO: THIS BREAKS UNCHANCED OUTPUTS + for (var item : rangedContents){ + ((IRangedIngredient) item.content()).rollSampledCount(); } - for (var entry: chancedOutputMap.entrySet()){ - RecipeCapability cap = entry.getKey(); - ChanceLogic logic = this.getChanceLogicForCapability(cap, IO.OUT, false); - var chancedContents = logic.roll(cap, List.of(entry.getValue()), chanceCaches.get(cap), this.getTotalRuns()); -// entry.setValue(chancedContents); //TODO: THIS BREAKS UNCHANCED OUTPUTS - } - } - private void prerollTickChances(List chancedTickContents) { -// ChanceLogic logic = this.getChanceLogicForCapability(cap, this.io, true); - } public Stream getFullContents(){ return Stream.concat( From 978975231cf4a6751eaa611e4de74c7523857832 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sun, 28 Jun 2026 16:55:33 -0500 Subject: [PATCH 14/28] Convert IPFI to use getAmount() --- .../recipe/FluidRecipeCapability.java | 4 +- .../machine/trait/NotifiableFluidTank.java | 13 ++---- .../gtceu/api/recipe/RecipeHelper.java | 3 +- .../recipe/ingredient/FluidIngredient.java | 2 +- .../IntProviderFluidIngredient.java | 42 +++++++++++-------- .../fluid/FluidStackMapIngredient.java | 6 +-- .../electric/AssemblyLineMachine.java | 4 +- .../electric/DistillationTowerMachine.java | 3 +- .../ae2/machine/MEOutputHatchPartMachine.java | 9 +--- .../recipe/components/GTRecipeComponents.java | 3 +- 10 files changed, 36 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java index 1db210ce895..7754859593a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java @@ -179,9 +179,7 @@ public int getMaxParallelByInput(IRecipeCapabilityHolder holder, GTRecipe recipe for (Content content : inputs) { FluidIngredient ing = of(content.content()); - int amount; - if (ing instanceof IRangedIngredient provider) amount = provider.getMaxRoll(); - else amount = ing.getAmount(); + int amount = ing.getAmount(); if (content.chance() == 0) { nonConsumables.addTo(ing, amount); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java index ea748777afe..9fcb35f6b95 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java @@ -118,16 +118,9 @@ public void onContentsChanged() { FluidStack[] fluids; - if (ingredient instanceof IntProviderFluidIngredient provider) { - provider.setFluidStacks(null); - provider.setSampledCount(-1); - - if (simulate) { - fluids = new FluidStack[] { provider.getMaxSizeStack() }; - } else { - fluids = provider.getStacks(); - } - } else { + if (ingredient instanceof IntProviderFluidIngredient provider && simulate) { + fluids = new FluidStack[]{provider.getMaxSizeStack()}; + }else{ fluids = ingredient.getStacks(); } if (fluids.length == 0 || fluids[0].isEmpty()) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java index b8ebc067ba1..6736fba06d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java @@ -401,7 +401,6 @@ public static int getRatioForDistillery(FluidIngredient fluidInput, FluidIngredi } public static boolean isFluidStackDivisibleForDistillery(FluidIngredient fluidStack, int divisor) { - int amount = (fluidStack instanceof IRangedIngredient ranged ? ranged.getMaxRoll() : fluidStack.getAmount()); - return amount % divisor == 0 && amount / divisor >= 25; + return fluidStack.getAmount() % divisor == 0 && fluidStack.getAmount() / divisor >= 25; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java index bda901a7aa2..450c1d74544 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java @@ -38,7 +38,7 @@ public class FluidIngredient implements Predicate { @Nullable public FluidStack[] stacks; @Getter - protected int amount; + private int amount; @Getter protected CompoundTag nbt; protected boolean changed = true; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index 4620784369a..74347217705 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -40,7 +40,6 @@ public class IntProviderFluidIngredient extends FluidIngredient implements IRang * The last result of {@link IntProviderFluidIngredient#getSampledCount()}. -1 if not rolled. */ @Getter - @Setter protected int sampledCount = -1; /** * The {@link FluidIngredient} to have a ranged amount. @@ -51,39 +50,41 @@ public class IntProviderFluidIngredient extends FluidIngredient implements IRang protected FluidStack[] fluidStacks = null; protected IntProviderFluidIngredient(FluidIngredient inner, IntProvider provider) { - super(inner.values, provider.getMaxValue(), null); + super(inner.values, provider.getMaxValue(), inner.nbt); this.inner = inner; this.countProvider = provider; + setAmount(provider.getMaxValue()); } protected IntProviderFluidIngredient(FluidIngredient inner, IntProvider provider, int sampledCount) { - super(inner.values, provider.getMaxValue(), null); + super(inner.values, provider.getMaxValue(), inner.nbt); this.inner = inner; this.countProvider = provider; this.sampledCount = sampledCount; + setAmount(isRolled() ? sampledCount : provider.getMaxValue()); } @Override public IntProviderFluidIngredient copy() { IntProviderFluidIngredient ipfi = new IntProviderFluidIngredient(this.inner, this.countProvider); ipfi.setSampledCount(this.sampledCount); + ipfi.setAmount(this.getAmount()); return ipfi; } /** - * An {@link IntProviderFluidIngredient} does not have an amount. - * You probably want either {@link IntProviderFluidIngredient#getStacks()} or - * {@link IntProviderFluidIngredient#getMaxSizeStack()}. + * this override only exists for debugging and will be removed. */ @Deprecated @Override public int getAmount() { - if (ConfigHolder.INSTANCE.dev.debug) { - throw new IllegalCallerException("An IPFI should never have getAmount() called on it!"); - } - return -1; + return super.getAmount(); } + @Override + public boolean isEmpty(){ + return (this.getAmount() == 0); + } /** * Gets a usable {@link FluidStack FluidStack[]} from this {@link IntProviderFluidIngredient}. * If this ingredient has not yet had its {@link IntProviderFluidIngredient#sampledCount} rolled, rolls it. @@ -129,8 +130,9 @@ public FluidStack[] getStacks() { * @return the amount rolled */ public int rollSampledCount(@NotNull RandomSource random) { - if (sampledCount == -1) { + if (!isRolled()) { sampledCount = countProvider.sample(random); + this.setAmount(sampledCount); } return sampledCount; } @@ -142,19 +144,23 @@ public double getMidRoll() { return ((countProvider.getMaxValue() + countProvider.getMinValue()) / 2.0); } - @Override - public boolean isEmpty() { - return inner.isEmpty(); - } - /** * Resets the random roll on this ingredient */ public void reset() { sampledCount = -1; + super.setAmount(getMaxRoll()); fluidStacks = null; } + /** + * Also sets the Amount of this ingredient + */ + public void setSampledCount(int count){ + this.sampledCount = count; + super.setAmount(count); + } + /** * @param inner {@link FluidIngredient} * @param provider usually as {@link UniformInt#of(int, int)} @@ -201,11 +207,11 @@ public static IntProviderFluidIngredient fromJson(JsonElement json) { throw new JsonSyntaxException("Fluid ingredient cannot be null"); } JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "ingredient"); - IntProvider amount = IntProvider.CODEC.parse(JsonOps.INSTANCE, jsonObject.get("count_provider")) + IntProvider provider = IntProvider.CODEC.parse(JsonOps.INSTANCE, jsonObject.get("count_provider")) .getOrThrow(false, GTCEu.LOGGER::error); int sampledCount = jsonObject.getAsJsonPrimitive("sampledCount").getAsInt(); FluidIngredient inner = FluidIngredient.fromJson(jsonObject.get("inner")); - return new IntProviderFluidIngredient(inner, amount, sampledCount); + return new IntProviderFluidIngredient(inner, provider, sampledCount); } public CompoundTag toNBT() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java index 5314097c110..8bd5c711757 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java @@ -31,11 +31,7 @@ public static List from(@NotNull FluidIngredient ingredie List ingredients = new ObjectArrayList<>(); for (FluidIngredient.Value value : ingredient.values) { if (value instanceof FluidIngredient.FluidValue fluidValue) { - FluidStack stack = new FluidStack(fluidValue.fluid(), - (ingredient instanceof IRangedIngredient provider ? - provider.getMaxRoll() : - ingredient.getAmount()), - ingredient.getNbt()); + FluidStack stack = new FluidStack(fluidValue.fluid(), ingredient.getAmount(), ingredient.getNbt()); ingredients.add(new FluidStackMapIngredient(stack, ingredient)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java index 23748c9bec8..76bfc7824e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java @@ -153,9 +153,7 @@ private boolean checkFluidInputs(GTRecipe recipe, boolean isTick) { for (int i = 0; i < inputsSize; i++) { var fluidStack = fluidInventory.get(i); FluidIngredient recipeStack = FluidRecipeCapability.CAP.of(fluidInputs.get(i).content()); - if (!recipeStack.test(fluidStack) || - (recipeStack instanceof IRangedIngredient ? ((IRangedIngredient) recipeStack).getMaxRoll() : - recipeStack.getAmount()) > fluidStack.getAmount()) { + if (!recipeStack.test(fluidStack) || (recipeStack.getAmount()) > fluidStack.getAmount()) { return false; } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java index 355f0084e1a..ef2b78e691c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java @@ -13,6 +13,7 @@ import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; +import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic; import com.gregtechceu.gtceu.api.sync_system.annotations.SaveField; @@ -141,7 +142,7 @@ public int limitFluidParallel(GTRecipe recipe, int multiplier, boolean tick) { .map(Content::content) .map(FluidRecipeCapability.CAP::of) .filter(i -> !i.isEmpty()) - .mapToInt((i -> i instanceof IRangedIngredient ? ((IRangedIngredient) i).getMaxRoll() : i.getAmount())) + .mapToInt(FluidIngredient::getAmount) .max() .orElse(0); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java index 5b6cd1339e4..01e36e193ed 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java @@ -196,15 +196,8 @@ public boolean isFluidValid(int tank, FluidStack stack) { } FluidStack[] fluids; - if (ingredient instanceof IntProviderFluidIngredient provider) { - provider.setFluidStacks(null); - provider.setSampledCount(-1); - - if (simulate) { + if (ingredient instanceof IntProviderFluidIngredient provider && simulate) { fluids = new FluidStack[] { provider.getMaxSizeStack() }; - } else { - fluids = provider.getStacks(); - } } else { fluids = ingredient.getStacks(); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java index 1f3aa7b27da..edf46ddd066 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java @@ -401,8 +401,7 @@ public FluidIngredientJS(Fluid fluid, int amount, @Nullable CompoundTag nbt) { @Override public long kjs$getAmount() { - return (ingredient instanceof IRangedIngredient ? ((IRangedIngredient) ingredient).getMaxRoll() : - ingredient.getAmount()); + return ingredient.getAmount(); } @Override From 646a6231c47ab1352877a37726c27d41e337ff06 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sun, 28 Jun 2026 17:55:54 -0500 Subject: [PATCH 15/28] change external references to lastDisplayedRecipe --- .../trait/RecipeAmperageEnergyContainer.java | 4 +-- .../gtceu/api/machine/trait/RecipeLogic.java | 32 +++++++++---------- .../api/recipe/content/ContentModifier.java | 3 +- .../machine/impl/FluidAreaRender.java | 2 +- .../machine/impl/GrowingPlantRender.java | 2 +- .../behavior/PortableScannerBehavior.java | 2 +- .../electric/FusionReactorMachine.java | 2 +- .../LargeCombustionEngineMachine.java | 2 +- .../generator/LargeTurbineMachine.java | 4 +-- .../steam/SteamSolidBoilerMachine.java | 4 +-- .../common/mui/GTMultiblockTextUtil.java | 18 +++++------ .../jade/provider/ParallelProvider.java | 8 ++--- .../jade/provider/RecipeLogicProvider.java | 2 +- .../jade/provider/RecipeOutputProvider.java | 4 +-- 14 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeAmperageEnergyContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeAmperageEnergyContainer.java index a4f51d271c6..e07b406dd16 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeAmperageEnergyContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeAmperageEnergyContainer.java @@ -31,7 +31,7 @@ protected List> validMachineClasses() { public long getInputAmperage() { var recipeLogic = getMachine().getTrait(RecipeLogic.TYPE); if (recipeLogic == null) return 0; - var lastRecipe = recipeLogic.getLastRecipe(); + var lastRecipe = recipeLogic.getLastDisplayedRecipe(); long amperage; if (lastRecipe != null) { amperage = lastRecipe.getInputEUt().amperage(); @@ -49,7 +49,7 @@ public long getInputAmperage() { public long getOutputAmperage() { var recipeLogic = getMachine().getTrait(RecipeLogic.TYPE); if (recipeLogic == null) return 0; - var lastRecipe = recipeLogic.getLastRecipe(); + var lastRecipe = recipeLogic.getLastDisplayedRecipe(); if (lastRecipe != null) { return lastRecipe.getOutputEUt().amperage(); } else { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index 334d66d971b..5d84ba58256 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -99,12 +99,12 @@ public enum Status implements StringRepresentable { @Nullable @Getter @SaveField - @SyncToClient protected GTRecipe lastRecipe; -// @Getter -// @SaveField -// @SyncToClient -// protected GTRecipe lastDisplayedRecipe = null; + @Nullable + @Getter + @SaveField + @SyncToClient + protected GTRecipe lastDisplayedRecipe; @Getter @SaveField @SyncToClient @@ -169,7 +169,7 @@ protected void onStatusSynced() { public void resetRecipeLogic() { recipeDirty = false; lastRecipe = null; -// lastDisplayedRecipe = null; + lastDisplayedRecipe = null; lastOriginRecipe = null; consecutiveRecipes = 0; progress = 0; @@ -359,19 +359,18 @@ public void findAndHandleRecipe() { if (!recipeDirty && lastRecipe != null && checkRecipe(lastRecipe).isSuccess()) { GTRecipe recipe = lastRecipe; lastRecipe = null; -// lastDisplayedRecipe = null; + lastDisplayedRecipe = null; lastOriginRecipe = null; setupRecipe(recipe); } else { // try to find and handle a new recipe failureReasonMap.clear(); lastRecipe = null; -// lastDisplayedRecipe = null; + lastDisplayedRecipe = null; lastOriginRecipe = null; handleSearchingRecipes(searchRecipe()); } - syncDataHolder.markClientSyncFieldDirty("lastRecipe"); -// syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); + syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); recipeDirty = false; } @@ -423,7 +422,8 @@ public void setupRecipe(GTRecipe recipe) { if (lastRecipe != null && !recipe.equals(lastRecipe)) { chanceCaches.clear(); } -// lastDisplayedRecipe = recipe.copy(); + lastDisplayedRecipe = recipe.copy(); + syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); recipe.doPrerolls(this.chanceCaches); var handledIO = handleRecipeIO(recipe, IO.IN); if (handledIO.isSuccess()) { @@ -439,9 +439,9 @@ public void setupRecipe(GTRecipe recipe) { isActive = true; syncDataHolder.resyncAllFields(); } -// else { -// lastDisplayedRecipe = null; -// } + else { + lastDisplayedRecipe = null; + } } public void setStatus(Status status) { @@ -559,7 +559,7 @@ public void onRecipeFinish() { isActive = false; // Force a recipe recheck. lastRecipe = null; -// lastDisplayedRecipe = null; + lastDisplayedRecipe = null; syncDataHolder.resyncAllFields(); return; } @@ -570,8 +570,6 @@ public void onRecipeFinish() { markLastRecipeDirty(); } else { lastRecipe = modified; - syncDataHolder.markClientSyncFieldDirty("lastRecipe"); -// syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); } } else { markLastRecipeDirty(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java index 01003c75221..614d2eba0c2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java @@ -42,7 +42,8 @@ public double apply(double number) { * @return A new Content map that is the modified version of the argument */ public Map, List> applyContents(Map, List> contents) { -// if (this == IDENTITY) return new HashMap<>(contents); + // Prerolls require copying, even on IDENTITY + // if (this == IDENTITY) return new HashMap<>(contents); Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var contentList = entry.getValue(); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java index c1e5c2d5adf..db0883cc0aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java @@ -92,7 +92,7 @@ public void render(WorkableMultiblockMachine machine, float partialTick, if (trait == null || !machine.isFormed() || trait.getFluidOffsets().isEmpty()) return; if (!fixedFluid) { - var lastRecipe = machine.getRecipeLogic().getLastRecipe(); + var lastRecipe = machine.getRecipeLogic().getLastDisplayedRecipe(); if (lastRecipe == null) { cachedRecipe = null; cachedFluid = null; diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java index ef13449fab6..f1e554f4c66 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java @@ -112,7 +112,7 @@ public void render(IRecipeLogicMachine rlm, float partialTick, PoseStack poseSta final RecipeLogic recipeLogic = rlm.getRecipeLogic(); Optional currentBlock = this.growingBlock - .or(() -> Optional.ofNullable(recipeLogic.getLastRecipe()).flatMap(this::findGrowing)); + .or(() -> Optional.ofNullable(recipeLogic.getLastDisplayedRecipe()).flatMap(this::findGrowing)); if (currentBlock.isEmpty()) return; Block growing = currentBlock.get(); BlockState state = growing.defaultBlockState(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java index 4eb6b6066e7..eac730643c2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java @@ -320,7 +320,7 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode // Recipe logic for EU production/consumption RecipeLogic recipeLogic = machine.getTrait(RecipeLogic.TYPE); if (recipeLogic != null) { - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); if (recipeLogic.getStatus().equals(RecipeLogic.Status.WAITING)) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("gtceu.multiblock.waiting")); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java index 31517e494e4..fbde9285058 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java @@ -200,7 +200,7 @@ public static ModifierFunction recipeModifier(MetaMachine machine, GTRecipe reci @Override public boolean onWorking() { - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); assert recipe != null; if (recipe.data.contains("eu_to_start")) { long heatDiff = recipe.data.getLong("eu_to_start") - this.heat; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java index 8a66b859aaf..21c18988a3a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java @@ -204,7 +204,7 @@ public boolean regressWhenWaiting() { @Nullable public String getRecipeFluidInputInfo() { // Previous Recipe is always null on first world load, so try to acquire a new recipe - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); if (recipe == null) { Iterator iterator = recipeLogic.searchRecipe(); recipe = iterator.hasNext() ? iterator.next() : null; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java index 8ebc5901ea6..28e855c767d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java @@ -101,8 +101,8 @@ public int getTotalEfficiency() { } public long getCurrentProduction() { - return isActive() && recipeLogic.getLastRecipe() != null ? - recipeLogic.getLastRecipe().getOutputEUt().voltage() : 0; + return isActive() && recipeLogic.getLastDisplayedRecipe() != null ? + recipeLogic.getLastDisplayedRecipe().getOutputEUt().voltage() : 0; } public int getRotorDurabilityPercent() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java index b7ea4f2f473..d5b3b3031fc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java @@ -81,8 +81,8 @@ protected long getBaseSteamOutput() { @Override public void afterWorking() { super.afterWorking(); - if (recipeLogic.getLastRecipe() != null) { - var inputs = recipeLogic.getLastRecipe().inputs.getOrDefault(ItemRecipeCapability.CAP, + if (recipeLogic.getLastDisplayedRecipe() != null) { + var inputs = recipeLogic.getLastDisplayedRecipe().inputs.getOrDefault(ItemRecipeCapability.CAP, Collections.emptyList()); if (!inputs.isEmpty()) { var input = ItemRecipeCapability.CAP.of(inputs.get(0).content()).getItems(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java index 786ef45f6c0..5460b77e7ae 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java @@ -256,8 +256,8 @@ public static TextWidget addEnergyTierLine(WorkableElectricMultiblockMachine public static TextWidget addParallelLine(WorkableMultiblockMachine rlMachine, PanelSyncManager syncManager) { IntSyncValue parallelAmount = syncManager.getOrCreateSyncHandler("parallelAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().parallels; + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().parallels; })); return Text.dynamic(() -> { @@ -275,8 +275,8 @@ public static TextWidget addBatchModeLine(WorkableMultiblockMachine rlMachine () -> new BooleanSyncValue(rlMachine::isBatchEnabled)); IntSyncValue batchAmount = syncManager.getOrCreateSyncHandler("batchAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().batchParallels; + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().batchParallels; })); return Text.dynamic(() -> { @@ -293,8 +293,8 @@ public static TextWidget addSubtickParallelsLine(WorkableMultiblockMachine rl PanelSyncManager syncManager) { IntSyncValue subtickAmount = syncManager.getOrCreateSyncHandler("subtickAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().subtickParallels; + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().subtickParallels; })); return Text.dynamic(() -> { @@ -310,8 +310,8 @@ public static TextWidget addSubtickParallelsLine(WorkableMultiblockMachine rl public static TextWidget addTotalRunsLine(WorkableMultiblockMachine rlMachine, PanelSyncManager syncManager) { IntSyncValue totalRunAmount = syncManager.getOrCreateSyncHandler("totalRunAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().getTotalRuns(); + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().getTotalRuns(); })); return Text.dynamic(() -> { @@ -399,7 +399,7 @@ public static DynamicWidget addOutputLines(WorkableMultiblockMachine rlmachin "GTRecipe", GenericSyncValue.class, () -> GenericSyncValue.builder(GTRecipe.class) - .getter(() -> rlmachine.getRecipeLogic().getLastRecipe()) + .getter(() -> rlmachine.getRecipeLogic().getLastDisplayedRecipe()) .setter((newRecipe) -> {}) .adapter(GTByteBufAdapters.GTRECIPE) .copy(GTRecipe::copy) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java index 63ecc9a3358..2fac0cb9e37 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java @@ -31,10 +31,10 @@ protected CompoundTag write(MetaMachine machine) { } else if (machine instanceof MultiblockControllerMachine controller) { if (controller instanceof IRecipeLogicMachine rlm && rlm.getRecipeLogic().isActive() && - rlm.getRecipeLogic().getLastRecipe() != null) { - compoundTag.putInt("parallel", rlm.getRecipeLogic().getLastRecipe().parallels); - compoundTag.putInt("batch", rlm.getRecipeLogic().getLastRecipe().batchParallels); - compoundTag.putInt("subtickParallel", rlm.getRecipeLogic().getLastRecipe().subtickParallels); + rlm.getRecipeLogic().getLastDisplayedRecipe() != null) { + compoundTag.putInt("parallel", rlm.getRecipeLogic().getLastDisplayedRecipe().parallels); + compoundTag.putInt("batch", rlm.getRecipeLogic().getLastDisplayedRecipe().batchParallels); + compoundTag.putInt("subtickParallel", rlm.getRecipeLogic().getLastDisplayedRecipe().subtickParallels); compoundTag.putBoolean("exact", true); } else { controller.getParallelHatch() diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java index 0868ace35ac..2ba708b77ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java @@ -37,7 +37,7 @@ protected CompoundTag write(RecipeLogic capability) { var data = new CompoundTag(); data.putBoolean("Working", capability.isWorking()); var recipeInfo = new CompoundTag(); - var recipe = capability.getLastRecipe(); + var recipe = capability.getLastDisplayedRecipe(); if (recipe != null) { var EUt = RecipeHelper.getRealEUtWithIO(recipe); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java index 82be11a07ae..47e5f84c800 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java @@ -54,10 +54,8 @@ protected CompoundTag write(RecipeLogic recipeLogic) { CompoundTag data = new CompoundTag(); if (recipeLogic.isWorking()) { data.putBoolean("Working", recipeLogic.isWorking()); - var recipe = recipeLogic.getLastRecipe(); + var recipe = recipeLogic.getLastDisplayedRecipe(); if (recipe != null) { - int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); - int chanceTier = recipeTier + recipe.ocLevel; var itemContents = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidContents = recipe.getOutputContents(FluidRecipeCapability.CAP); int runs = recipe.getTotalRuns(); From 1ac7acb1c8ac05413f1227684401427f60a6b5cb Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Mon, 29 Jun 2026 20:21:14 -0500 Subject: [PATCH 16/28] changed --- .../api/recipe/ingredient/IntProviderFluidIngredient.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index 74347217705..566047b7868 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -93,7 +93,7 @@ public boolean isEmpty(){ */ @Override public FluidStack[] getStacks() { - if (fluidStacks == null) { + if (changed || fluidStacks == null) { int cachedAmount = rollSampledCount(GTValues.RNG); if (cachedAmount == 0) { return EMPTY_STACK_ARRAY; @@ -104,6 +104,7 @@ public FluidStack[] getStacks() { fluidStacks[i] = innerStacks[i].copy(); fluidStacks[i].setAmount(cachedAmount); } + changed = false; } return fluidStacks; } @@ -134,7 +135,7 @@ public int rollSampledCount(@NotNull RandomSource random) { sampledCount = countProvider.sample(random); this.setAmount(sampledCount); } - return sampledCount; + return getAmount(); } /** From 1a387ab19e95c2601b06c88237b733a27f2a35cf Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Mon, 29 Jun 2026 20:22:31 -0500 Subject: [PATCH 17/28] spotless --- .../machine/trait/NotifiableFluidTank.java | 4 +-- .../gtceu/api/machine/trait/RecipeLogic.java | 3 +-- .../gtceu/api/recipe/GTRecipe.java | 25 ++++++++----------- .../gtceu/api/recipe/RecipeHelper.java | 1 - .../api/recipe/content/ContentModifier.java | 2 +- .../IntProviderFluidIngredient.java | 6 ++--- .../fluid/FluidStackMapIngredient.java | 1 - .../electric/AssemblyLineMachine.java | 1 - .../electric/DistillationTowerMachine.java | 1 - .../ae2/machine/MEOutputHatchPartMachine.java | 2 +- .../jade/provider/RecipeOutputProvider.java | 1 - .../recipe/components/GTRecipeComponents.java | 1 - 12 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java index 9fcb35f6b95..d99dec635e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java @@ -119,8 +119,8 @@ public void onContentsChanged() { FluidStack[] fluids; if (ingredient instanceof IntProviderFluidIngredient provider && simulate) { - fluids = new FluidStack[]{provider.getMaxSizeStack()}; - }else{ + fluids = new FluidStack[] { provider.getMaxSizeStack() }; + } else { fluids = ingredient.getStacks(); } if (fluids.length == 0 || fluids[0].isEmpty()) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index 5d84ba58256..ba498a83020 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -438,8 +438,7 @@ public void setupRecipe(GTRecipe recipe) { duration = recipe.duration; isActive = true; syncDataHolder.resyncAllFields(); - } - else { + } else { lastDisplayedRecipe = null; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index 33079087af9..62ba4865ff5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -6,9 +6,8 @@ import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; - import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; @@ -18,6 +17,7 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.Level; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; @@ -234,38 +234,35 @@ public ChanceLogic getChanceLogicForCapability(RecipeCapability cap, IO io, b return new EnergyStack(v, a); } - - public void doPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { var rangedContents = getFullContents() .filter(i -> i.content() instanceof IRangedIngredient) .toList(); - for (var item : rangedContents){ + for (var item : rangedContents) { ((IRangedIngredient) item.content()).rollSampledCount(); } } - public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches){ + public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { var rangedContents = getFullTickContents() .filter(i -> i.content() instanceof IRangedIngredient) .toList(); - for (var item : rangedContents){ + for (var item : rangedContents) { ((IRangedIngredient) item.content()).rollSampledCount(); } } - - public Stream getFullContents(){ + public Stream getFullContents() { return Stream.concat( - inputs.values().stream(), - outputs.values().stream()) + inputs.values().stream(), + outputs.values().stream()) .flatMap(List::stream); } - public Stream getFullTickContents(){ + public Stream getFullTickContents() { return Stream.concat( - tickInputs.values().stream(), - tickOutputs.values().stream()) + tickInputs.values().stream(), + tickOutputs.values().stream()) .flatMap(List::stream); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java index 6736fba06d7..1648ecf4537 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java @@ -11,7 +11,6 @@ import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java index 614d2eba0c2..25a5cc66397 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java @@ -43,7 +43,7 @@ public double apply(double number) { */ public Map, List> applyContents(Map, List> contents) { // Prerolls require copying, even on IDENTITY - // if (this == IDENTITY) return new HashMap<>(contents); + // if (this == IDENTITY) return new HashMap<>(contents); Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var contentList = entry.getValue(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index 566047b7868..a0288181539 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.config.ConfigHolder; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; @@ -82,9 +81,10 @@ public int getAmount() { } @Override - public boolean isEmpty(){ + public boolean isEmpty() { return (this.getAmount() == 0); } + /** * Gets a usable {@link FluidStack FluidStack[]} from this {@link IntProviderFluidIngredient}. * If this ingredient has not yet had its {@link IntProviderFluidIngredient#sampledCount} rolled, rolls it. @@ -157,7 +157,7 @@ public void reset() { /** * Also sets the Amount of this ingredient */ - public void setSampledCount(int count){ + public void setSampledCount(int count) { this.sampledCount = count; super.setAmount(count); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java index 8bd5c711757..49c18543a8c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/ingredient/fluid/FluidStackMapIngredient.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.lookup.ingredient.fluid; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import com.gregtechceu.gtceu.api.recipe.lookup.ingredient.AbstractMapIngredient; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java index 76bfc7824e6..b652cf42cea 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineMachine.java @@ -18,7 +18,6 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import com.gregtechceu.gtceu.api.sync_system.annotations.SaveField; import com.gregtechceu.gtceu.config.ConfigHolder; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java index ef2b78e691c..19e6c5ebeba 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/DistillationTowerMachine.java @@ -14,7 +14,6 @@ import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic; import com.gregtechceu.gtceu.api.sync_system.annotations.SaveField; import com.gregtechceu.gtceu.api.sync_system.annotations.SyncToClient; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java index 01e36e193ed..27b5edbb546 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java @@ -197,7 +197,7 @@ public boolean isFluidValid(int tank, FluidStack stack) { FluidStack[] fluids; if (ingredient instanceof IntProviderFluidIngredient provider && simulate) { - fluids = new FluidStack[] { provider.getMaxSizeStack() }; + fluids = new FluidStack[] { provider.getMaxSizeStack() }; } else { fluids = ingredient.getStacks(); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java index 47e5f84c800..a2fc40e811e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java @@ -4,7 +4,6 @@ import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IntProviderFluidIngredient; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java index edf46ddd066..474708c1fc3 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java @@ -8,7 +8,6 @@ import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IntProviderFluidIngredient; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeCapabilities; From db5f5370c5b770f5e8c32b995ec6fff7498fb8ee Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Mon, 29 Jun 2026 21:19:12 -0500 Subject: [PATCH 18/28] add .getAmount() to IRangedIngredient --- .../gtceu/api/recipe/ingredient/IRangedIngredient.java | 2 ++ .../gtceu/api/recipe/ingredient/IntProviderIngredient.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java index 707f63186a3..5f3575731bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java @@ -28,6 +28,8 @@ default int rollSampledCount() { int rollSampledCount(@NotNull RandomSource random); + int getAmount(); + /** * @return the average roll of this ranged amount */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java index f2731e6217e..b71f104b10d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java @@ -113,6 +113,11 @@ public boolean test(@Nullable ItemStack stack) { return itemStacks; } + public int getAmount(){ + if (!isRolled()) return getMaxRoll(); + else return (getItems().length!=0 ? getItems()[0].getCount() : 0); + } + /** * Gets a {@link ItemStack} containing the maximum possible output from this {@link IntProviderIngredient}. * Mainly used for things like Recipe provider simulations to see if there is enough inventory space to handle From a4de2e3bf91ddfd64651e2782dffd2b94dc90c14 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Mon, 29 Jun 2026 21:19:23 -0500 Subject: [PATCH 19/28] singleblock test for prerolls --- .../recipe/ItemRecipeCapability.java | 2 +- .../trait/NotifiableItemStackHandler.java | 3 - .../IntProviderFluidIngredientTest.java | 178 ++++++++++++------ .../ingredient/IntProviderIngredientTest.java | 169 +++++++++++------ 4 files changed, 231 insertions(+), 121 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index 41e6c0ca736..e029396dffc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -204,7 +204,7 @@ public int getMaxParallelByInput(IRecipeCapabilityHolder holder, GTRecipe recipe int count; if (ing instanceof SizedIngredient sized) count = sized.getAmount(); - else if (ing instanceof IntProviderIngredient provider) count = provider.getCountProvider().getMaxValue(); + else if (ing instanceof IntProviderIngredient provider) count = provider.getMaxRoll(); else count = 1; if (content.chance() == 0) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index 45dcd6279df..bfd16bb9676 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -120,9 +120,6 @@ public static List handleRecipe(IO io, GTRecipe recipe, List { if (machine.getRecipeLogic().getLastRecipe().getOutputContents(FluidRecipeCapability.CAP).get(0) @@ -295,29 +294,29 @@ public static void singleblockRangedFluidOutputSabotaged(GameTestHelper helper) "Recipe logic did not contain a Ranged Output!"); } }); - for (int i = 0; i < runs; i++) { + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = (int) fluidOut.getTotalContentAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { FluidStack results = fluidOut.getFluidInTank(0); - helper.assertFalse((results.getAmount() == runs * 0), + helper.assertFalse((results.getAmount() == REPLICAS * 0), "Sabotaged Singleblock CR rolled min value on every roll! " + "This is the failure this sabotage was intended to induce."); - helper.assertFalse((results.getAmount() == runs * 9), + helper.assertFalse((results.getAmount() == REPLICAS * 9), "Sabotaged Singleblock CR rolled max value on every roll (how??)"); - helper.assertTrue(TestUtils.isFluidWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isFluidWithinRange(results, REPLICAS, REPLICAS * 9), "Sabotaged Singleblock CR didn't produce correct number of fluids, produced [" + - results.getAmount() + "] not [" + runs + "-" + (runs * 9) + "]"); + results.getAmount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -365,6 +364,67 @@ public static void singleblockRangedFluidInputFailure(GameTestHelper helper) { }); } + // Test for output preroll on singleblock machine with ranged fluid output + @GameTest(template = "singleblock_charged_cr", batch = "RangedFluidIngredients") + public static void singleblockRangedFluidOutputPreroll(GameTestHelper helper) { + SimpleTieredMachine machine = (SimpleTieredMachine) getMetaMachine( + helper.getBlockEntity(new BlockPos(0, 1, 0))); + + machine.setRecipeType(CR_RECIPE_TYPE); + NotifiableFluidTank fluidIn = (NotifiableFluidTank) machine + .getCapabilitiesFlat(IO.IN, FluidRecipeCapability.CAP).get(0); + NotifiableFluidTank fluidOut = (NotifiableFluidTank) machine + .getCapabilitiesFlat(IO.OUT, FluidRecipeCapability.CAP).get(0); + + + fluidIn.setFluidInTank(0, new FluidStack(CR_OUT, REPLICAS)); + // 1t to turn on, 2t per recipe run + // get the result of each preroll independently + int[] prerolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 1, () -> { + helper.assertFalse(machine.recipeLogic.getLastRecipe() == null, + "Singleblock fluid CR Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(FluidRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Singleblock fluid CR Preroll's recipe output contained no items!"); + prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + }); + } + // get the result of each roll independently + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 3, () -> { + addedRolls[finalI] = fluidOut.getFluidInTank(0).getAmount(); + }); + } + // check the results of all rolls together + helper.runAfterDelay(REPLICAS * 2 + 10, () -> { + // check if all the rolls were equal, but not min/max + int[] rolls = new int[REPLICAS]; + rolls[0] = addedRolls[0]; + helper.assertFalse(prerolls[0] != rolls[0], "Singleblock fluid CR Preroll failed on run 0"); + + + boolean allEqual = true; + for (int i = 1; i < REPLICAS; i++) { + rolls[i] = addedRolls[i] - addedRolls[i - 1]; + helper.assertFalse(prerolls[i] != rolls[i], + "Singleblock CR Preroll failed on run [" + i + "]"); + if (allEqual && rolls[i] == rolls[i - 1]) { + allEqual = true; + } else { + allEqual = false; + } + } + helper.assertFalse(allEqual, + "Singleblock CR rolled the same value on every input roll (rolled " + rolls[0] + ")"); + helper.succeed(); + }); + } + // Test for singleblock machine with ranged fluid input @GameTest(template = "singleblock_charged_cr", batch = "RangedFluidIngredients") public static void singleblockRangedFluidInput(GameTestHelper helper) { @@ -379,26 +439,25 @@ public static void singleblockRangedFluidInput(GameTestHelper helper) { NotifiableFluidTank fluidOut = (NotifiableFluidTank) machine .getCapabilitiesFlat(IO.OUT, FluidRecipeCapability.CAP).get(0); - int runs = 7; fluidIn.setFluidInTank(0, new FluidStack(CR_IN, 64)); - itemIn.setStackInSlot(0, COBBLE.copyWithCount(runs)); + itemIn.setStackInSlot(0, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = fluidIn.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 2, () -> { + helper.runAfterDelay(REPLICAS * 2 + 2, () -> { FluidStack results = fluidIn.getFluidInTank(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, REPLICAS)), "Singleblock CR didn't complete correct number of recipes, completed [" + - fluidOut.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidOut.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "Singleblock CR didn't consume correct number of fluids, consumed [" + (64 - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -408,10 +467,10 @@ public static void singleblockRangedFluidInput(GameTestHelper helper) { "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -426,7 +485,7 @@ public static void singleblockRangedFluidInput(GameTestHelper helper) { }); } - // Test for singleblock machine with ranged fluid input + // Test for singleblock machine with ranged fluid output @GameTest(template = "singleblock_charged_cr", batch = "RangedFluidIngredients") public static void singleblockRangedFluidOutput(GameTestHelper helper) { SimpleTieredMachine machine = (SimpleTieredMachine) getMetaMachine( @@ -438,36 +497,35 @@ public static void singleblockRangedFluidOutput(GameTestHelper helper) { NotifiableFluidTank fluidOut = (NotifiableFluidTank) machine .getCapabilitiesFlat(IO.OUT, FluidRecipeCapability.CAP).get(0); - int runs = 7; - fluidIn.setFluidInTank(0, new FluidStack(CR_OUT, runs)); + fluidIn.setFluidInTank(0, new FluidStack(CR_OUT, REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = fluidOut.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Singleblock CR didn't complete correct number of recipes, completed [" + - fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidIn.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); FluidStack results = fluidOut.getFluidInTank(0); - helper.assertTrue(TestUtils.isFluidWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isFluidWithinRange(results, REPLICAS, REPLICAS * 9), "Singleblock CR didn't produce correct number of fluids, produced [" + - results.getAmount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getAmount() == runs * 9), + results.getAmount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getAmount() == REPLICAS * 9), "Singleblock CR rolled max value on every roll"); - helper.assertFalse((results.getAmount() == runs * 0), + helper.assertFalse((results.getAmount() == REPLICAS * 0), "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -484,33 +542,33 @@ public static void singleblockRangedFluidOutput(GameTestHelper helper) { // test for multiblock machine with ranged fluid input @GameTest(template = "lcr_ranged_ingredients", - batch = "RangedFluidIngredients") + batch = "RangedFluidIngredients") public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { BusHolder busHolder = getBussesAndFormLCR(helper); NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; - int runs = 7; + fluidIn.setFluidInTank(0, new FluidStack(LCR_IN, 64)); - fluidIn.setFluidInTank(1, new FluidStack(RUBBER, runs)); + fluidIn.setFluidInTank(1, new FluidStack(RUBBER, REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = fluidIn.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 2, () -> { + helper.runAfterDelay(REPLICAS * 2 + 2, () -> { FluidStack results = fluidIn.getFluidInTank(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, REPLICAS)), "LCR didn't complete correct number of recipes, completed [" + - fluidOut.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidOut.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "LCR didn't consume correct number of fluids, consumed [" + (64 - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -520,10 +578,10 @@ public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -540,43 +598,43 @@ public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { // test for multiblock machine with ranged fluid input @GameTest(template = "lcr_ranged_ingredients", - batch = "RangedFluidIngredients") + batch = "RangedFluidIngredients") public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { BusHolder busHolder = getBussesAndFormLCR(helper); final NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; final NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; - int runs = 7; - fluidIn.setFluidInTank(0, new FluidStack(LCR_OUT, runs)); + + fluidIn.setFluidInTank(0, new FluidStack(LCR_OUT, REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = fluidOut.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "LCR didn't complete correct number of recipes, completed [" + - fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidIn.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); FluidStack results = fluidOut.getFluidInTank(0); - helper.assertTrue(TestUtils.isFluidWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isFluidWithinRange(results, REPLICAS, REPLICAS * 9), "LCR didn't produce correct number of fluids, produced [" + - results.getAmount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getAmount() == runs * 9), + results.getAmount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getAmount() == REPLICAS * 9), "LCR rolled max value on every roll"); - helper.assertFalse((results.getAmount() == runs * 0), + helper.assertFalse((results.getAmount() == REPLICAS * 0), "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 964ca0a02a6..dde8f835873 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.common.machine.multiblock.part.FluidHatchPartMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.ItemBusPartMachine; @@ -24,10 +25,14 @@ import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.gametest.GameTestHolder; import net.minecraftforge.gametest.PrefixGameTestTemplate; +import java.util.ArrayList; +import java.util.List; + /** * Test cases: * do many passes of most tests as a safeguard against bad rolls @@ -269,11 +274,10 @@ public static void singleblockRangedItemOutputSabotaged(GameTestHelper helper) { NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); - int runs = 7; - itemIn.setStackInSlot(0, CR_OUT.copyWithCount(runs)); + itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; + int[] addedRolls = new int[REPLICAS]; helper.runAfterDelay(2, () -> { if (machine.getRecipeLogic().getLastRecipe().getOutputContents(ItemRecipeCapability.CAP).get(0) @@ -289,30 +293,30 @@ public static void singleblockRangedItemOutputSabotaged(GameTestHelper helper) { "Recipe logic did not contain a Ranged Output!"); } }); - for (int i = 0; i < runs; i++) { + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { ItemStack results = itemOut.getStackInSlot(0); - helper.assertFalse((results.getCount() == runs * 0), + helper.assertFalse((results.getCount() == REPLICAS * 0), "Sabotaged Singleblock CR rolled min value on every roll! " + "This is the failure this sabotage was intended to induce."); - helper.assertFalse((results.getCount() == runs * 9), + helper.assertFalse((results.getCount() == REPLICAS * 9), "Sabotaged Singleblock CR rolled max value on every roll (how??)"); - helper.assertTrue(TestUtils.isItemWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isItemWithinRange(results, REPLICAS, REPLICAS * 9), "Sabotaged Singleblock CR didn't produce correct number of items, produced [" + - results.getCount() + "] not [" + runs + "-" + (runs * 9) + "]"); + results.getCount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -358,6 +362,57 @@ public static void singleblockRangedItemInputFailure(GameTestHelper helper) { }); } + // Test for output preroll on singleblock machine with ranged item output + @GameTest(template = "singleblock_charged_cr", batch = "RangedIngredients") + public static void singleblockRangedItemOutputPreroll(GameTestHelper helper) { + SimpleTieredMachine machine = (SimpleTieredMachine) getMetaMachine( + helper.getBlockEntity(new BlockPos(0, 1, 0))); + + machine.setRecipeType(CR_RECIPE_TYPE); + NotifiableItemStackHandler itemIn = (NotifiableItemStackHandler) machine + .getCapabilitiesFlat(IO.IN, ItemRecipeCapability.CAP).get(0); + NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine + .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); + + + itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); + // 1t to turn on, 2t per recipe run + // get the result of each preroll independently + int[] prerolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 1, () -> { + helper.assertFalse(machine.recipeLogic.getLastRecipe() == null, + "Singleblock item CR Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(ItemRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Singleblock item CR Preroll's recipe output contained no items!"); + prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + }); + } + // get the result of each roll independently + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 3, () -> { + addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); + }); + } + // check the results of all rolls together + helper.runAfterDelay(REPLICAS * 2 + 10, () -> { + // check if all the rolls matched their preroll + int[] rolls = new int[REPLICAS]; + rolls[0] = addedRolls[0]; + helper.assertFalse(prerolls[0] != rolls[0], "Singleblock item CR Preroll failed on run 0"); + for (int i = 1; i < REPLICAS; i++) { + rolls[i] = addedRolls[i] - addedRolls[i - 1]; + helper.assertFalse(prerolls[i] != rolls[i], + "Singleblock CR Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } + // Test for singleblock machine with ranged item input @GameTest(template = "singleblock_charged_cr", batch = "RangedIngredients") public static void singleblockRangedItemInput(GameTestHelper helper) { @@ -370,26 +425,26 @@ public static void singleblockRangedItemInput(GameTestHelper helper) { NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); - int runs = 7; + itemIn.setStackInSlot(0, CR_IN.copyWithCount(64)); - itemIn.setStackInSlot(1, COBBLE.copyWithCount(runs)); + itemIn.setStackInSlot(1, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = itemIn.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { ItemStack results = itemIn.getStackInSlot(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(REPLICAS)), "Singleblock CR didn't complete correct number of recipes, completed [" + - itemOut.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemOut.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Singleblock CR didn't consume correct number of items, consumed [" + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -399,10 +454,10 @@ public static void singleblockRangedItemInput(GameTestHelper helper) { "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -429,36 +484,36 @@ public static void singleblockRangedItemOutput(GameTestHelper helper) { NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); - int runs = 7; - itemIn.setStackInSlot(0, CR_OUT.copyWithCount(runs)); + + itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Singleblock CR didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemIn.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); ItemStack results = itemOut.getStackInSlot(0); - helper.assertTrue(TestUtils.isItemWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isItemWithinRange(results, REPLICAS, REPLICAS * 9), "Singleblock CR didn't produce correct number of items, produced [" + - results.getCount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getCount() == runs * 9), + results.getCount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getCount() == REPLICAS * 9), "Singleblock CR rolled max value on every roll"); - helper.assertFalse((results.getCount() == runs * 0), + helper.assertFalse((results.getCount() == REPLICAS * 0), "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -481,26 +536,26 @@ public static void multiblockLCRRangedItemInput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); - int runs = 7; + itemIn.setStackInSlot(0, LCR_IN.copyWithCount(64)); - itemIn.setStackInSlot(1, COBBLE.copyWithCount(runs)); + itemIn.setStackInSlot(1, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = itemIn.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { ItemStack results = itemIn.getStackInSlot(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(REPLICAS)), "LCR didn't complete correct number of recipes, completed [" + - itemOut.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemOut.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "LCR didn't consume correct number of items, consumed [" + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -510,10 +565,10 @@ public static void multiblockLCRRangedItemInput(GameTestHelper helper) { "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -536,36 +591,36 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); - int runs = 7; - itemIn.setStackInSlot(0, LCR_OUT.copyWithCount(runs)); + + itemIn.setStackInSlot(0, LCR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "LCR didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemIn.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); ItemStack results = itemOut.getStackInSlot(0); - helper.assertTrue(TestUtils.isItemWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isItemWithinRange(results, REPLICAS, REPLICAS * 9), "LCR didn't produce correct number of items, produced [" + - results.getCount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getCount() == runs * 9), + results.getCount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getCount() == REPLICAS * 9), "LCR rolled max value on every roll"); - helper.assertFalse((results.getCount() == runs * 0), + helper.assertFalse((results.getCount() == REPLICAS * 0), "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; From 68530bb95e6baa8c21b3fbf01d225e3ac6805c87 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Mon, 29 Jun 2026 23:29:37 -0500 Subject: [PATCH 20/28] multiblock test for prerolls --- .../IntProviderFluidIngredientTest.java | 68 ++++++++++++++--- .../ingredient/IntProviderIngredientTest.java | 73 +++++++++++++++++-- 2 files changed, 125 insertions(+), 16 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index 2d72833f611..cd7ce8399b4 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -388,7 +388,7 @@ public static void singleblockRangedFluidOutputPreroll(GameTestHelper helper) { "Singleblock fluid CR Preroll was not running a recipe when preroll was checked!"); var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(FluidRecipeCapability.CAP); helper.assertFalse(outputPrerolls.size() == 0, - "Singleblock fluid CR Preroll's recipe output contained no items!"); + "Singleblock fluid CR Preroll's recipe output contained no fluids!"); prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; }); } @@ -407,20 +407,11 @@ public static void singleblockRangedFluidOutputPreroll(GameTestHelper helper) { rolls[0] = addedRolls[0]; helper.assertFalse(prerolls[0] != rolls[0], "Singleblock fluid CR Preroll failed on run 0"); - - boolean allEqual = true; for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; helper.assertFalse(prerolls[i] != rolls[i], - "Singleblock CR Preroll failed on run [" + i + "]"); - if (allEqual && rolls[i] == rolls[i - 1]) { - allEqual = true; - } else { - allEqual = false; - } + "Singleblock fluid CR Preroll failed on run [" + i + "]"); } - helper.assertFalse(allEqual, - "Singleblock CR rolled the same value on every input roll (rolled " + rolls[0] + ")"); helper.succeed(); }); } @@ -1101,4 +1092,59 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel helper.succeed(); }); } + // test for multiblock machine with 16x Parallels with ranged fluid output preroll + @GameTest(template = "large_centrifuge_zpm_batch_parallel16", + batch = "RangedFluidIngredients", + timeoutTicks = 2000) + public static void multiblockLCentRangedFluidOutputPreroll16ParallelBatched(GameTestHelper helper) { + BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); + + final NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; + final NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; + + int batches = 16; + int parallels = 16; + busHolder.controller.setBatchEnabled(true); + busHolder.parallelHatch.setCurrentParallel(parallels); + + fluidIn.setFluidInTank(0, new FluidStack(LCENT_OUT, batches * parallels)); + + // 1t to turn on, 64t per recipe run, 10t buffer for sanity + int[] prerolls = new int[MULTI_REPLICAS]; + for (int i = 0; i < MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI+20, () -> { + helper.assertFalse(busHolder.controller.recipeLogic.getLastRecipe() == null, + "Multiblock LCent fluid Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs.get(FluidRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Multiblock LCent fluid Preroll's recipe output contained no fluids!"); + prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + }); + } + // check the results of all rolls together + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI, () -> { + addedRolls[finalI-1] = fluidOut.getFluidInTank(0).getAmount(); + // reset for a rerun + fluidIn.setFluidInTank(0, new FluidStack(LCENT_OUT, batches * parallels)); + }); + } + + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { + int[] rolls = new int[MULTI_REPLICAS]; + rolls[0] = addedRolls[0]; + helper.assertFalse(prerolls[0] != rolls[0], "Multiblock LCent fluid Preroll failed on run 0"); + + for (int i = 1; i < MULTI_REPLICAS; i++) { + rolls[i] = addedRolls[i] - addedRolls[i - 1]; + helper.assertFalse(prerolls[i] != rolls[i], + "Multiblock LCent fluid Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } } diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index dde8f835873..0d6de130f20 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -1036,7 +1037,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp // 16 parallels // check the results of all rolls together // repeat recipe MULTI_REPLICAS times - int[] addedRolls = new int[MULTI_REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { @@ -1054,7 +1055,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp "Batched Parallel LCent didn't produce correct number of items, produced [" + resultCount + "] not [" + lowerLimit + "-" + upperLimit + "]"); - addedRolls[finalI - 1] = resultCount; + rolls[finalI - 1] = resultCount; // reset for a rerun for (int j = 0; j < batches; j++) { @@ -1070,9 +1071,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[MULTI_REPLICAS]; - rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched Parallel LCent ranged item output test iteration " + 1 + " produced [" + @@ -1080,7 +1079,6 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp "). If this message only appears once, this is likely a false positive."); } for (int i = 1; i < MULTI_REPLICAS; i++) { - rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched Parallel LCent ranged item output test iteration " + (i + 1) + @@ -1098,4 +1096,69 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp helper.succeed(); }); } + + // test for multiblock machine with 16x Parallels with ranged item output + @GameTest(template = "large_centrifuge_zpm_batch_parallel16", + batch = "RangedIngredients", + timeoutTicks = 2000) + public static void multiblockLCentRangedItemOutputPreroll16ParallelBatched(GameTestHelper helper) { + BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); + + NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); + NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); + + int batches = 16; + int parallels = 16; + busHolder.controller.setBatchEnabled(true); + busHolder.parallelHatch.setCurrentParallel(parallels); + + for (int j = 0; j < batches; j++) { + itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); + } + + // 1t to turn on, 64t per recipe run, 10t buffer for sanity + // 16 parallels + int[] prerolls = new int[MULTI_REPLICAS]; + for (int i = 0; i < MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI+20, () -> { + helper.assertFalse(busHolder.controller.recipeLogic.getLastRecipe() == null, + "Multiblock LCent item Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs.get(ItemRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Multiblock LCent item Preroll's recipe output contained no items!"); + prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + }); + } + // check the results of all rolls together + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI, () -> { + int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); + rolls[finalI - 1] = resultCount; + + // reset for a rerun + for (int j = 0; j < batches; j++) { + itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); + } + // Don't overflow the output bus + for (int j = 0; j < itemOut.getSize(); j++) { + itemOut.setStackInSlot(j, ItemStack.EMPTY); + } + }); + } + + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { + + helper.assertFalse(prerolls[0] != rolls[0], "Multiblock LCent item Preroll failed on run 0"); + + for (int i = 1; i < REPLICAS; i++) { + helper.assertFalse(prerolls[i] != rolls[i], + "Multiblock LCent item Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } } From 5e882725fa52313cdd3b04b16267f39cc575ea1e Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Mon, 29 Jun 2026 23:29:55 -0500 Subject: [PATCH 21/28] spotless --- .../ingredient/IntProviderIngredient.java | 4 +-- .../IntProviderFluidIngredientTest.java | 29 ++++++++++--------- .../ingredient/IntProviderIngredientTest.java | 24 +++++---------- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java index b71f104b10d..e1e52357c3b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java @@ -113,9 +113,9 @@ public boolean test(@Nullable ItemStack stack) { return itemStacks; } - public int getAmount(){ + public int getAmount() { if (!isRolled()) return getMaxRoll(); - else return (getItems().length!=0 ? getItems()[0].getCount() : 0); + else return (getItems().length != 0 ? getItems()[0].getCount() : 0); } /** diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index cd7ce8399b4..1c500ea77c0 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -376,7 +376,6 @@ public static void singleblockRangedFluidOutputPreroll(GameTestHelper helper) { NotifiableFluidTank fluidOut = (NotifiableFluidTank) machine .getCapabilitiesFlat(IO.OUT, FluidRecipeCapability.CAP).get(0); - fluidIn.setFluidInTank(0, new FluidStack(CR_OUT, REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each preroll independently @@ -389,7 +388,7 @@ public static void singleblockRangedFluidOutputPreroll(GameTestHelper helper) { var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(FluidRecipeCapability.CAP); helper.assertFalse(outputPrerolls.size() == 0, "Singleblock fluid CR Preroll's recipe output contained no fluids!"); - prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; }); } // get the result of each roll independently @@ -446,7 +445,8 @@ public static void singleblockRangedFluidInput(GameTestHelper helper) { FluidStack results = fluidIn.getFluidInTank(0); int upperLimit = 64 - (REPLICAS * 0); int lowerLimit = 64 - (REPLICAS * 9); - helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, REPLICAS)), + helper.assertTrue( + TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, REPLICAS)), "Singleblock CR didn't complete correct number of recipes, completed [" + fluidOut.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), @@ -533,14 +533,13 @@ public static void singleblockRangedFluidOutput(GameTestHelper helper) { // test for multiblock machine with ranged fluid input @GameTest(template = "lcr_ranged_ingredients", - batch = "RangedFluidIngredients") + batch = "RangedFluidIngredients") public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { BusHolder busHolder = getBussesAndFormLCR(helper); NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; - fluidIn.setFluidInTank(0, new FluidStack(LCR_IN, 64)); fluidIn.setFluidInTank(1, new FluidStack(RUBBER, REPLICAS)); // 1t to turn on, 2t per recipe run @@ -557,7 +556,8 @@ public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { FluidStack results = fluidIn.getFluidInTank(0); int upperLimit = 64 - (REPLICAS * 0); int lowerLimit = 64 - (REPLICAS * 9); - helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, REPLICAS)), + helper.assertTrue( + TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), new FluidStack(REDSTONE, REPLICAS)), "LCR didn't complete correct number of recipes, completed [" + fluidOut.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), @@ -589,14 +589,13 @@ public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { // test for multiblock machine with ranged fluid input @GameTest(template = "lcr_ranged_ingredients", - batch = "RangedFluidIngredients") + batch = "RangedFluidIngredients") public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { BusHolder busHolder = getBussesAndFormLCR(helper); final NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; final NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; - fluidIn.setFluidInTank(0, new FluidStack(LCR_OUT, REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently @@ -1092,10 +1091,11 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel helper.succeed(); }); } + // test for multiblock machine with 16x Parallels with ranged fluid output preroll @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutputPreroll16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -1113,13 +1113,14 @@ public static void multiblockLCentRangedFluidOutputPreroll16ParallelBatched(Game int[] prerolls = new int[MULTI_REPLICAS]; for (int i = 0; i < MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(75 * finalI+20, () -> { + helper.runAfterDelay(75 * finalI + 20, () -> { helper.assertFalse(busHolder.controller.recipeLogic.getLastRecipe() == null, "Multiblock LCent fluid Preroll was not running a recipe when preroll was checked!"); - var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs.get(FluidRecipeCapability.CAP); + var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs + .get(FluidRecipeCapability.CAP); helper.assertFalse(outputPrerolls.size() == 0, "Multiblock LCent fluid Preroll's recipe output contained no fluids!"); - prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; }); } // check the results of all rolls together @@ -1128,7 +1129,7 @@ public static void multiblockLCentRangedFluidOutputPreroll16ParallelBatched(Game for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { - addedRolls[finalI-1] = fluidOut.getFluidInTank(0).getAmount(); + addedRolls[finalI - 1] = fluidOut.getFluidInTank(0).getAmount(); // reset for a rerun fluidIn.setFluidInTank(0, new FluidStack(LCENT_OUT, batches * parallels)); }); diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 0d6de130f20..180207687bb 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -11,7 +10,6 @@ import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; -import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.common.machine.multiblock.part.FluidHatchPartMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.ItemBusPartMachine; @@ -26,14 +24,10 @@ import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.gametest.GameTestHolder; import net.minecraftforge.gametest.PrefixGameTestTemplate; -import java.util.ArrayList; -import java.util.List; - /** * Test cases: * do many passes of most tests as a safeguard against bad rolls @@ -375,7 +369,6 @@ public static void singleblockRangedItemOutputPreroll(GameTestHelper helper) { NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); - itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each preroll independently @@ -388,7 +381,7 @@ public static void singleblockRangedItemOutputPreroll(GameTestHelper helper) { var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(ItemRecipeCapability.CAP); helper.assertFalse(outputPrerolls.size() == 0, "Singleblock item CR Preroll's recipe output contained no items!"); - prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; }); } // get the result of each roll independently @@ -426,7 +419,6 @@ public static void singleblockRangedItemInput(GameTestHelper helper) { NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); - itemIn.setStackInSlot(0, CR_IN.copyWithCount(64)); itemIn.setStackInSlot(1, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run @@ -485,7 +477,6 @@ public static void singleblockRangedItemOutput(GameTestHelper helper) { NotifiableItemStackHandler itemOut = (NotifiableItemStackHandler) machine .getCapabilitiesFlat(IO.OUT, ItemRecipeCapability.CAP).get(0); - itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently @@ -537,7 +528,6 @@ public static void multiblockLCRRangedItemInput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); - itemIn.setStackInSlot(0, LCR_IN.copyWithCount(64)); itemIn.setStackInSlot(1, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run @@ -592,7 +582,6 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); - itemIn.setStackInSlot(0, LCR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently @@ -1099,8 +1088,8 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutputPreroll16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -1121,13 +1110,14 @@ public static void multiblockLCentRangedItemOutputPreroll16ParallelBatched(GameT int[] prerolls = new int[MULTI_REPLICAS]; for (int i = 0; i < MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(75 * finalI+20, () -> { + helper.runAfterDelay(75 * finalI + 20, () -> { helper.assertFalse(busHolder.controller.recipeLogic.getLastRecipe() == null, "Multiblock LCent item Preroll was not running a recipe when preroll was checked!"); - var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs.get(ItemRecipeCapability.CAP); + var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs + .get(ItemRecipeCapability.CAP); helper.assertFalse(outputPrerolls.size() == 0, "Multiblock LCent item Preroll's recipe output contained no items!"); - prerolls[finalI] = ((IRangedIngredient)(outputPrerolls.get(0).content())).getAmount();; + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; }); } // check the results of all rolls together From 514c6917407e6dcc561d3d2653a3710324853558 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Tue, 30 Jun 2026 22:38:22 -0500 Subject: [PATCH 22/28] Make IPI.amount consistent with IPFI.amount. Parity of the IRangedIngredients. --- .../IntProviderFluidIngredient.java | 26 ++++----- .../ingredient/IntProviderIngredient.java | 53 ++++++++++++++----- .../recipe/ingredient/SizedIngredient.java | 13 +---- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index a0288181539..b65b550d121 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -71,18 +71,9 @@ public IntProviderFluidIngredient copy() { return ipfi; } - /** - * this override only exists for debugging and will be removed. - */ - @Deprecated - @Override - public int getAmount() { - return super.getAmount(); - } - @Override public boolean isEmpty() { - return (this.getAmount() == 0); + return this.getAmount() == 0 || super.isEmpty(); } /** @@ -94,18 +85,19 @@ public boolean isEmpty() { @Override public FluidStack[] getStacks() { if (changed || fluidStacks == null) { - int cachedAmount = rollSampledCount(GTValues.RNG); - if (cachedAmount == 0) { - return EMPTY_STACK_ARRAY; + changed = false; + if (!isRolled()) { + setAmount(rollSampledCount()); + if (getAmount() == 0) { + return EMPTY_STACK_ARRAY; + } } var innerStacks = inner.getStacks(); this.fluidStacks = new FluidStack[innerStacks.length]; for (int i = 0; i < fluidStacks.length; i++) { fluidStacks[i] = innerStacks[i].copy(); - fluidStacks[i].setAmount(cachedAmount); - } - changed = false; - } + fluidStacks[i].setAmount(getAmount()); + }} return fluidStacks; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java index e1e52357c3b..6ca2a3a63a8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java @@ -44,7 +44,6 @@ public class IntProviderIngredient extends Ingredient implements IRangedIngredie * The last result of {@link IntProviderIngredient#rollSampledCount(RandomSource)}. -1 if not rolled. */ @Getter - @Setter protected int sampledCount = -1; /** * The {@link Ingredient} to have a ranged amount. @@ -53,18 +52,27 @@ public class IntProviderIngredient extends Ingredient implements IRangedIngredie protected final Ingredient inner; @Setter protected ItemStack[] itemStacks = null; + @Getter + private int amount; + private boolean changed = true; protected IntProviderIngredient(Ingredient inner, IntProvider countProvider) { super(Stream.empty()); this.inner = inner; this.countProvider = countProvider; + this.amount = getMaxRoll(); } - protected IntProviderIngredient(Ingredient inner, IntProvider countProvider, int sampledCount) { + protected IntProviderIngredient(Ingredient inner, IntProvider countProvider, int sampledCount, int amount) { super(Stream.empty()); this.inner = inner; this.countProvider = countProvider; this.sampledCount = sampledCount; + this.amount = amount; + } + + public IntProviderIngredient copy(){ + return new IntProviderIngredient(this.inner, this.countProvider, this.sampledCount, this.amount); } /** @@ -99,23 +107,26 @@ public boolean test(@Nullable ItemStack stack) { */ @Override public ItemStack @NotNull [] getItems() { - if (itemStacks == null) { - int cachedCount = rollSampledCount(); - if (cachedCount == 0) { - return EMPTY_STACK_ARRAY; + if (changed || itemStacks == null) { + changed = false; + if (!isRolled()) { + setAmount(rollSampledCount()); + if (getAmount() == 0) { + return EMPTY_STACK_ARRAY; + } } var innerStacks = inner.getItems(); this.itemStacks = new ItemStack[innerStacks.length]; for (int i = 0; i < itemStacks.length; i++) { - itemStacks[i] = innerStacks[i].copyWithCount(cachedCount); + itemStacks[i] = innerStacks[i].copyWithCount(getAmount()); } } return itemStacks; } - public int getAmount() { - if (!isRolled()) return getMaxRoll(); - else return (getItems().length != 0 ? getItems()[0].getCount() : 0); + public void setAmount(int amount){ + this.amount = amount; + this.changed = true; } /** @@ -139,17 +150,27 @@ public int getAmount() { * @return the count rolled */ public int rollSampledCount(@NotNull RandomSource random) { - if (sampledCount == -1) { + if (!isRolled()) { sampledCount = countProvider.sample(random); + this.setAmount(sampledCount); } return sampledCount; } + /** + * Also sets the Amount of this ingredient + */ + public void setSampledCount(int count) { + this.sampledCount = count; + this.setAmount(count); + } + /** * Resets the random roll on this ingredient */ public void reset() { sampledCount = -1; + setAmount(getMaxRoll()); itemStacks = null; } @@ -160,7 +181,7 @@ public void reset() { @Override public boolean isEmpty() { - return inner.isEmpty(); + return this.getAmount() == 0 || inner.isEmpty(); } @Override @@ -197,6 +218,7 @@ public static IntProviderIngredient fromJson(JsonObject json) { .getOrThrow(false, GTCEu.LOGGER::error)); json.add("ingredient", inner.toJson()); json.addProperty("sampledCount", sampledCount); + json.addProperty("amount",amount); return json; } @@ -208,7 +230,8 @@ public static IntProviderIngredient fromJson(JsonObject json) { IntProvider provider = IntProvider.CODEC.parse(NbtOps.INSTANCE, nbt.get("provider")) .getOrThrow(false, GTCEu.LOGGER::error); int sampledCount = nbt.getInt("sampledCount"); - return new IntProviderIngredient(Ingredient.fromNetwork(buffer), provider, sampledCount); + int amount = nbt.getInt("amount"); + return new IntProviderIngredient(Ingredient.fromNetwork(buffer), provider, sampledCount, amount); } @Override @@ -217,7 +240,8 @@ public static IntProviderIngredient fromJson(JsonObject json) { .getOrThrow(false, GTCEu.LOGGER::error); Ingredient inner = Ingredient.fromJson(json.get("ingredient")); int sampledCount = json.getAsJsonPrimitive("sampledCount").getAsInt(); - return new IntProviderIngredient(inner, provider, sampledCount); + int amount = json.getAsJsonPrimitive("amount").getAsInt(); + return new IntProviderIngredient(inner, provider, sampledCount, amount); } @Override @@ -226,6 +250,7 @@ public void write(FriendlyByteBuf buffer, IntProviderIngredient ingredient) { wrapper.put("provider", IntProvider.CODEC.encodeStart(NbtOps.INSTANCE, ingredient.countProvider) .getOrThrow(false, GTCEu.LOGGER::error)); wrapper.putInt("sampledCount", ingredient.sampledCount); + wrapper.putInt("amount", ingredient.amount); buffer.writeNbt(wrapper); ingredient.inner.toNetwork(buffer); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java index 1f407d02ed0..5ac2fa74390 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java @@ -83,20 +83,11 @@ public static Ingredient copy(Ingredient ingredient) { if (sizedIngredient.inner instanceof IntProviderIngredient intProviderIngredient) { return copy(intProviderIngredient); } - return SizedIngredient.create(sizedIngredient.inner, sizedIngredient.amount); } else if (ingredient instanceof IntCircuitIngredient circuit) { return circuit; - } else if (ingredient instanceof IntProviderIngredient intProviderIngredient) { - var copied = IntProviderIngredient.of(intProviderIngredient.inner, intProviderIngredient.countProvider); - if (intProviderIngredient.itemStacks != null) { - copied.itemStacks = Arrays.stream(intProviderIngredient.itemStacks).map(ItemStack::copy) - .toArray(ItemStack[]::new); - } - if (intProviderIngredient.sampledCount != -1) { - copied.sampledCount = intProviderIngredient.sampledCount; - } - return copied; + } else if (ingredient instanceof IntProviderIngredient provider) { + return provider.copy(); } return SizedIngredient.create(ingredient, ingredient.getItems()[0].getCount()); } From 0d05e5ebe7645e494c8fd748d0fa809bf2dd07ca Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Tue, 30 Jun 2026 22:58:25 -0500 Subject: [PATCH 23/28] remove some unneeded checks --- .../gtceu/api/capability/recipe/ItemRecipeCapability.java | 5 +---- .../gtceu/api/recipe/ingredient/SizedIngredient.java | 3 --- .../gtceu/data/recipe/builder/GTRecipeBuilder.java | 4 ++-- .../integration/jade/provider/RecipeOutputProvider.java | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index e029396dffc..79c24814cf1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -88,9 +88,6 @@ public List compressIngredients(@Unmodifiable Collection ingredi } else if (ingredient instanceof SizedIngredient sized && sized.getInner() instanceof IntCircuitIngredient) { list.add(0, ingredient); - } else if (ingredient instanceof IntProviderIngredient intProvider && - intProvider.getInner() instanceof IntCircuitIngredient) { - list.add(0, ingredient); } else { list.add(ingredient); } @@ -152,7 +149,7 @@ public int limitMaxParallelByOutput(IRecipeCapabilityHolder holder, GTRecipe rec int count; if (ing instanceof SizedIngredient sized) count = sized.getAmount(); - else if (ing instanceof IntProviderIngredient provider) count = provider.getCountProvider().getMaxValue(); + else if (ing instanceof IntProviderIngredient provider) count = provider.getMaxRoll(); else count = 1; maxCount = Math.max(maxCount, count); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java index 5ac2fa74390..75b8dd6c799 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java @@ -126,9 +126,6 @@ public boolean test(@Nullable ItemStack stack) { @Override public ItemStack @NotNull [] getItems() { - if (getInner() instanceof IntProviderIngredient intProviderIngredient) { - return intProviderIngredient.getItems(); - } if (changed || itemStacks == null) { var innerStacks = inner.getItems(); this.itemStacks = new ItemStack[innerStacks.length]; diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index f23120d0b62..83bf7cc8c21 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -1704,7 +1704,7 @@ private void addOutputMaterialInfo() { if (items.length > 0) { out = items[0].getItem(); // use the max amount of items for decomp info so dupes can't happen - outputCount = intProvider.getCountProvider().getMaxValue(); + outputCount = intProvider.getMaxRoll(); } } else if (!currOutput.isEmpty()) { ItemStack[] items = currOutput.getItems(); @@ -1755,7 +1755,7 @@ private void removeExistingMaterialInfo() { if (items.length > 0) { out = items[0].getItem(); // use the max amount of items for decomp info so dupes can't happen - outputCount = intProvider.getCountProvider().getMaxValue(); + outputCount = intProvider.getMaxRoll(); } } else if (!currOutput.isEmpty()) { ItemStack[] items = currOutput.getItems(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java index a2fc40e811e..5717b1a2a10 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java @@ -63,7 +63,6 @@ protected CompoundTag write(RecipeLogic recipeLogic) { for (var item : itemContents) { CompoundTag itemTag; if (item.content() instanceof IntProviderIngredient provider) { - // don't roll for output but do copy for chance and batch IntProviderIngredient chanced = provider; if (item.chance() < item.maxChance()) { double countD = ((double) runs * item.chance()) / item.maxChance(); From 367417eba4db47963cda0d19db74ed6c5eccb85f Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Tue, 30 Jun 2026 22:58:58 -0500 Subject: [PATCH 24/28] spotless --- .../api/recipe/ingredient/IntProviderFluidIngredient.java | 3 ++- .../gtceu/api/recipe/ingredient/IntProviderIngredient.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index b65b550d121..bbc5f32399b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -97,7 +97,8 @@ public FluidStack[] getStacks() { for (int i = 0; i < fluidStacks.length; i++) { fluidStacks[i] = innerStacks[i].copy(); fluidStacks[i].setAmount(getAmount()); - }} + } + } return fluidStacks; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java index 6ca2a3a63a8..397ff2ec883 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java @@ -71,7 +71,7 @@ protected IntProviderIngredient(Ingredient inner, IntProvider countProvider, int this.amount = amount; } - public IntProviderIngredient copy(){ + public IntProviderIngredient copy() { return new IntProviderIngredient(this.inner, this.countProvider, this.sampledCount, this.amount); } @@ -124,7 +124,7 @@ public boolean test(@Nullable ItemStack stack) { return itemStacks; } - public void setAmount(int amount){ + public void setAmount(int amount) { this.amount = amount; this.changed = true; } @@ -218,7 +218,7 @@ public static IntProviderIngredient fromJson(JsonObject json) { .getOrThrow(false, GTCEu.LOGGER::error)); json.add("ingredient", inner.toJson()); json.addProperty("sampledCount", sampledCount); - json.addProperty("amount",amount); + json.addProperty("amount", amount); return json; } From ada772f45e01367bcb5b989d44ba0cb2f31d7c0d Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 1 Jul 2026 00:02:42 -0500 Subject: [PATCH 25/28] anti-null --- .../gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java | 1 + .../gtceu/api/recipe/ingredient/IntProviderIngredient.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index bbc5f32399b..88b9e929175 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -89,6 +89,7 @@ public FluidStack[] getStacks() { if (!isRolled()) { setAmount(rollSampledCount()); if (getAmount() == 0) { + fluidStacks = EMPTY_STACK_ARRAY; return EMPTY_STACK_ARRAY; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java index 397ff2ec883..af9bafd5e11 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java @@ -112,6 +112,7 @@ public boolean test(@Nullable ItemStack stack) { if (!isRolled()) { setAmount(rollSampledCount()); if (getAmount() == 0) { + itemStacks = EMPTY_STACK_ARRAY; return EMPTY_STACK_ARRAY; } } From 25727ffb339cd9ed2e5e52f12a091747d8d34b95 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 1 Jul 2026 15:12:00 -0500 Subject: [PATCH 26/28] review comments (1/2) --- .../gregtechceu/gtceu/api/recipe/content/ContentModifier.java | 1 - .../gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java index 25a5cc66397..7623a4c21e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java @@ -43,7 +43,6 @@ public double apply(double number) { */ public Map, List> applyContents(Map, List> contents) { // Prerolls require copying, even on IDENTITY - // if (this == IDENTITY) return new HashMap<>(contents); Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var contentList = entry.getValue(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java index 35067a36053..fca5c1f30b4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java @@ -204,7 +204,7 @@ public ModifierFunction build() { private static Map, List> applyAllButEU(ContentModifier cm, Map, List> contents) { - if (cm == ContentModifier.IDENTITY) return new HashMap<>(contents); + // Prerolls require copying, even on IDENTITY Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var cap = entry.getKey(); From f2b036e8771a00889a7735eddcf6a7f92f7913a1 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 1 Jul 2026 15:17:46 -0500 Subject: [PATCH 27/28] review comments (2/2) --- .../gtceu/api/recipe/GTRecipe.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index 62ba4865ff5..9a5e6ce8147 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -235,35 +235,33 @@ public ChanceLogic getChanceLogicForCapability(RecipeCapability cap, IO io, b } public void doPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { - var rangedContents = getFullContents() - .filter(i -> i.content() instanceof IRangedIngredient) - .toList(); + var rangedContents = getFullContents(); for (var item : rangedContents) { - ((IRangedIngredient) item.content()).rollSampledCount(); + if (item.content() instanceof IRangedIngredient ranged) + ranged.rollSampledCount(); } } public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { - var rangedContents = getFullTickContents() - .filter(i -> i.content() instanceof IRangedIngredient) - .toList(); + var rangedContents = getFullTickContents(); for (var item : rangedContents) { - ((IRangedIngredient) item.content()).rollSampledCount(); + if (item.content() instanceof IRangedIngredient ranged) + ranged.rollSampledCount(); } } - public Stream getFullContents() { - return Stream.concat( - inputs.values().stream(), - outputs.values().stream()) - .flatMap(List::stream); + public List getFullContents() { + return Stream + .concat(inputs.values().stream(), outputs.values().stream()) + .flatMap(List::stream) + .toList(); } - public Stream getFullTickContents() { - return Stream.concat( - tickInputs.values().stream(), - tickOutputs.values().stream()) - .flatMap(List::stream); + public List getFullTickContents() { + return Stream + .concat(tickInputs.values().stream(), tickOutputs.values().stream()) + .flatMap(List::stream) + .toList(); } public int getTotalRuns() { From 930cafaf2fe2ae66116f1094354886a99e8e3355 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Wed, 1 Jul 2026 15:20:28 -0500 Subject: [PATCH 28/28] okay i just don't like seeing var there --- src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index 9a5e6ce8147..b336fbe3199 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -236,7 +236,7 @@ public ChanceLogic getChanceLogicForCapability(RecipeCapability cap, IO io, b public void doPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { var rangedContents = getFullContents(); - for (var item : rangedContents) { + for (Content item : rangedContents) { if (item.content() instanceof IRangedIngredient ranged) ranged.rollSampledCount(); } @@ -244,7 +244,7 @@ public void doPrerolls(IdentityHashMap, Object2IntMap> ch public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { var rangedContents = getFullTickContents(); - for (var item : rangedContents) { + for (Content item : rangedContents) { if (item.content() instanceof IRangedIngredient ranged) ranged.rollSampledCount(); }