PocketMine-MP
PocketMine-MP copied to clipboard
Add a way to regenerate a chunk
Description
On PM3 it was possible to regenerate a chunk by calling setGenerated(false)
on the target chunk and then calling populateChunk()
. This is no longer possible in PM4 because ungenerated chunks are represented by NULL, and it's not possible to set a chunk to NULL after the fact (the API doesn't permit it, and it wouldn't be a good idea either - nothing in the core expects a chunk to randomly become null).
Therefore, a new way is needed to trigger regeneration of chunks - perhaps a forceRegeneration
flag for orderChunkPopulation
.
Alternative methods
It is possible to manually generate and replace chunks by creating your own PopulationTask
s, but this requires a lot more code and it's necessary to replicate internals behaviour (e.g. pre-emptively registering generator on a new worker before scheduling task), which can't be done perfectly due to lack of ability to access some internal World
state.
Ok