mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Improved single-threaded chunk generation efficiency
This commit is contained in:
parent
886ad8442c
commit
fde61b7d21
@ -1541,10 +1541,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
unset($this->chunkGenerationQueue["$x:$z"]);
|
||||
$this->setChunk($x, $z, $chunk);
|
||||
$chunk = $this->getChunk($x, $z);
|
||||
if($chunk instanceof FullChunk){
|
||||
if(!($oldChunk instanceof FullChunk) or ($oldChunk->isPopulated() === false and $chunk->isPopulated())){
|
||||
$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));
|
||||
}
|
||||
if($chunk instanceof FullChunk and (!($oldChunk instanceof FullChunk) or $oldChunk->isPopulated() === false) and $chunk->isPopulated()){
|
||||
$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1554,9 +1552,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
foreach($this->getUsingChunk($x, $z) as $player){
|
||||
$player->unloadChunk($x, $z);
|
||||
}
|
||||
unset($this->chunks[$index]);
|
||||
$this->provider->setChunk($x, $z, $chunk);
|
||||
$this->loadChunk($x, $z);
|
||||
$this->chunks[$index] = $chunk;
|
||||
}else{
|
||||
$this->provider->setChunk($x, $z, $chunk);
|
||||
$this->chunks[$index] = $chunk;
|
||||
|
@ -63,10 +63,8 @@ class GenerationLevelManager extends GenerationManager{
|
||||
$this->levels[$levelID]->populateChunk($chunkX, $chunkZ); //Request population directly
|
||||
if(isset($this->levels[$levelID])){
|
||||
foreach($this->levels[$levelID]->getChangedChunks() as $index => $chunk){
|
||||
if($chunk->isPopulated()){
|
||||
$this->sendChunk($levelID, $chunk);
|
||||
$this->levels[$levelID]->cleanChangedChunk($index);
|
||||
}
|
||||
$this->sendChunk($levelID, $chunk);
|
||||
$this->levels[$levelID]->cleanChangedChunk($index);
|
||||
}
|
||||
|
||||
$this->levels[$levelID]->doGarbageCollection();
|
||||
|
Loading…
x
Reference in New Issue
Block a user