change: Removed chunk storage dir from being a global variable, and added some more tests

This commit is contained in:
Nicholas Novak
2023-11-08 16:24:27 -08:00
parent 378d121566
commit 1766cd4f48
6 changed files with 80 additions and 38 deletions

View File

@@ -2,6 +2,7 @@ package world
import (
"fmt"
"math/rand"
)
const (
@@ -15,6 +16,14 @@ type BlockPos struct {
Z int `json:"z"`
}
func RandomBlockPosWithRange(maxRange float64) BlockPos {
return BlockPos{
X: int(rand.NormFloat64() * maxRange),
Y: uint(rand.NormFloat64() * maxRange),
Z: int(rand.NormFloat64() * maxRange),
}
}
func (b BlockPos) ToChunkPos() ChunkPos {
return ChunkPos{
X: b.X / 16,