Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Faster chunk setting on provider
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Dec 12, 2014
1 parent c81bbda commit 71d602a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/pocketmine/level/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -1756,8 +1756,7 @@ public function generateChunkCallback($x, $z, FullChunk $chunk){
$oldChunk = $this->getChunk($x, $z, false);
unset($this->chunkGenerationQueue[Level::chunkHash($x, $z)]);
$this->setChunk($x, $z, $chunk);
$chunk = $this->getChunk($x, $z, false);
if($chunk !== null and (!($oldChunk !== null) or $oldChunk->isPopulated() === false) and $chunk->isPopulated()){
if($chunk !== null and ($oldChunk === null or $oldChunk->isPopulated() === false) and $chunk->isPopulated()){
$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/pocketmine/level/format/mcregion/McRegion.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ public function setChunk($chunkX, $chunkZ, FullChunk $chunk){
$chunk->setZ($chunkZ);


if($this->getChunk($chunkX, $chunkZ, false) !== $chunk){
if(isset($this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)]) and $this->chunks[$index] !== $chunk){
$this->unloadChunk($chunkX, $chunkZ, false);
}

$this->chunks[Level::chunkHash($chunkX, $chunkZ)] = $chunk;
$this->chunks[$index] = $chunk;
}

public static function createChunkSection($Y){
Expand Down

0 comments on commit 71d602a

Please sign in to comment.