world: ruined portal stub matches vanilla's saved start bit-for-bit

Three fixes close the loop against the captured region file: the giant
roll precedes the template draw, surfaceY is the topmost non-air block
(getHeight already returns one past it), and structure biome refs
resolve through has_structure/ tags to the extracted tag files. The
weighted variant pick walks a fresh per-attempt GenerationContext
stream while failed entries drop from the pick stream without reseeding.

TestRuinedPortalStubMatchesVanillaStart pins chunk (1,0) to vanilla's
own saved start: portal_6, CLOCKWISE_90, mirror NONE, air pocket,
template position (16,12,0) — and asserts the neighbouring fixture
chunks stay portal-free.
This commit is contained in:
Daniar Mannanov 2026-08-26 14:42:18 +03:00
parent 798a3ec7b4
commit 90eb08f37d
4 changed files with 88 additions and 3 deletions

View file

@ -270,11 +270,15 @@ func (s *StructureSets) StructuresInSet(set string) []*StructureDef {
}
// BiomesFor resolves a structure def's biome reference ("#tag" or a single
// name) to concrete biome names with the minecraft: prefix.
// name) to concrete biome names with the minecraft: prefix. Structure JSONs
// reference tags through the has_structure/ namespace, but the extracted tag
// files drop that prefix.
func (s *StructureSets) BiomesFor(def *StructureDef) []string {
ref := def.Biomes
if strings.HasPrefix(ref, "#") {
return s.BiomeTags["minecraft:"+strings.TrimPrefix(ref[1:], "minecraft:")]
name := strings.TrimPrefix(ref[1:], "minecraft:")
name = strings.TrimPrefix(name, "has_structure/")
return s.BiomeTags["minecraft:"+name]
}
return []string{"minecraft:" + ref}
}