worldgen: parse structure sets and place them on the vanilla grid

Loads the 26.1.2 structure datapack: 20 structure sets, 34 structure
definitions, and the worldgen biome tags they reference. Random-spread
placement follows RandomSpreadStructurePlacement byte for byte — region
floorDiv by spacing, one Legacy stream salted per region, two
spread-type draws for the offset — and the four legacy frequency
reducers keep their exact draws, including the hardcoded buried-treasure
salt and the outpost's discarded full-range int.

Verified against the fixture: on seed 12345 the ruined_portals set
claims exactly chunk (1,0), the chunk whose captured blocks carry the
ruined portal's obsidian, gold, and crying obsidian. TestStructure-
PlacementGrid pins that plus village separation invariants.
This commit is contained in:
Daniar Mannanov 2026-08-26 10:33:10 +03:00
parent f162698302
commit c488ce274f
125 changed files with 2123 additions and 0 deletions

View file

@ -233,6 +233,14 @@ func (r *Legacy) SetLargeFeatureSeed(seed int64, chunkX, chunkZ int) {
r.SetSeed(int64(chunkX)*a ^ int64(chunkZ)*b ^ seed)
}
// SetLargeFeatureWithSalt is WorldgenRandom.setLargeFeatureWithSalt: one
// multiply-add mix, no draws. The constants are the classic population-seed
// multipliers and the formula is what every random-spread structure placement
// and legacy frequency reducer reads.
func (r *Legacy) SetLargeFeatureWithSalt(seed int64, chunkX, chunkZ, salt int) {
r.SetSeed(int64(chunkX)*341873128712 + int64(chunkZ)*132897987541 + seed + int64(salt))
}
// SetDecorationSeed is WorldgenRandom.setDecorationSeed. It returns the seed
// used for the chunk's feature stages; individual features derive their seeds
// from this value, stage index, and feature index.