Evaluate world-aware block predicates

This commit is contained in:
Daniar Mannanov 2026-08-11 13:13:02 +03:00
parent 1a921434d9
commit 4ff62d7c96
3 changed files with 196 additions and 1 deletions

View file

@ -129,13 +129,17 @@ func (r *decorationRegion) sourceBiomes() []string {
}
func (r *decorationRegion) placementContext(biomeAllows func(worldgen.FeaturePosition) bool) worldgen.PlacementContext {
set, err := worldgen.LoadFeatureSet()
if err != nil {
panic("world: loading feature datapack: " + err.Error())
}
return worldgen.PlacementContext{
MinY: MinY,
Height: WorldHeight,
BiomeAllows: biomeAllows,
HeightAt: r.heightAt,
BlockPredicate: func(predicate json.RawMessage, position worldgen.FeaturePosition) (bool, error) {
return false, fmt.Errorf("world: unsupported block predicate at (%d,%d,%d): %s", position.X, position.Y, position.Z, predicate)
return r.testBlockPredicate(set, predicate, position)
},
}
}