PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Add a way to regenerate a chunk

Open dktapps opened this issue 3 years ago • 1 comments

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 PopulationTasks, 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.

dktapps avatar Nov 13 '21 03:11 dktapps

Ok

rac14 avatar Nov 16 '21 07:11 rac14