From 2684ee96f7d7c4850c0acbc28e149006a22b33a7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 1 Nov 2020 15:53:50 +0000 Subject: [PATCH] World: do not perform base lighting calculation on non-generated chunks this was causing twice as many light calculations for freshly generated chunks. --- src/world/World.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/world/World.php b/src/world/World.php index 393fc8d24..934ca83ca 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -930,6 +930,13 @@ class World implements ChunkManager{ $dz = mt_rand(-$randRange, $randRange); $hash = World::chunkHash($dx + $chunkX, $dz + $chunkZ); if(!isset($chunkTickList[$hash]) and isset($this->chunks[$hash])){ + if( + !$this->chunks[$hash]->isGenerated() || + !$this->chunks[$hash]->isPopulated() || + $this->isChunkLocked($dx + $chunkX, $dz + $chunkZ) + ){ + continue; + } //TODO: this might need to be checked after adjacent chunks are loaded in future $lightPopulatedState = $this->chunks[$hash]->isLightPopulated(); if($lightPopulatedState !== true){