Untether LightUpdate and children from BlockFactory

This commit is contained in:
Dylan K. Taylor
2020-09-08 18:14:06 +01:00
parent 0fd3d91038
commit 205617f29e
5 changed files with 65 additions and 10 deletions

View File

@@ -1162,16 +1162,17 @@ class World implements ChunkManager{
}
public function updateAllLight(int $x, int $y, int $z) : void{
$blockFactory = BlockFactory::getInstance();
$this->timings->doBlockSkyLightUpdates->startTiming();
if($this->skyLightUpdate === null){
$this->skyLightUpdate = new SkyLightUpdate($this);
$this->skyLightUpdate = new SkyLightUpdate($this, $blockFactory->lightFilter, $blockFactory->diffusesSkyLight);
}
$this->skyLightUpdate->recalculateNode($x, $y, $z);
$this->timings->doBlockSkyLightUpdates->stopTiming();
$this->timings->doBlockLightUpdates->startTiming();
if($this->blockLightUpdate === null){
$this->blockLightUpdate = new BlockLightUpdate($this);
$this->blockLightUpdate = new BlockLightUpdate($this, $blockFactory->lightFilter, $blockFactory->light);
}
$this->blockLightUpdate->recalculateNode($x, $y, $z);
$this->timings->doBlockLightUpdates->stopTiming();