From 2e45398072b38e352867ca67974bd42210fffdc9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 4 Sep 2020 18:08:42 +0100 Subject: [PATCH] World: skip random block ticking on chunks that don't have any light typically this is a state that only lasts for a tick or so, but it's a race condition that is regardless very commonly encountered. If you were very unlucky, you might have noticed grass randomly dying when you were spawning or flying around, even though it was in full sky light. --- src/world/World.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/world/World.php b/src/world/World.php index 04c0f48d4..eed6459f6 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -894,6 +894,9 @@ 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]->isLightPopulated()){ + continue; + } //check adjacent chunks are loaded for($cx = -1; $cx <= 1; ++$cx){ for($cz = -1; $cz <= 1; ++$cz){