Match vanilla ore ellipsoid geometry

This commit is contained in:
Daniar Mannanov 2026-08-11 00:56:53 +03:00
parent b11e6f14cb
commit a23650fc0b
3 changed files with 14 additions and 13 deletions

View file

@ -106,24 +106,25 @@ func flattenBlockTag(set *worldgen.FeatureSet, tag string, visiting map[string]b
}
func placeOreEllipsoid(c *Chunk, random worldgen.RandomSource, originX, originY, originZ, size int, discard float64, targets []resolvedOreTarget) {
angle := float64(random.NextFloat()) * math.Pi
extent := float64(size) / 8.0
x0 := float64(originX) + math.Sin(angle)*extent
x1 := float64(originX) - math.Sin(angle)*extent
z0 := float64(originZ) + math.Cos(angle)*extent
z1 := float64(originZ) - math.Cos(angle)*extent
angle := random.NextFloat() * float32(math.Pi)
extent := float32(size) / 8.0
x0 := float64(originX) + math.Sin(float64(angle))*float64(extent)
x1 := float64(originX) - math.Sin(float64(angle))*float64(extent)
z0 := float64(originZ) + math.Cos(float64(angle))*float64(extent)
z1 := float64(originZ) - math.Cos(float64(angle))*float64(extent)
y0 := float64(originY + int(random.NextIntN(3)) - 2)
y1 := float64(originY + int(random.NextIntN(3)) - 2)
type sphere struct{ x, y, z, radius float64 }
spheres := make([]sphere, size)
for i := 0; i < size; i++ {
t := float64(i) / float64(size)
radius := (math.Sin(math.Pi*t) + 1.0) * (float64(random.NextDouble())*float64(size)/16.0 + 1.0) / 2.0
t := float32(i) / float32(size)
randomScale := random.NextDouble() * float64(size) / 16.0
radius := ((float64(worldgen.MthSin(float64(float32(math.Pi)*t)))+1.0)*randomScale + 1.0) / 2.0
spheres[i] = sphere{
x: x0 + (x1-x0)*t,
y: y0 + (y1-y0)*t,
z: z0 + (z1-z0)*t,
x: x0 + (x1-x0)*float64(t),
y: y0 + (y1-y0)*float64(t),
z: z0 + (z1-z0)*float64(t),
radius: radius,
}
}

View file

@ -33,7 +33,7 @@ const dataVersion26 = 4790
// first time it ran: chunkAt prefers the store over the generator, so the
// already-explored area around spawn keeps its old terrain and every later fix
// looks like it did nothing in exactly the place you are standing.
const generatorVersion = 16
const generatorVersion = 17
// generatorVersionTag is the NBT key holding generatorVersion. It is namespaced
// because it is ours, not part of the vanilla chunk format.

View file

@ -129,7 +129,7 @@ func TestVanillaBlockParity(t *testing.T) {
// The ordinary CI profile is a regression floor while the port is still
// incomplete. REGIONIO_REQUIRE_PARITY upgrades the same exhaustive audit to
// exact equality; there is no sampled or summary-only comparison path.
if percent(blockExact, blockTotal) < 90 || biomeExact != biomeTotal || heightExact != heightTotal {
if percent(blockExact, blockTotal) < 91 || biomeExact != biomeTotal || heightExact != heightTotal {
t.Fatalf("vanilla parity regressed below the committed baseline")
}
if os.Getenv("REGIONIO_REQUIRE_PARITY") == "1" && (blockExact != blockTotal || biomeExact != biomeTotal || heightExact != heightTotal) {