feat: Finished testing Unity files and got retrieval working

This commit is contained in:
Nicholas Novak
2023-12-11 09:22:50 -08:00
parent 5c4ee2bc2e
commit e0f1cd2436
3 changed files with 137 additions and 6 deletions

View File

@@ -3,6 +3,8 @@ package world
import (
"fmt"
"math/rand"
"strconv"
"strings"
)
type BlockPos struct {
@@ -36,7 +38,25 @@ type ChunkPos struct {
}
func (cp ChunkPos) MarshalText() ([]byte, error) {
return []byte(fmt.Sprintf("%d %d", cp.Z, cp.Z)), nil
return []byte(fmt.Sprintf("%d %d", cp.X, cp.Z)), nil
}
func (cp *ChunkPos) UnmarshalText(text []byte) error {
words := strings.Split(string(text), " ")
x, err := strconv.Atoi(words[0])
if err != nil {
return err
}
z, err := strconv.Atoi(words[1])
if err != nil {
return err
}
cp.X = x
cp.Z = z
return nil
}
func (cp ChunkPos) ToFileName() string {