ChunkEditor.getOrCreateWriteBuffer

Returns writeable copy of current chunk snapshot. This buffer is valid until commit. After commit this buffer becomes next immutable snapshot. Returns null if chunk is not added and/or not loaded. If write buffer was not yet created then it is created based on policy.

If allowNonLoaded is enabled, then will create write buffer even if chunk is in non_loaded state. Useful for offline generation and conversion tools that write directly to chunk manager. You can write all chunk at once and then commit. Internal user will prevent write buffers from unloading. And on commit a save will be performed automatically.

BUG: returned pointer points inside hash table. If new write buffer is added hash table can reallocate. Do not create new write buffers while keeping pointer to any write buffer. Reallocation can prevent changes to buffers obtained earlier than reallocation to be invisible.

class ChunkEditor
WriteBuffer*
getOrCreateWriteBuffer
(
ChunkWorldPos cwp
,
ubyte layer
,
WriteBufferPolicy policy = WriteBufferPolicy.createUniform
,
bool allowNonLoaded = false
)

Meta