From ce77e283ab5bf1f2ecbe03a771691f156aca2e14 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 5 Jul 2019 19:56:58 +0100 Subject: [PATCH] Revert "fix race condition between chunk generation and light population" This reverts commit 80747814fb769d5cbed2ea6a351ef218c9f9b0c9. --- src/pocketmine/world/World.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/world/World.php b/src/pocketmine/world/World.php index f29102f3b..c4bedd673 100644 --- a/src/pocketmine/world/World.php +++ b/src/pocketmine/world/World.php @@ -2483,7 +2483,6 @@ class World implements ChunkManager{ (new ChunkLoadEvent($this, $chunk, !$chunk->isGenerated()))->call(); if(!$chunk->isLightPopulated() and $chunk->isPopulated()){ - $this->lockChunk($x, $z); $this->getServer()->getAsyncPool()->submitTask(new LightPopulationTask($this, $chunk)); } @@ -2739,20 +2738,18 @@ class World implements ChunkManager{ if(isset($this->chunkPopulationQueue[$index = World::chunkHash($x, $z)]) or (count($this->chunkPopulationQueue) >= $this->chunkPopulationQueueSize and !$force)){ return false; } - + for($xx = -1; $xx <= 1; ++$xx){ + for($zz = -1; $zz <= 1; ++$zz){ + if($this->isChunkLocked($x + $xx, $z + $zz)){ + return false; + } + } + } $chunk = $this->getChunk($x, $z, true); if(!$chunk->isPopulated()){ Timings::$populationTimer->startTiming(); - for($xx = -1; $xx <= 1; ++$xx){ - for($zz = -1; $zz <= 1; ++$zz){ - if($this->isChunkLocked($x + $xx, $z + $zz)){ - return false; - } - } - } - $this->chunkPopulationQueue[$index] = true; for($xx = -1; $xx <= 1; ++$xx){ for($zz = -1; $zz <= 1; ++$zz){