change: Removed chunk storage dir from being a global variable, and added some more tests
This commit is contained in:
		@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user