mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Generator no longer requires a ChunkManager to construct
this allows injection of arbitrary ChunkManagers into a single Generator instance. The objective here was to remove the requirement to cache a SimpleChunkManager instance in worker-local storage, because that requires that the chunks it stores be manually removed to avoid memory leaks. However, there are some other obstacles, primarily the worldHeight which is not retained anywhere else.
This commit is contained in:
@ -100,7 +100,7 @@ class PopulationTask extends AsyncTask{
|
||||
|
||||
$manager->setChunk($chunk->getX(), $chunk->getZ(), $chunk);
|
||||
if(!$chunk->isGenerated()){
|
||||
$generator->generateChunk($chunk->getX(), $chunk->getZ());
|
||||
$generator->generateChunk($manager, $chunk->getX(), $chunk->getZ());
|
||||
$chunk = $manager->getChunk($chunk->getX(), $chunk->getZ());
|
||||
$chunk->setGenerated();
|
||||
}
|
||||
@ -108,13 +108,13 @@ class PopulationTask extends AsyncTask{
|
||||
foreach($chunks as $i => $c){
|
||||
$manager->setChunk($c->getX(), $c->getZ(), $c);
|
||||
if(!$c->isGenerated()){
|
||||
$generator->generateChunk($c->getX(), $c->getZ());
|
||||
$generator->generateChunk($manager, $c->getX(), $c->getZ());
|
||||
$chunks[$i] = $manager->getChunk($c->getX(), $c->getZ());
|
||||
$chunks[$i]->setGenerated();
|
||||
}
|
||||
}
|
||||
|
||||
$generator->populateChunk($chunk->getX(), $chunk->getZ());
|
||||
$generator->populateChunk($manager, $chunk->getX(), $chunk->getZ());
|
||||
$chunk = $manager->getChunk($chunk->getX(), $chunk->getZ());
|
||||
$chunk->setPopulated();
|
||||
|
||||
|
Reference in New Issue
Block a user