Skip to content

Fix 2x2 sapling replant landing offset from the chopped trunk - #2

Merged
awdrgyj8 merged 1 commit into
masterfrom
claude/auto-tree-planting-misalignment-eol4ae
Aug 31, 2026
Merged

Fix 2x2 sapling replant landing offset from the chopped trunk#2
awdrgyj8 merged 1 commit into
masterfrom
claude/auto-tree-planting-misalignment-eol4ae

Conversation

@awdrgyj8

Copy link
Copy Markdown
Member

The 2x2 replant formation could be planted up to one block off on each axis from the trunk that was actually chopped.

Two causes stacked:

  • The log recorded as the replant anchor was "the first log with the lowest Y", and a 2x2 trunk's four base logs all share that Y. The discovery set is a HashSet, so the winner was an arbitrary one of the four corners.

  • isLikely2x2Tree() already scanned the chopped-log set and computed the trunk's real minimum-corner anchor, but discarded it and returned only a boolean. find2x2PlantLocation() then re-guessed the anchor from that arbitrary corner, trying the origin-as-minimum-corner candidate first. With the tree gone the ground is flat, so the offset square passed the clear-and-soil check and was accepted. Dark Oak and Pale Oak skipped the footprint scan entirely, so their anchor was always a guess.

Return the anchor from the footprint scan instead of a boolean and plant on it, falling back to the search only when that footprint is no longer plantable or was never detected (partial chop). Run the scan for Dark Oak and Pale Oak too, keeping their unconditional 2x2 behaviour via isAlways2x2().

Also order the anchor candidates by Y, then X, then Z, so the recorded corner is the minimum one and, above all, deterministic on the fallback path.

Claude-Session: https://claude.ai/code/session_01DLvC3xDtLN8xhL6fok7RKW

The 2x2 replant formation could be planted up to one block off on each
axis from the trunk that was actually chopped.

Two causes stacked:

* The log recorded as the replant anchor was "the first log with the
  lowest Y", and a 2x2 trunk's four base logs all share that Y. The
  discovery set is a HashSet, so the winner was an arbitrary one of the
  four corners.

* isLikely2x2Tree() already scanned the chopped-log set and computed the
  trunk's real minimum-corner anchor, but discarded it and returned only
  a boolean. find2x2PlantLocation() then re-guessed the anchor from that
  arbitrary corner, trying the origin-as-minimum-corner candidate first.
  With the tree gone the ground is flat, so the offset square passed the
  clear-and-soil check and was accepted. Dark Oak and Pale Oak skipped
  the footprint scan entirely, so their anchor was always a guess.

Return the anchor from the footprint scan instead of a boolean and plant
on it, falling back to the search only when that footprint is no longer
plantable or was never detected (partial chop). Run the scan for Dark Oak
and Pale Oak too, keeping their unconditional 2x2 behaviour via
isAlways2x2().

Also order the anchor candidates by Y, then X, then Z, so the recorded
corner is the minimum one and, above all, deterministic on the fallback
path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLvC3xDtLN8xhL6fok7RKW
@awdrgyj8
awdrgyj8 merged commit 0512752 into master Aug 31, 2026
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