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:
parent
90e9380ae7
commit
ed045ee09d
6 changed files with 378 additions and 21 deletions
|
|
@ -61,6 +61,17 @@ type RandomSource interface {
|
|||
type PositionalRandomFactory interface {
|
||||
// FromHashOf seeds a child source from the MD5 hash of name.
|
||||
FromHashOf(name string) RandomSource
|
||||
// At seeds a child source from a block position, mirroring
|
||||
// PositionalRandomFactory.at (used by the aquifer and ore veins).
|
||||
At(x, y, z int) RandomSource
|
||||
}
|
||||
|
||||
// positionSeed is Mth.getSeed: a scrambled hash of a block position, used to
|
||||
// seed positional random factories.
|
||||
func positionSeed(x, y, z int) int64 {
|
||||
l := int64(int32(x)*3129871) ^ int64(z)*116129781 ^ int64(y)
|
||||
l = l*l*42317861 + l*11
|
||||
return l >> 16
|
||||
}
|
||||
|
||||
// --- Xoroshiro128++ ---
|
||||
|
|
@ -142,6 +153,12 @@ func (f *xoroshiroPositional) FromHashOf(name string) RandomSource {
|
|||
return newXoroshiroFrom(lo^f.seedLo, hi^f.seedHi)
|
||||
}
|
||||
|
||||
// At mirrors XoroshiroPositionalRandomFactory.at: the position hash XORed into
|
||||
// the low half of the factory seed, the high half kept as is.
|
||||
func (f *xoroshiroPositional) At(x, y, z int) RandomSource {
|
||||
return newXoroshiroFrom(uint64(positionSeed(x, y, z))^f.seedLo, f.seedHi)
|
||||
}
|
||||
|
||||
// --- Legacy LCG (java.util.Random) ---
|
||||
|
||||
const (
|
||||
|
|
@ -211,6 +228,11 @@ func (f *legacyPositional) FromHashOf(name string) RandomSource {
|
|||
return NewLegacy(int64(int32(javaStringHashCode(name))) ^ int64(f.seed))
|
||||
}
|
||||
|
||||
// At mirrors LegacyPositionalRandomFactory.at.
|
||||
func (f *legacyPositional) At(x, y, z int) RandomSource {
|
||||
return NewLegacy(positionSeed(x, y, z) ^ int64(f.seed))
|
||||
}
|
||||
|
||||
func javaStringHashCode(s string) int32 {
|
||||
var h int32
|
||||
for i := 0; i < len(s); i++ {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue