Skip to content

Stop multiplying the missing ingredients of running jobs by their crafts - #235

Open
rubensworks wants to merge 1 commit into
feature/crafting-plan-graphfrom
fix/crafting-plan-missing-quantity
Open

rubensworks wants to merge 1 commit into
feature/crafting-plan-graphfrom
fix/crafting-plan-missing-quantity

Conversation

@rubensworks

Copy link
Copy Markdown
Member

Based on #233.

Integrated Crafting reports the missing ingredients of a running job (CraftingJob#getLastMissingIngredients) as the total quantities for all of its remaining crafts. They are computed in fillCraftingJobBufferFromStorage for the job's full amount, and reduced as dependencies deliver outputs. The crafting plan multiplied them by the job's remaining crafts again, in both places that use them:

  • TerminalCraftingPlanStatic#flatten, used by the compact view and the progress of the jobs overview;
  • GuiCraftingPlan#getElements, used by the tree list and graph views. There, the missing element also got the remaining crafts as its missing quantity ("Missing: N" in the tooltip and tree list), instead of the quantity of the missing ingredient.

For example, a job that smelts 19 iron ingots with no raw iron left in storage showed 361 missing raw iron (19 × 19). It now shows 19. In #233's original report, 13 missing iron ingots for a job with 3 remaining crafts showed as 39.

Testing:

  • New game test testCraftingPlanMissingQuantities: plans 2 chests (16 planks), takes 10 planks out of storage before starting the job, and checks that the running plan reports 10 missing planks. It fails without the fix ("Expected Missing planks to be 10, but was 20").
  • ./gradlew build and all 83 game tests pass.
  • Checked in a dev client, on a world with a furnace minecart setup: planned 4 furnace minecarts, removed the raw iron from storage, and started the job. Before: the missing raw iron tile showed quantity 361, and the compact view "Missing: 361". After: both show 19.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C5iUzweRYoCkKB5bvJdH8Y


Generated by Claude Code

Integrated Crafting reports the missing ingredients of a running job as
the total quantities for all of its remaining crafts, but the crafting
plan multiplied them by the remaining crafts again. The missing element
in the crafting plan also showed the remaining crafts as its missing
quantity, instead of the quantity of the missing ingredient.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5iUzweRYoCkKB5bvJdH8Y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants