Stop the saved world from masking generator changes

chunkAt prefers the store over the generator, and nothing invalidated a stored
chunk when the generator changed. Combined with four region files committed to
the repo, the chunks around spawn were frozen output from an older generator:
worldgen fixes looked like they did nothing in exactly the area you land in when
you join, and a fresh clone inherited that world.

Chunks now carry a RegionIOGeneratorVersion stamp, written on save and checked on
load; a mismatch returns ErrChunkNotFound so the caller regenerates. Chunks
written before the stamp existed have no tag, decode as 0, and are invalidated
the same way. Bump the constant in any commit that changes generator output.

This is deliberately per-chunk and deliberately quiet. The world metadata file
already guards the seed, where a mismatch means two incompatible terrains and
refusing to open is right. A generator change is routine by comparison and should
just regenerate.

world/region/*.mca and chat.md are untracked (left on disk) and /world/ is
gitignored, superseding the narrower /world/regionio-world.json rule, along with
/.refjava/ and root-level session transcripts.

CLAUDE.md covers the parts of working here that README does not: the
no-dependencies rule, the version-stamp rule and why forgetting it looks like a
failed fix, where the vanilla ground truth lives and how to query the jar
directly with unzip and javap, the precedent for dumping runtime constants with a
throwaway Java program, and an honest list of which layers are bit-exact versus
approximated.
This commit is contained in:
Master290 2026-07-27 01:28:05 +03:00
parent 0a2845fa76
commit 90e9380ae7
9 changed files with 224 additions and 606 deletions

14
.gitignore vendored
View file

@ -16,10 +16,22 @@
# All build-time embeds live under internal/; generated/ is not needed to build.
/generated/
# Decompiled vanilla sources kept locally for reference (not redistributable).
/.refjava/
# Generated world. Chunks are reproducible from the seed, and committing them is
# actively harmful: the store takes priority over the generator, so a stale
# region file pins old terrain around spawn and hides worldgen changes. This
# supersedes the narrower /world/regionio-world.json rule.
/world/
# Logs and runtime artefacts
/logs/
*.log
/world/regionio-world.json
# Development notes and session transcripts kept locally, not source.
/chat.md
/20[0-9][0-9]-*.txt
# Editor / tool local config
/.claude/