mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
PopulationTask: ensure that unmodified chunks don't get sent back to the main thread for no reason
This commit is contained in:
parent
ce5e663a73
commit
d57954dff0
@ -79,7 +79,14 @@ class PopulationTask extends AsyncTask{
|
||||
/** @var string[] $serialChunks */
|
||||
$serialChunks = igbinary_unserialize($this->adjacentChunks);
|
||||
$chunks = array_map(
|
||||
fn(?string $serialized) => $serialized !== null ? FastChunkSerializer::deserializeTerrain($serialized) : null,
|
||||
function(?string $serialized) : ?Chunk{
|
||||
if($serialized === null){
|
||||
return null;
|
||||
}
|
||||
$chunk = FastChunkSerializer::deserializeTerrain($serialized);
|
||||
$chunk->clearTerrainDirtyFlags(); //this allows us to avoid sending existing chunks back to the main thread if they haven't changed during generation
|
||||
return $chunk;
|
||||
},
|
||||
$serialChunks
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user