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