Parse aquifer and ore-vein noise routers

The overworld noise_router ships fourteen keys; we read six. The eight left on
the floor are exactly the ones the aquifer, the ore veins and the preliminary
surface estimate need, so every one of those subsystems has been impossible to
write.

Wire the rest of the router into OverworldDensity: barrier,
fluid_level_floodedness, fluid_level_spread and lava for the aquifer,
vein_toggle/vein_ridged/vein_gap for the veins, and preliminary_surface_level
for both. Two node types were missing and are added with them --
minecraft:invert (the reciprocal, not negation: Mapped.Type ordinal 5 is
1.0/input) and minecraft:find_top_surface, which walks down from an upper bound
in cell_height steps looking for positive density.

PreliminarySurfaceLevelAt wraps that node the way NoiseChunk does: quart-align
the column, then memoise. The cache is per generator rather than per chunk
because the aquifer samples columns up to three chunks away, so neighbours
overlap heavily -- with a shared cache a chunk costs a few dozen evaluations
instead of a few thousand.

Also lifts sea_level, min_y, height and the aquifers/ore-veins flags out of the
settings file, and adds PositionalRandomFactory.At for the aquifer cell centres
(Mth.getSeed hashed into the low half of the factory seed).

No generator output changes yet: nothing reads the new keys.
This commit is contained in:
Master290 2026-07-27 01:44:45 +03:00
parent 90e9380ae7
commit ed045ee09d
6 changed files with 378 additions and 21 deletions

View file

@ -7,16 +7,32 @@ package worldgen
type RandomState struct {
factory PositionalRandomFactory
noises map[string]*NormalNoise
// aquifer and ore are the positional factories vanilla derives up front for
// the aquifer cell centres and the ore-vein placement, each a forked
// positional factory seeded from a named hash of the root factory.
aquifer PositionalRandomFactory
ore PositionalRandomFactory
}
// NewRandomState builds the seeding context for the given world seed.
func NewRandomState(seed int64) *RandomState {
root := NewXoroshiro(seed).ForkPositional()
return &RandomState{
factory: NewXoroshiro(seed).ForkPositional(),
factory: root,
noises: make(map[string]*NormalNoise),
aquifer: root.FromHashOf("minecraft:aquifer").ForkPositional(),
ore: root.FromHashOf("minecraft:ore").ForkPositional(),
}
}
// AquiferRandom returns the positional factory the aquifer uses to place its
// cell centres (RandomState.aquiferRandom).
func (rs *RandomState) AquiferRandom() PositionalRandomFactory { return rs.aquifer }
// OreRandom returns the positional factory the ore-vein placement uses
// (RandomState.oreRandom).
func (rs *RandomState) OreRandom() PositionalRandomFactory { return rs.ore }
// Noise returns the NormalNoise for the named noise parameters, seeded as
// NormalNoise.create(factory.fromHashOf(name), params) and cached.
func (rs *RandomState) Noise(name string, firstOctave int, amplitudes []float64) *NormalNoise {