-
Notifications
You must be signed in to change notification settings - Fork 653
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 crafting job progress bar exceeding 100% #8005
Conversation
Simple way to test this: Create a pattern for cable anchors (and make sure it allows for substitution) and craft large quantities (hunderts are sufficient). The damaged knives will trigger this bug. The most critical part in my opinion is CraftingCpuLogic.insert(). There is a separate bug that messes up crafting jobs that are not done when leaving and rejoining the world, which is why I couldn't properly test the NBT writing portion of my fix. |
Fix for 1.21 for the bug reported independently in AppliedEnergistics#7468 for 1.20 and AppliedEnergistics#7420 for 1.19. The bug stems from the discrepancy between the initial calculation that only accounts for recipe outputs and the actual execution of the job which adds recipe outputs as well as any remaining items in the crafting grid, called container items. When decrementing the counter for the remaining items, these container items must not be counted to ensure the counter only decrements down to 0 and not beyond. Fixing this side of the problem, rather than the initial calculation has two reasons: - more accurate progress bar, because recipes with container items don't decrease the counter multiple times per recipe execution, which will become important for more complex crafting jobs with a mix of normal recipes and those with additional container items. - the actual number of container items is determined only at the execution stage and not during the initial calculation.
@Technici4n Can you check this one? This is more up your alley |
Tomorrow :) |
I merged #8085 instead. Thanks for the analysis and for the fix idea! |
You‘re welcome. I was quite sure the analysis was correct but as always with unfamiliar code there might be a more elegant solution. Thanks for fixing the bug! |
Fix for 1.21 for the bug reported independently in #7468 for 1.20 and #7420 for 1.19.
The bug stems from the discrepancy between the initial calculation that only accounts for recipe outputs and the actual execution of the job which adds recipe outputs as well as any remaining items in the crafting grid, called container items. When decrementing the counter for the remaining items, these container items must not be counted to ensure the counter only decrements down to 0 and not beyond.
Fixing this side of the problem, rather than the initial calculation has two reasons: