Skip to content

ChunkManager

CoppaMan edited this page Apr 25, 2017 · 1 revision

Constructor:

ChunkManager(int size, string path)
Sets up a new ChunkManager with capacity of size cubed which saves chunks to the path path.
Example: ChunkManager(16,chunks/for/me) => Saves up to 4096 chunks per file to ProjectRoot/chunks/for/me/[file]

Do not save to or load from chunks which have been previously written with a different size. Incorrect behavior will most definitly occur.

Accessible methods:

SaveChunk(int x, int y, int z ,byte[] chunks)
Saves the chunks bytes to the file with corresponding chunk position x y and z, overwriting the old bytes of an existing chunk. Creates a new file for the chunk if necessary.

LoadChunk(int x,y,z ,byte[] chunks) : byte[]
Loads the bytes from the corresponding file and the chunk position x y and z, returning null iff there is no file or no chunk at the position.

Coverage(int x, int y, int z) : double
Returns the percentage of set chunks in the file in respect to its capacity from the file with coarse coordinates x y and z.

Clone this wiki locally