Skip to content

Fix incorrect Astral Map distance (measured from interior player position)#2156

Merged
drtheodor merged 1 commit into
amblelabs:mainfrom
Nitjsefnie:fix/2029-astral-map-distance
Jul 16, 2026
Merged

Fix incorrect Astral Map distance (measured from interior player position)#2156
drtheodor merged 1 commit into
amblelabs:mainfrom
Nitjsefnie:fix/2029-astral-map-distance

Conversation

@Nitjsefnie

@Nitjsefnie Nitjsefnie commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

About the PR

The Astral Map's structure and biome finders reported wildly wrong "blocks away" numbers — the issue shows ~10,741 for a structure ~600 blocks away, and a second case of ~12,000 where ~1,658 was expected (the non-constant ratio ruled out a simple unit error).

I couldn't reproduce it live (no client in my build environment), so this is a reasoned fix against the coordinate model plus the reporter's numbers rather than an observed in-game before/after — worth a maintainer sanity-check in-game before merge.

Disclosure: this contribution was made with AI assistance (Claude), reviewed and built by a human-directed process before submission.

Why / Balance

Fixes #2029.

Technical details

Root cause is a coordinate-space mix-up. Both handleStructureRequest and handleBiomeRequest in AstralMapBlock.java only run when the player is inside the TARDIS interior dimension (they're guarded by TardisServerWorld.isTardisDimension(world)). The search runs in the target world from the TARDIS's exterior position (tPos.getPos() / currentPos.getPos()), and the located structure/biome is a coordinate in that target world — but the distance was computed against player.getPos(), which is the player's position in the interior dimension, an unrelated coordinate space. Subtracting interior coords from target-world coords produces the garbage distance.

The fix measures the distance from the TARDIS's exterior search origin (the same reference the result was located from and reported relative to), in both finders:

  • structure: newPos.getSquaredDistance(player.getPos())newPos.getSquaredDistance(tPos.getPos())
  • biome: locatedBiome.getSquaredDistance(player.getPos())locatedBiome.getSquaredDistance(start)

(tPos.getPos() rather than the local pos because pos is reassigned and so isn't capturable by the async thenOnServerThread lambda; it holds the identical value.)

Media

Requirements

Breaking changes

None

Changelog

🆑

  • fix: incorrect astral map distance calculation

The structure/biome finders are only reachable from inside the TARDIS
interior dimension, but the reported distance was computed against
player.getPos() (interior coords) while the located result is in the
target world. Measure from the TARDIS exterior position instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Nitjsefnie
Nitjsefnie requested a review from a team as a code owner July 16, 2026 22:04
@github-actions github-actions Bot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. S: Needs Review Status: Requires additional reviews before being fully accepted. size/XS Denotes a PR that changes 0-9 lines. labels Jul 16, 2026
@GSMPBot
GSMPBot requested a review from Loqor July 16, 2026 22:04
@drtheodor drtheodor added T: Bugfix Type: Bugs and/or bugfixes. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Jul 16, 2026

@drtheodor drtheodor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@drtheodor drtheodor added the A: Console Area: Tardis console. label Jul 16, 2026
@drtheodor
drtheodor merged commit 62ebf37 into amblelabs:main Jul 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Console Area: Tardis console. S: Needs Review Status: Requires additional reviews before being fully accepted. size/XS Denotes a PR that changes 0-9 lines. T: Bugfix Type: Bugs and/or bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Calculation on structure distance

2 participants