Fix chance logic not adjusting the roll chance in small parallel situations #2429
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
This PR makes a variety of changes.
First and foremost, it fixes an error in the calculation of guaranteed and rolled chance outputs in parallel recipes, where the chance being rolled was not probably adjusted to account for the parallel amount.
Second, the way that a recipe's contents are copied when being modified has been slightly adjusted. Rather than always multiplied the content amount unless the content is non-consumable, the content is only multiplied when its chance is equal to its max chance. In
Content#copy(Capability, Modifier)
, then original if statement has becomeif (modifier == null || chance < maxChance)
.This change allows the recipe runner to avoid the hacky bandaid where the chance contents were being multiplied by 1/n to unparallel them for chance rolls.
Due to this change, the recipe output logic in the multiblock display has been slightly rewritten to account for it.
Outcome
Chance works for small parallel amounts now
Resolves #2425
Additional Information
Also adds rolling to the AND and XOR chance logics, since that was forgotten in an earlier PR