diff --git a/src/world/light/BlockLightUpdate.php b/src/world/light/BlockLightUpdate.php index d1e2273b7..fc48e27bb 100644 --- a/src/world/light/BlockLightUpdate.php +++ b/src/world/light/BlockLightUpdate.php @@ -50,7 +50,9 @@ class BlockLightUpdate extends LightUpdate{ } public function recalculateNode(int $x, int $y, int $z) : void{ - $block = $this->world->getBlockAt($x, $y, $z); - $this->setAndUpdateLight($x, $y, $z, max($block->getLightLevel(), $this->getHighestAdjacentLight($x, $y, $z) - $this->lightFilters[$block->getFullId()])); + if($this->subChunkHandler->moveTo($x, $y, $z, false)){ + $block = $this->subChunkHandler->currentSubChunk->getFullBlock($x & 0xf, $y & 0xf, $z & 0xf); + $this->setAndUpdateLight($x, $y, $z, max($this->lightEmitters[$block], $this->getHighestAdjacentLight($x, $y, $z) - $this->lightFilters[$block])); + } } } diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index d6678176e..76320628e 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -910,11 +910,21 @@ parameters: count: 1 path: ../../../src/world/light/BlockLightUpdate.php + - + message: "#^Cannot call method getFullBlock\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/light/BlockLightUpdate.php + - message: "#^Only numeric types are allowed in \\-, int\\|null given on the right side\\.$#" count: 1 path: ../../../src/world/light/BlockLightUpdate.php + - + message: "#^Parameter \\#4 \\$newLevel of method pocketmine\\\\world\\\\light\\\\LightUpdate\\:\\:setAndUpdateLight\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: ../../../src/world/light/BlockLightUpdate.php + - message: "#^Cannot call method get\\(\\) on pocketmine\\\\world\\\\format\\\\LightArray\\|null\\.$#" count: 4