summaryrefslogtreecommitdiff
path: root/mcmap/chunk.go
diff options
context:
space:
mode:
Diffstat (limited to 'mcmap/chunk.go')
-rw-r--r--mcmap/chunk.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/mcmap/chunk.go b/mcmap/chunk.go
index 0ba12f8..496fd0c 100644
--- a/mcmap/chunk.go
+++ b/mcmap/chunk.go
@@ -53,6 +53,8 @@ type Chunk struct {
modified bool
blocks []Block // Ordered YZX
biomes []Biome // Ordered XZ
+
+ reg *Region
}
// MarkModified needs to be called, if some data of the chunk was modified.
@@ -90,4 +92,11 @@ func (c *Chunk) Biome(x, z int) Biome { return c.biomes[x*16+z] }
// SetBiome sets the biome at x,z.
func (c *Chunk) SetBiome(x, z int, bio Biome) { c.biomes[x*16+z] = bio }
+// MarkUnused marks the chunk as unused. If all chunks of a superchunk are marked as unused, the superchunk will be unloaded and saved (if needed).
+//
+// You must not use the chunk any longer, after you called this function.
+//
+// If the chunk was modified, call MarkModified BEFORE.
+func (c *Chunk) MarkUnused() error { return c.reg.unloadChunk(int(c.x), int(c.z)) }
+
// TODO: func (c *Chunk) RecalcHeightMap()