Diagnose ore feature seed indices

This commit is contained in:
Daniar Mannanov 2026-08-17 01:37:40 +03:00
parent cb60050801
commit 51b4891f81
3 changed files with 122 additions and 38 deletions

View file

@ -44,12 +44,29 @@ func TestOreScheduleDiagnostic(t *testing.T) {
for _, feature := range schedule {
placed := mustFeatureSet(t).Placed[feature.Name]
if mustFeatureSet(t).Configured[placed.Feature].Type == "minecraft:ore" {
t.Logf("source (%d,%d) %s index=%d", target.X, target.Z, feature.Name, feature.Index)
local := localFeatureIndices(mustFeatureSet(t), region.sourceBiomes(), undergroundOresStage, feature.Name)
t.Logf("source (%d,%d) %s global=%d local=%v", target.X, target.Z, feature.Name, feature.Index, local)
}
}
}
}
func localFeatureIndices(set *worldgen.FeatureSet, biomes []string, stage int, feature string) map[string]int {
indices := make(map[string]int)
for _, biomeName := range biomes {
biome := set.Biomes[biomeName]
if stage >= len(biome.Features) {
continue
}
for index, name := range biome.Features[stage] {
if name == feature {
indices[biomeName] = index
}
}
}
return indices
}
func mustFeatureSet(t *testing.T) *worldgen.FeatureSet {
t.Helper()
set, err := worldgen.LoadFeatureSet()