mc gen start

This commit is contained in:
adman
2026-07-05 10:25:43 +02:00
parent 201e0dfa44
commit a8b090227b
6 changed files with 433 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
package gen
import (
"testing"
)
func TestXoroshiroFromString(t *testing.T) {
x := XoroshiroFromString("minecraft:offset")
if x.L != 0x080518cf6af25384 || x.H != 0x3f3dfb40a54febd5 {
t.Errorf("bad L: %x, H: %x", x.L, x.H)
}
}
func TestSeedChain(t *testing.T) {
var worldSeed int64 = 70388202460762
x := XoroshiroFromSeed(worldSeed)
x.XorString("minecraft:entities/wither_skeleton")
x.Mix()
i := 0
for {
_ = x.NextBound(1)
_ = x.NextBound(2)
if x.NextFloat() < 0.025 {
i++
} else {
break
}
}
if i != 7 {
t.Errorf("expected 7, got %d", i)
}
}
func TestBiome(t *testing.T) {
var worldSeed int64 = 70388202460762
x := XoroshiroFromSeed(worldSeed)
x.Mix()
b := BiomeNoiseFromXoroshiro(x, false)
b.Sample(-1, -16, 0)
}