refactor!: farm and build jobs on fixed sweep routes #108

Merged
gecko merged 1 commit from t3/farm-pathing-architecture-cleanup into main 2026-11-04 08:47:51 +00:00
Owner

Summary

Architecture cleanup plus a systemic rewrite of farm movement, harvesting and building.

  • BotModule split. The 3,461-line module now holds settings, the job slot, survival interrupts and event routing. FarmJob and BuildJob own their stages, processes and actions; ChestTrip (open/re-send/verify), Interaction (server-observed aims and rays) and LagClock are shared.
  • No more native FarmProcess. A recorded build-farm run showed 42 HARVEST↔COLLECT flips in five minutes, about 3.8 plants/s, and a farmer stall with 570 empty cells. Both modes now walk fixed SweepRoute lanes through one SweepTraversal.
  • Normal farming auto-replants. Each ripe cell is broken and replanted on one look (aimed at the soil through the crop), and initial gaps are planted in the same pass. The bot stops just before work it would pass and only takes work whose drops land where it still walks; it waits out the pickup delay after near breaks. Lanes are every second row; reverse passes own the row toward the next lane, and the lane after any worked band is always walked.
  • Toolmode on a fixed route. Four passes over 100 tiles. Up to tool-swings (default 2) swings in flight on disjoint tiles. Tiles confirmed in a pass wait for the next one, so regrowth can't pin the bot. Fragments never clip intact tiles (an irrigation-centered tile previously cascaded into ~180 misaligned swings). One-pass jobs confirm their last swings before completing.
  • Robustness. Holds and exit waits give up after 60 ticks without an action, so slow confirmations don't cut work short. Server rejections only count within 10 ticks, so boosted regrowth isn't mistaken for a rejection. Job deadlines pause while the server stops ticking.
  • Building. One placement per tick with the next cell pre-aimed, coverage-maximizing anchors, till-then-plant batches. Chest visits only when the inventory can't start a phase; they're balanced per phase, return empty buckets every visit (fixes INVENTORY_FULL on the third water trip), and return leftover materials (never tools or seeds) before verification. Material swaps no longer displace AutoEat's hotbar food.
  • Docs. README, AGENTS.md and PRISM.md rewritten to the current contract. The Prism setup template no longer writes the removed farmRange key. logs/ (written by test runs) is now ignored.

Breaking change

  • Farms are always the 2×2-chunk layout (32×32 region, 30×30 plot). Square/radius profiles, farm save <name> <radius>, preview sizes, and the build-farm/preview-farm aliases are gone.
  • Profile JSON is format 2. Older profiles are ignored with a one-time warning and dropped by the next profile save, so save existing farms again (e.g. wart1).
  • Autostart farm jobs must name a saved profile; farmRange is rejected with a pointer to the fix.
  • Seed reserve and idle timeout moved from profiles to farm-seed-reserve and farm-idle-timeout.

New tunables (push the anti-cheat limits, tune down if needed)

Setting Default Vanilla held key
harvest-interval 1 tick 1 tick (held attack)
plant-interval 1 tick 4 ticks (held use)
tool-swings 2 in flight —
build-interval 1 tick 4 ticks

With both intervals at 1, a normal-mode cell is broken and replanted in the same tick.

Evidence

Server-free simulations with vanilla walking physics, pickup box and delay, drop scatter, and rays blocked by ripe crops:

  • Normal farming, fully ripe plot: one pass in 3,221 ticks (~161 s) with 900 breaks + 900 replants on the same tick. 98.7% of drops collected; the rest scatter past the far edge and are picked up before growth waits. Across 30 seeds × 4 regrowth speeds × 4 start positions: no invariant failures, worst pickup 98.1%, worst time 3,313 ticks. Regrowth down to 1 tick never pins the bot.
  • Toolmode: 100 swings in ~697 ticks (~35 s, matching the live pass time) up to a 10-tick server delay with 2 swings in flight; a single swing slows from a 6-tick delay. Irrigated farms take all 884 crops in 101 swings.

Not tested live. The aim/movement coupling, server-side anti-cheat response to the faster defaults, the build pipeline and chest flows have only been exercised by unit tests and simulations.

Validation

Tested commit: 7a5fc8e

./scripts/ci-preflight.sh
./gradlew --no-daemon --max-workers=1 '-Dorg.gradle.jvmargs=-Xms128m -Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8' lint build
./scripts/check-release-jar.sh

All passed locally (lint clean, 256/256 tests, jar boundaries verified).

CI run (build.yml on 7a5fc8e): https://git.glitched.systems/gecko/mcbot/actions/runs/887

## Summary Architecture cleanup plus a systemic rewrite of farm movement, harvesting and building. - **`BotModule` split.** The 3,461-line module now holds settings, the job slot, survival interrupts and event routing. `FarmJob` and `BuildJob` own their stages, processes and actions; `ChestTrip` (open/re-send/verify), `Interaction` (server-observed aims and rays) and `LagClock` are shared. - **No more native `FarmProcess`.** A recorded build-farm run showed 42 HARVEST↔COLLECT flips in five minutes, about 3.8 plants/s, and a farmer stall with 570 empty cells. Both modes now walk fixed `SweepRoute` lanes through one `SweepTraversal`. - **Normal farming auto-replants.** Each ripe cell is broken and replanted on one look (aimed at the soil through the crop), and initial gaps are planted in the same pass. The bot stops just before work it would pass and only takes work whose drops land where it still walks; it waits out the pickup delay after near breaks. Lanes are every second row; reverse passes own the row toward the next lane, and the lane after any worked band is always walked. - **Toolmode on a fixed route.** Four passes over 100 tiles. Up to `tool-swings` (default 2) swings in flight on disjoint tiles. Tiles confirmed in a pass wait for the next one, so regrowth can't pin the bot. Fragments never clip intact tiles (an irrigation-centered tile previously cascaded into ~180 misaligned swings). One-pass jobs confirm their last swings before completing. - **Robustness.** Holds and exit waits give up after 60 ticks *without an action*, so slow confirmations don't cut work short. Server rejections only count within 10 ticks, so boosted regrowth isn't mistaken for a rejection. Job deadlines pause while the server stops ticking. - **Building.** One placement per tick with the next cell pre-aimed, coverage-maximizing anchors, till-then-plant batches. Chest visits only when the inventory can't start a phase; they're balanced per phase, return empty buckets every visit (fixes `INVENTORY_FULL` on the third water trip), and return leftover materials (never tools or seeds) before verification. Material swaps no longer displace AutoEat's hotbar food. - **Docs.** README, AGENTS.md and PRISM.md rewritten to the current contract. The Prism `setup` template no longer writes the removed `farmRange` key. `logs/` (written by test runs) is now ignored. ## Breaking change - Farms are always the 2×2-chunk layout (32×32 region, 30×30 plot). Square/radius profiles, `farm save <name> <radius>`, preview sizes, and the `build-farm`/`preview-farm` aliases are gone. - Profile JSON is format 2. Older profiles are ignored with a one-time warning and dropped by the next profile save, so **save existing farms again** (e.g. `wart1`). - Autostart farm jobs must name a saved profile; `farmRange` is rejected with a pointer to the fix. - Seed reserve and idle timeout moved from profiles to `farm-seed-reserve` and `farm-idle-timeout`. ## New tunables (push the anti-cheat limits, tune down if needed) | Setting | Default | Vanilla held key | | --- | --- | --- | | `harvest-interval` | 1 tick | 1 tick (held attack) | | `plant-interval` | 1 tick | 4 ticks (held use) | | `tool-swings` | 2 in flight | — | | `build-interval` | 1 tick | 4 ticks | With both intervals at 1, a normal-mode cell is broken and replanted in the same tick. ## Evidence Server-free simulations with vanilla walking physics, pickup box and delay, drop scatter, and rays blocked by ripe crops: - **Normal farming, fully ripe plot:** one pass in 3,221 ticks (~161 s) with 900 breaks + 900 replants on the same tick. 98.7% of drops collected; the rest scatter past the far edge and are picked up before growth waits. Across 30 seeds × 4 regrowth speeds × 4 start positions: no invariant failures, worst pickup 98.1%, worst time 3,313 ticks. Regrowth down to 1 tick never pins the bot. - **Toolmode:** 100 swings in ~697 ticks (~35 s, matching the live pass time) up to a 10-tick server delay with 2 swings in flight; a single swing slows from a 6-tick delay. Irrigated farms take all 884 crops in 101 swings. **Not tested live.** The aim/movement coupling, server-side anti-cheat response to the faster defaults, the build pipeline and chest flows have only been exercised by unit tests and simulations. ## Validation Tested commit: `7a5fc8e` ```sh ./scripts/ci-preflight.sh ./gradlew --no-daemon --max-workers=1 '-Dorg.gradle.jvmargs=-Xms128m -Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8' lint build ./scripts/check-release-jar.sh ``` All passed locally (lint clean, 256/256 tests, jar boundaries verified). CI run (`build.yml` on `7a5fc8e`): https://git.glitched.systems/gecko/mcbot/actions/runs/887
refactor!: farm and build jobs on fixed sweep routes
All checks were successful
build / Java 25 build (pull_request) Successful in 3m40s
7a5fc8e611
Split the 3,461-line BotModule into the module (settings, job slot,
survival, event routing) and FarmJob/BuildJob, with shared ChestTrip,
Interaction and LagClock helpers.

Farming no longer drives Baritone's native FarmProcess. Both modes walk
fixed SweepRoute lanes through one SweepTraversal:
- Normal farming breaks and replants each ripe cell on one look, plants
  initial gaps in the same pass, and only takes work whose drops land
  where the traversal still walks. Reverse traversals own the row toward
  the next lane, and the lane after any worked band is walked to collect.
- Toolmode walks four passes over 100 tiles with up to tool-swings
  concurrent swings on disjoint tiles, never clipping an intact tile.
  One-pass jobs confirm their last swings before completing.
- Holds and exit waits give up only after 60 ticks without an action.
  Server rejections count only within a 10-tick window, so boosted
  regrowth is not mistaken for one.

Building pipelines placements one block per tick, chooses anchors by
coverage, batches tilling then planting, and plans balanced supply
visits that return empty buckets every visit and leftovers at the end.

New settings: harvest-interval, plant-interval, tool-swings and
build-interval (all defaulting to faster than held vanilla keys),
farm-seed-reserve and farm-idle-timeout.

BREAKING CHANGE: farms are always the 2x2-chunk layout. Square/radius
profiles, the profile JSON format, farmRange autostart, build-farm and
preview-farm aliases and preview sizes are removed. Older profiles are
ignored with a warning; save those farms again.
gecko merged commit 23d726fe06 into main 2026-11-04 08:47:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gecko/mcbot!108
No description provided.