Level: use block directly in updateBlockSkyLight()

This commit is contained in:
Dylan K. Taylor 2018-09-19 15:07:24 +01:00
parent 48a5eeb3a4
commit ef038d9625

View File

@ -1404,14 +1404,14 @@ class Level implements ChunkManager, Metadatable{
$this->timings->doBlockSkyLightUpdates->startTiming();
$oldHeightMap = $this->getHeightMap($x, $z);
$sourceId = $this->getBlockIdAt($x, $y, $z);
$source = $this->getBlockAt($x, $y, $z);
$yPlusOne = $y + 1;
if($yPlusOne === $oldHeightMap){ //Block changed directly beneath the heightmap. Check if a block was removed or changed to a different light-filter.
$newHeightMap = $this->getChunk($x >> 4, $z >> 4)->recalculateHeightMapColumn($x & 0x0f, $z & 0x0f);
}elseif($yPlusOne > $oldHeightMap){ //Block changed above the heightmap.
if(BlockFactory::$lightFilter[$sourceId] > 1 or BlockFactory::$diffusesSkyLight[$sourceId]){
if($source->getLightFilter() > 0 or $source->diffusesSkyLight()){
$this->setHeightMap($x, $z, $yPlusOne);
$newHeightMap = $yPlusOne;
}else{ //Block changed which has no effect on direct sky light, for example placing or removing glass.