description |
---|
This page describes what you need to know about chunks management, more specifically for InstanceContainer |
When trying to load a chunk, the instance container does multiple checks in this order:
- Verify if the chunk is already loaded (stop here if yes)
- Try to load the chunk from the instance IChunkLoader using IChunkLoader#loadChunk (stop here if the chunk loading is successful)
- Create a new chunk and execute the instance ChunkGenerator (if any) to it to generate all of the chunk's blocks.
When trying to save a chunk, IChunkLoader#saveChunk is called.
AnvilLoader
is the default chunk loader used by all InstanceContainer
Chunk is an abstract class, you can simply create a new class extending it to create your own implementation.
Making your own chunk implementation allows you to customize how you want blocks to be stored, how you want chunks tick to happen, etc...
If you are using a simple InstanceContainer with the default IChunkLoader you will just need to change the instance's chunk supplier
instanceContainer.setChunkSupplier(YOUR_CHUNK_SUPPLIER);
It will be called when a chunk object needs to be provided.