feat: Added support for a chunk's pos to be used as a key

This commit is contained in:
Nicholas Novak 2023-12-11 01:33:15 -08:00
parent 3cc759ce4b
commit 19bbf5beff

View File

@ -35,6 +35,10 @@ type ChunkPos struct {
Z int `json:"z"` Z int `json:"z"`
} }
func (cp ChunkPos) MarshalText() ([]byte, error) {
return []byte(fmt.Sprintf("%d %d", cp.Z, cp.Z)), nil
}
func (cp ChunkPos) ToFileName() string { func (cp ChunkPos) ToFileName() string {
return fmt.Sprintf("p.%d.%d.chunk", cp.X, cp.Z) return fmt.Sprintf("p.%d.%d.chunk", cp.X, cp.Z)
} }