LightUpdate: remove premature optimisation which breaks when mass-update lighting is used

when setBlockSkyLightArray/setBlockLightArray was used, currentLightArray would retain a reference to the old light array, which would cause false readings if SubChunkExplorer didn't move away from that subchunk and back.
This causes a small degradation of performance, but I think it can be implemented differently anyway.
This also fixes #3816.
This commit is contained in:
Dylan K. Taylor
2020-10-27 18:01:31 +00:00
parent 05ab75b5ce
commit 0ecd68e4a7
3 changed files with 17 additions and 16 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\world\light;
use pocketmine\world\format\LightArray;
use pocketmine\world\utils\SubChunkExplorer;
use pocketmine\world\utils\SubChunkExplorerStatus;
use pocketmine\world\World;
@ -47,8 +48,8 @@ class SkyLightUpdate extends LightUpdate{
$this->directSkyLightBlockers = $directSkyLightBlockers;
}
protected function updateLightArrayRef() : void{
$this->currentLightArray = $this->subChunkExplorer->currentSubChunk->getBlockSkyLightArray();
protected function getCurrentLightArray() : LightArray{
return $this->subChunkExplorer->currentSubChunk->getBlockSkyLightArray();
}
protected function getEffectiveLight(int $x, int $y, int $z) : int{