From 230c827d579d868327f7b0ef31284e1154c80f06 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 12 Aug 2013 14:59:37 +0200 Subject: Chunks are now marked at unused in a function of Chunk. --- mcmap/chunk.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mcmap/chunk.go') 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() -- cgit v1.2.3-54-g00ecf