func cmdChunk(args []string) (err error) { if len(args) < 3 || len(args) > 4 { os.Stderr.WriteString("usage: " + os.Args[0] + " chunk <world path> <chunk x> <chunk z> [dimension]\n") return } worldPath := args[0] x, err := strconv.Atoi(args[1]) if err != nil { return } z, err := strconv.Atoi(args[2]) if err != nil { return } dimension := DimensionNormal if len(args) >= 4 { var dimInt int dimInt, err = strconv.Atoi(args[3]) if err != nil { return } dimension = DimensionId(dimInt) } worldStore, err := worldstore.LoadWorldStore(worldPath) if err != nil { return } chunkLoc := ChunkXz{ChunkCoord(x), ChunkCoord(z)} store, err := worldStore.ChunkStoreForDimension(dimension) if err != nil { return } chunkResult := <-store.ReadChunk(chunkLoc) if chunkResult.Err != nil { return chunkResult.Err } fmt.Printf("Chunk %#v data:\n", chunkLoc) displayNbt(1, chunkResult.Reader.RootTag()) return }
func cmdLevel(args []string) (err error) { if len(args) != 1 { os.Stderr.WriteString("usage: " + os.Args[0] + " level <world path>\n") return } worldPath := args[0] worldStore, err := worldstore.LoadWorldStore(worldPath) if err != nil { return } displayNbt(1, worldStore.LevelData) return }