Skip to content

2.0.06: take stored campaign supplies back before gathering; split AutoGrind's inventory helpers - #20

Merged
MrHakan merged 2 commits into
mainfrom
ccr-5681ba59-e5pne2
Oct 9, 2026
Merged

MrHakan merged 2 commits into
mainfrom
ccr-5681ba59-e5pne2

Conversation

@MrHakan

@MrHakan MrHakan commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Summary

This finishes item D1 of the 2.1.00 major plan and delivers item D2. There are two commits.

1. Move AutoGrind's inventory helpers out of GrindExecutor (no behaviour change)

  • What moved: the last helper family left in the executor: counting by generic name, preparing the hotbar and the right tool, and building crafting-grid clicks.
  • New shape:
    • Instance helpers are now g.items (GrindItems).
    • The static stack tests (countStack, usable, validTool) are now GrindItems.x.
    • GrindExecutor goes from 584 to 341 lines of lifecycle, plan building and campaign state.
  • How it was moved: with the same compiler-guided move as 2.0.04 and 2.0.05. Inside the executor only the call form was rewritten, because it has locals and lambda parameters with the same names.
  • Check: the 20 moved members (225 lines) match the originals apart from the executor prefix.

2. Take stored campaign supplies back before gathering them (D2)

Problem. The campaign deposited surplus into its base chests and never took any of it back. A later goal that needed stored ingots or sticks either gathered them again or paused for manual help when there was nothing left to gather.

What AutoGrind knows about storage.

  • GrindStorage (g.storage) holds the campaign's storage chests. These were the executor's survivalStorage plus a copy in SurvivalTasks.
  • It also keeps a ledger of what AutoGrind last saw in each chest. StorageTask and the new WithdrawTask record a chest's contents every tick they have it open.
  • Renamed, enchanted and nearly broken stacks are never recorded and never taken.

When a goal visits storage. Before each fresh plan, ItemGoalTask asks which chests are worth visiting.

  • Storage is considered only when CraftingPlan has something to gather. A plan that only crafts never makes a detour.
  • Only chests in range count: within 64 blocks with Baritone, within reach without it.
  • A registered chest AutoGrind has not opened this session is visited once to find out what it holds.

What gets taken. GrindWithdrawal is a pure, unit-tested planner. It walks the recipe chain top-down and at each item spends carried stock, then stored stock, then ingredients. So a stored ingot is taken in preference to smelting carried ore, and nothing that carried stock already covers is taken.

How the withdrawal runs. WithdrawTask:

  • recomputes that plan from the chest's live contents once it is open;
  • keeps two inventory slots free;
  • skips a chest it cannot reach or open instead of pausing the campaign — withdrawal is a shortcut, never a new reason to stop;
  • enforces its own 2,400-tick budget.

Limits.

  • A goal re-plans through storage at most three times.
  • Mining coal for enchanting experience never takes coal from storage, since taken coal gives no levels.

docs/AUTOGRIND.md no longer says "Stored supplies are not automatically withdrawn"; it now describes the behaviour above.

Validation (local, Java 25 + Xvfb)

  • ./gradlew build: 932 tests, 0 failures. GrindWithdrawalTest adds 9 of them.
  • tools/smoke-client.sh passed, including every AutoGrind scenario. The new SurvivalTasksGameTest scenario works like this:
    1. AutoGrind deposits its surplus ingots and sticks.
    2. It then makes an iron pickaxe on a stone floor with no ore. Without the withdrawal this would pause.
    3. It takes exactly 3 ingots and 2 of the 4 sticks.
    4. A renamed stack in the same chest stays untouched.
  • tools/test-baritone.sh passed against real Baritone 26.2. It covered 384-block travel, remote mining, rebuilding a tool mid-goal, returning to an unloaded base, door and chest access, and replacement-goal ownership.

Release

mod_version=2.0.06, with a CHANGELOG.md section.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TGuJsde5s6BFqgC63uNGrh


Generated by Claude Code

claude added 2 commits October 9, 2026 10:56
The last helper family left in the executor counted carried stacks by generic name, prepared hotbar items and tools, and built crafting-grid clicks. They are now g.items (GrindItems); the static stack tests (countStack, usable, validTool) are GrindItems.x. The executor is down from 584 to 341 lines of lifecycle, plan building and campaign state.

Same compiler-guided move as 2.0.04 and 2.0.05: members were cut out unchanged, callers were routed through the new field (g.count -> g.items.count, GrindExecutor.countStack -> GrindItems.countStack; inside the executor only the call form was rewritten, because it has locals and lambda parameters with the same names), and unresolved executor references in the moved code were prefixed from javac's own errors. The 20 moved members (225 lines) match the originals apart from that prefix. Release as 2.0.06.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGuJsde5s6BFqgC63uNGrh
Until now the survival campaign deposited surplus into its base chests and never took any of it back, so a later goal that needed stored ingots or sticks re-gathered them or paused for help where nothing was left to gather (item D2 of the major plan).

GrindStorage (g.storage) now holds the campaign's storage chests, which were the executor's survivalStorage and a copy in SurvivalTasks, and a ledger of what AutoGrind last saw in each one: StorageTask and the new WithdrawTask record a chest's contents every tick they have it open. Renamed, enchanted and nearly broken stacks are left out of the ledger and are never taken.

Before each fresh plan, ItemGoalTask asks which chests are worth visiting. Storage is only considered when CraftingPlan has something to gather, only for chests within 64 blocks with Baritone or within reach without it, and a registered chest not yet opened this session is visited once. GrindWithdrawal (pure, unit tested) walks the recipe chain top-down, spending carried stock, then stored stock, then ingredients, so a stored ingot beats smelting carried ore and nothing carried stock covers is taken. WithdrawTask recomputes that plan from the chest's live contents once it is open, keeps two inventory slots free, skips a chest it cannot reach or open rather than pausing the campaign, and enforces its own 2,400-tick budget because its goal ticks it directly. A goal re-plans at most three times through storage. Mining coal for enchanting experience opts out, since taken coal would give no levels.

SurvivalTasksGameTest has AutoGrind deposit surplus ingots and sticks, then make an iron pickaxe on a stone floor with no ore from what it stored, taking exactly 3 ingots and 2 of 4 sticks and leaving a renamed stack in the same chest untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGuJsde5s6BFqgC63uNGrh
Copilot AI balanced review requested due to automatic review settings October 9, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MrHakan
MrHakan merged commit 4b66cc9 into main Oct 9, 2026
1 check passed
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.

3 participants