Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chance logic not adjusting the roll chance in small parallel situations #2429

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

krossgg
Copy link
Contributor

@krossgg krossgg commented Nov 24, 2024

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 become if (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

@krossgg krossgg added the type: bugfix general bug fixes label Nov 24, 2024
@krossgg krossgg requested a review from a team as a code owner November 24, 2024 08:14
@YoungOnionMC YoungOnionMC merged commit 2688d98 into 1.20.1 Nov 25, 2024
3 checks passed
@YoungOnionMC YoungOnionMC deleted the kr/chance-fix branch November 25, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bugfix general bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Steam Multiblocks do not properly account for chanced outputs
2 participants