diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-08-12 14:59:37 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-08-12 14:59:37 +0200 |
commit | 230c827d579d868327f7b0ef31284e1154c80f06 (patch) | |
tree | 5a116ac75e15469989330bb3e33be09d9520b5a2 /mcmap/chunk.go | |
parent | 40b8da6d026d43328242b252aea3a09f8939e756 (diff) | |
download | gomcmap-230c827d579d868327f7b0ef31284e1154c80f06.tar.gz gomcmap-230c827d579d868327f7b0ef31284e1154c80f06.tar.bz2 gomcmap-230c827d579d868327f7b0ef31284e1154c80f06.zip |
Chunks are now marked at unused in a function of Chunk.
Diffstat (limited to 'mcmap/chunk.go')
-rw-r--r-- | mcmap/chunk.go | 9 |
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() |