Match vanilla placement height sampling

This commit is contained in:
Daniar Mannanov 2026-08-11 09:42:11 +03:00
parent e9fe526300
commit 674d0192c9
2 changed files with 30 additions and 7 deletions

View file

@ -80,3 +80,20 @@ func TestFeatureStepsRejectsCycles(t *testing.T) {
t.Fatal("cyclic feature order succeeded")
}
}
func TestPlacementHeightDistributionsStayWithinInclusiveBounds(t *testing.T) {
r := NewLegacy(12345)
for _, distribution := range []string{"minecraft:trapezoid", "minecraft:very_biased_to_bottom", "minecraft:uniform"} {
plan := PlacementPlan{
HeightDistribution: distribution,
MinY: HeightProvider{Absolute: intPtr(-20)},
MaxY: HeightProvider{Absolute: intPtr(20)},
}
for i := 0; i < 1000; i++ {
got := plan.SampleY(r, -64, 384)
if got < -20 || got > 20 {
t.Fatalf("%s sample %d outside [-20,20]: %d", distribution, i, got)
}
}
}
}