Load vanilla feature stages and place ores
This commit is contained in:
parent
28c11e2fc2
commit
dd2ea56850
10 changed files with 779 additions and 6 deletions
45
internal/world/placed_features_test.go
Normal file
45
internal/world/placed_features_test.go
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package world
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPlacedOresUseStoneAndDeepslateTargets(t *testing.T) {
|
||||
gen := NewVanillaGenerator(12345)
|
||||
want := map[uint16]string{
|
||||
131: "iron ore",
|
||||
132: "deepslate iron ore",
|
||||
5307: "diamond ore",
|
||||
5308: "deepslate diamond ore",
|
||||
}
|
||||
counts := make(map[uint16]int)
|
||||
for cx := int32(-8); cx <= 8; cx += 4 {
|
||||
for cz := int32(-8); cz <= 8; cz += 4 {
|
||||
chunk := gen(cx, cz)
|
||||
for y := MinY; y < 128; y++ {
|
||||
for x := 0; x < 16; x++ {
|
||||
for z := 0; z < 16; z++ {
|
||||
counts[chunk.GetBlock(x, y, z)]++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for state, name := range want {
|
||||
if counts[state] == 0 {
|
||||
t.Errorf("no %s generated by placed ore features", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlacedOresAreDeterministic(t *testing.T) {
|
||||
gen := NewVanillaGenerator(4242)
|
||||
a, b := gen(3, -2), gen(3, -2)
|
||||
for y := MinY; y < MinY+WorldHeight; y++ {
|
||||
for x := 0; x < 16; x++ {
|
||||
for z := 0; z < 16; z++ {
|
||||
if got, want := a.GetBlock(x, y, z), b.GetBlock(x, y, z); got != want {
|
||||
t.Fatalf("block (%d,%d,%d): first %d second %d", x, y, z, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue