Biome-aware surface rules from the vanilla rule tree

Replaces the biome-blind fillVanillaColumn heuristics with a full
interpreter for the overworld surface_rule tree (already embedded in
overworld.json): block/sequence/condition/bandlands rules plus all 11
condition tests (biome, steep, hole, water, temperature, y_above,
stone_depth, noise_threshold, not, vertical_gradient,
above_preliminary_surface).

- worldgen/blockids.go: name(+Properties)→network-ID table for surface
  blocks (grass/sand/terracotta/mycelium/podzol/coarse_dirt/sandstone/
  calcite/snow/ice/...), with snowy property variants.
- worldgen/surface.go: rule-tree parser + interpreter + SurfaceContext;
  LoadOverworldSurfaceRule caches the seed-independent tree.
- loader.go: OverworldDensity.SurfaceRule() exposes the parsed tree.
- biome_lookup.go: BiomeNameAt returns the biome name for biome tests.
- vanilla.go: samples the 2D climate + biome before column fill, threads
  the rule tree and biome name into fillVanillaColumn, and applies it
  top-down with stone as the default for non-matching (deeper) blocks.
  The above_preliminary_surface gate uses an inclusive bound so the top
  solid block reaches the biome dispatch.
- Performance: one per-column RNG and a reused SurfaceContext keep the
  overhead to ~+13ms/chunk (71ms vs 58ms baseline), within the gate.
This commit is contained in:
Master290 2026-06-24 19:44:07 +03:00
parent d3142e7687
commit 4dcf938a85
8 changed files with 934 additions and 26 deletions

View file

@ -15,6 +15,8 @@ const (
)
// Common block-state network IDs (from the generated block report).
// Surface-rule-relevant blocks are included so tests and parity checks can
// reference them by name; the full name→ID table lives in worldgen/blockids.go.
const (
StateAir uint16 = 0
StateStone uint16 = 1
@ -26,6 +28,20 @@ const (
StateGravel uint16 = 124
StateOakLog uint16 = 137
StateOakLeaf uint16 = 279
// Surface-rule blocks (IDs captured from blocks.json 26.1.2).
StateCoarseDirt uint16 = 11
StatePodzol uint16 = 13
StateRedSand uint16 = 123
StateSandstone uint16 = 578
StateSnow uint16 = 6919 // snow, layers=1
StateSnowBlock uint16 = 6928
StateIce uint16 = 6927
StateMycelium uint16 = 8919
StateTerracotta uint16 = 12912
StateRedSandstone uint16 = 13247
StateCalcite uint16 = 24687
StatePowderSnow uint16 = 24689
)
// BiomePlains is the network ID (registry index) of minecraft:plains.