LightUpdate: allow providing effective light levels for propagation, fix #2999

This commit is contained in:
Dylan K. Taylor
2019-10-23 21:01:19 +01:00
parent f3f9ebf312
commit a3b73d95a7
2 changed files with 21 additions and 6 deletions

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\world\light;
use pocketmine\block\BlockFactory;
use pocketmine\world\World;
use function max;
class SkyLightUpdate extends LightUpdate{
@ -31,6 +32,14 @@ class SkyLightUpdate extends LightUpdate{
$this->currentLightArray = $this->subChunkHandler->currentSubChunk->getBlockSkyLightArray();
}
protected function getEffectiveLight(int $x, int $y, int $z) : int{
if($y >= World::Y_MAX){
$this->subChunkHandler->invalidate();
return 15;
}
return parent::getEffectiveLight($x, $y, $z);
}
public function recalculateNode(int $x, int $y, int $z) : void{
$chunk = $this->world->getChunk($x >> 4, $z >> 4);
if($chunk === null){