Add spawn-centered projection options - #52
Open
TimStewartJ wants to merge 2 commits into
Open
Conversation
Adds the persisted boolean `world_scale_at_spawn` (codec fallback false, so existing worlds decode unchanged). When enabled, the World Scale control in the customize and terrain-preload screens is interpreted as real-world metres per block at the spawn point instead of at the equator; the stored `world_scale` remains the equatorial value (displayed * sec(spawnLat)), so terrain generation itself is untouched. - EarthGeneratorSettings: new component, codec field, DEFAULT, with* helpers, groundScaleAtSpawn/displayedWorldScale/equatorialWorldScale conversions, plus withSpawn/withWorldScale convenience constructors. - EarthCustomizeScreen (pre-26, mc262): toggle under World Scale; slider is converted on toggle so the generated world does not change; roads/buildings gate and auto-adjust use the equatorial value. - TerrainPreloadScreen (pre-26, mc262, mc262-neoforge): scale box edits the displayed value and re-derives the stored scale when the area centre (future spawn) moves. - Lang (en/es/ja), README, codec + conversion tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the persisted `center_world_on_spawn` setting (codec fallback false) and a per-world WorldProjection that translates the existing spherical Mercator origin to the selected spawn without changing Mercator distortion. Existing worlds remain on the historical 0N 0E origin bit-for-bit. - Put spawn at block X=0, Z=0 when enabled, so vanilla origin-centered mechanics (including stronghold rings) and normal play remain near spawn. - Route terrain, elevation, land cover/mask, climate, canopy, OSM geometry, roads/buildings/water, previews, preloads, map teleport coordinates, real-time lookups, full chunks, and fast DH LODs through WorldProjection. - Keep normalized elevation caches keyed in global projected metres, with valid antimeridian wrapping and canonical polar bounds. - Handle moved-seam tile queries, preload bounds, and seam-crossing geometry without planet-spanning roads, bridges, buildings, or water polygons. - Preserve legacy preload fingerprints for both default-false UI fields and retain binary compatibility for the biome classification provider SPI. - Add the off-by-default UI toggle to both customize screens, propagate it through all three preload screens, and document/localize it (en/es/ja). - Add checkProjectionUsage to prevent future block/geographic bypasses. - Add codec, projection, cache, seam, preload, and compatibility tests. Validation: ./gradlew build (all six targets; 2,918 tests, zero failures) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TimStewartJ
marked this pull request as ready for review
August 26, 2026 23:59
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 draft adds two independent, off-by-default world settings:
X=0, Z=0.It introduces a saved
WorldProjectionand routes terrain, climate, canopy, OSM, previews, preloads, teleports, realtime queries, normalized elevation caching, full chunks, and Fast Distant Horizons LODs through the same projection model.Related prior implementation: #28 by @ForMooN-0118. That PR demonstrated the value of a local-origin mode and has a report that Distant Horizons did not align. This implementation was developed independently before I discovered #28; I am explicitly linking it here to credit the prior work and coordinate rather than silently compete with it.
Motivation
At non-equatorial spawns, the historical scale value is an equatorial Mercator scale rather than the scale players experience around the selected location. Large absolute coordinates also make origin-centered gameplay and some physics/rendering mods less practical around the chosen spawn.
These settings address those concerns separately:
This remains a conventional spherical Mercator projection; it is not an oblique projection and does not change Mercator angles.
Implementation notes
falseand preserve historical coordinates.checkProjectionUsagerejects new direct block/geographic conversions that bypassWorldProjection.Commit structure
056ac3fa- Phase A: add off-by-default Scale Measured At Spawncc957e1c- Phase B: add off-by-default Center World On Spawn projectionThe commits are intentionally separated for review. Phase B is cross-cutting because every geographic/block coordinate path must agree; I am happy to adjust the review or split strategy based on maintainer preference.
Automated validation
A clean
gradlew.bat clean buildcompleted successfully across all supported targets. All 77 Gradle tasks executed from clean outputs.All six production jars were generated.
Manual release-candidate checklist
Initial Yosemite runtime smoke testing passed. Unchecked items remain useful non-blocking follow-ups:
AI assistance
Implementation, codebase tracing, and review were AI-assisted under human direction. The branch was manually inspected and the complete clean build/test matrix above was executed locally.
Initial runtime result
Minecraft 26.2 Fabric successfully generated and saved a Yosemite world with both settings enabled. The saved world data confirms local 1:1 scale normalization at 37.7466 N, exact centered spawn at X=0/Z=0, and both settings persisted. Fast Distant Horizons generated 1,090 full-data rows and 798 chunk hashes; Tellus, DH, Iris, and OpenGL initialized without a Tellus/DH exception. Visual generation looked correct in the initial play test.