BlockLightUpdate: actually use lightEmitters

I accidentally added this during a separation of my local changes, but it's useful anyway, so we should use it.
This removes BlockLightUpdate's implicit dependency on Block, which is a
step towards native light.
This commit is contained in:
Dylan K. Taylor 2020-09-08 18:20:53 +01:00
parent 205617f29e
commit ec6ac59b9c
2 changed files with 14 additions and 2 deletions

View File

@ -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]));
}
}
}

View File

@ -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