| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 | // delchunk deletes the chunk at 200, 200
package main
import (
	"flag"
	"fmt"
	"github.com/silvasur/gomcmap/mcmap"
	"os"
)
func main() {
	path := flag.String("path", "", "Path to region directory")
	flag.Parse()
	if *path == "" {
		flag.Usage()
		os.Exit(1)
	}
	region, err := mcmap.OpenRegion(*path, false)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Could not open region: %s\n", err)
		os.Exit(1)
	}
	chunk, err := region.Chunk(200, 200)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error getting chunk 200,200: %s\n", err)
		os.Exit(1)
	}
	chunk.MarkDeleted()
	if err := chunk.MarkUnused(); err != nil {
		fmt.Fprintf(os.Stderr, "Could not mark chunk as unused: %s\n", err)
		os.Exit(1)
	}
	if err := region.Save(); err != nil {
		fmt.Fprintf(os.Stderr, "Could not save region: %s\n", err)
		os.Exit(1)
	}
}
 |