Repository navigation
2.0.06: take stored campaign supplies back before gathering; split AutoGrind's inventory helpers - #20
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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)g.items(GrindItems).countStack,usable,validTool) are nowGrindItems.x.GrindExecutorgoes from 584 to 341 lines of lifecycle, plan building and campaign state.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'ssurvivalStorageplus a copy inSurvivalTasks.StorageTaskand the newWithdrawTaskrecord a chest's contents every tick they have it open.When a goal visits storage. Before each fresh plan,
ItemGoalTaskasks which chests are worth visiting.CraftingPlanhas something to gather. A plan that only crafts never makes a detour.What gets taken.
GrindWithdrawalis 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:Limits.
docs/AUTOGRIND.mdno 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.GrindWithdrawalTestadds 9 of them.tools/smoke-client.shpassed, including every AutoGrind scenario. The newSurvivalTasksGameTestscenario works like this:tools/test-baritone.shpassed 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 aCHANGELOG.mdsection.🤖 Generated with Claude Code
https://claude.ai/code/session_01TGuJsde5s6BFqgC63uNGrh
Generated by Claude Code