Match vanilla ore block traversal
This commit is contained in:
parent
400e76382a
commit
c68c5c2744
4 changed files with 103 additions and 85 deletions
|
|
@ -1,6 +1,9 @@
|
|||
package world
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPlacedOresUseStoneAndDeepslateTargets(t *testing.T) {
|
||||
gen := NewVanillaGenerator(12345)
|
||||
|
|
@ -43,3 +46,23 @@ func TestPlacedOresAreDeterministic(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWalkOreBlocksUsesVanillaCoordinateOrder(t *testing.T) {
|
||||
spheres := []oreSphere{
|
||||
{x: 0.5, y: 0.5, z: 0.5, radius: 1.1},
|
||||
{x: 1.5, y: 0.5, z: 0.5, radius: 1.1},
|
||||
}
|
||||
var got [][3]int
|
||||
walkOreBlocks(spheres, func(x, y, z int) {
|
||||
got = append(got, [3]int{x, y, z})
|
||||
})
|
||||
want := [][3]int{
|
||||
{-1, 0, 0},
|
||||
{0, -1, 0}, {0, 0, -1}, {0, 0, 0}, {0, 0, 1}, {0, 1, 0},
|
||||
{1, -1, 0}, {1, 0, -1}, {1, 0, 0}, {1, 0, 1}, {1, 1, 0},
|
||||
{2, 0, 0},
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("walkOreBlocks = %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue