Skip to main content

Module biome_source

Module biome_source 

Source
Expand description

Biome source abstraction for dimension-agnostic biome generation.

Mirrors vanilla’s BiomeSource hierarchy:

  • MultiNoiseBiomeSource — Overworld and Nether (climate parameter matching via RTree)
  • TheEndBiomeSource — The End (spatial + erosion threshold)

Each dimension creates a different BiomeSourceKind variant. The chunk generator calls chunk_sampler() per chunk to get a ChunkBiomeSampler that holds per-chunk caches (column cache, R-tree warm-start index).

§R-tree cache strategy

Vanilla uses ThreadLocal<Leaf> which persists the warm-start index across chunks, making tie-breaking at equidistant biome boundaries depend on chunk generation order. We use a per-sampler cache instead: reset per chunk, deterministic regardless of generation order, and better L1 locality since the cache lives on the sampler struct alongside the column cache. The only cost is one cold start per chunk (1/1536 lookups).

Structs§

EndBiomeSource
Biome source for The End dimension.
EndChunkBiomeSampler
NetherBiomeSource
Multi-noise biome source for the nether.
NetherChunkBiomeSampler
OverworldBiomeSource
Multi-noise biome source for the overworld.
OverworldChunkBiomeSampler

Enums§

BiomeSourceKind
Dimension-specific biome source.
ChunkBiomeSampler
Per-chunk biome sampler with internal caches.

Functions§

distinct_biome_refs 🔒