Preroll Ranged Ingredients on Recipe Start (1.20.1)#5015
Open
DilithiumThoride wants to merge 35 commits into
Open
Preroll Ranged Ingredients on Recipe Start (1.20.1)#5015DilithiumThoride wants to merge 35 commits into
DilithiumThoride wants to merge 35 commits into
Conversation
…in-ba-sing-se' into dt/there-are-no-chance-boosters-in-ba-sing-se # Conflicts: # src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java # src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java # src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java # src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java # src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java # src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java # src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java # src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java # src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java # src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java # src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java # src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java # src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTOreByProductWidget.java # src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java
…in-ba-sing-se' into dt/there-are-no-chance-boosters-in-ba-sing-se
…ranged-prerolls # Conflicts: # src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java
jurrejelle
requested changes
Jul 1, 2026
jurrejelle
left a comment
Contributor
There was a problem hiding this comment.
Few (AI-assisted, disclosure) nits, but apart from that this looks good :D Way nicer to just do this at a static point and have a value present
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ranged Ingredients have their values rolled at the time when the ingredients are consumed/produced. This works but it results in some messy code flows around the "amount" a ranged ingredient is holding, which in the past has lead to bugs and undefined behavior. #4992 added checks for this behavior. This PR largely reverts #4992 in favor of overhauling the ranged ingredient logic to make those checks unnecessary.
Implementation Details
1: This is the first PR out of three related to ingredient prerolls. The second PR will be a copy of this but ported to the 1.21 branch (#5048). The third PR will do ingredient prerolls on Chanced Ingredients as well; however that third PR is blocked by #4320 which is why I'm splitting it up to do this part first.
2: An additional field is added to RecipeLogic,
lastDisplayedRecipe. This field represent a copy of a recipe the moment before it is executed, after batch/parallel modifications have been applied but before ingredients are pre-rolled. Among other things that means this is the version of the recipe that should be displayed by Jade and multiblock UIs, because after prerolls ingredients may or may not be zeroed out.3:
IRangedIngredient.getAmount()is now a method. IRangedIngredients should now as a whole act as holders similar toSizedIngredients, but in which theamountand thesampledCountroll value are actually independent such that RecipeLogic can still set amounts on them for splitting output stacks between busses.AI Usage
Outcome
No change to user experience in 1.20.
However, this sets the stage to remove an incongruity between the 1.20 and 1.21 branches, work towards fixing several bugs with Ranged Fluids in 1.21; and it is an incremental step required for the distant future #4321
How Was This Tested
Four additional automated tests have been added to validate the prerolling behavior.
Additional Information
Temporarily flagged [DO NOT MERGE] as #5015 and #5048 should be merged at the same time.
Potential Compatibility Issues
Probably breaks mixins that modify recipelogic, and may interfere with addon mods that have recipelogic that does not call the standard
setupRecipe()