mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
World: clean up lighting update API
This commit is contained in:
parent
3768f3008e
commit
9aab97578b
@ -228,7 +228,7 @@ class Explosion{
|
||||
$t->onBlockDestroyed(); //needed to create drops for inventories
|
||||
}
|
||||
$this->world->setBlockAt($pos->x, $pos->y, $pos->z, $airBlock, false); //TODO: should updating really be disabled here?
|
||||
$this->world->updateAllLight($pos);
|
||||
$this->world->updateAllLight($pos->x, $pos->y, $pos->z);
|
||||
}
|
||||
|
||||
foreach(Facing::ALL as $side){
|
||||
|
@ -1245,9 +1245,20 @@ class World implements ChunkManager{
|
||||
return $light < 0 ? 0 : $light;
|
||||
}
|
||||
|
||||
public function updateAllLight(Vector3 $pos){
|
||||
$this->updateBlockSkyLight($pos->x, $pos->y, $pos->z);
|
||||
$this->updateBlockLight($pos->x, $pos->y, $pos->z);
|
||||
public function updateAllLight(int $x, int $y, int $z) : void{
|
||||
$this->timings->doBlockSkyLightUpdates->startTiming();
|
||||
if($this->skyLightUpdate === null){
|
||||
$this->skyLightUpdate = new SkyLightUpdate($this);
|
||||
}
|
||||
$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->recalculateNode($x, $y, $z);
|
||||
$this->timings->doBlockLightUpdates->stopTiming();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1277,17 +1288,6 @@ class World implements ChunkManager{
|
||||
return $max;
|
||||
}
|
||||
|
||||
public function updateBlockSkyLight(int $x, int $y, int $z){
|
||||
$this->timings->doBlockSkyLightUpdates->startTiming();
|
||||
|
||||
if($this->skyLightUpdate === null){
|
||||
$this->skyLightUpdate = new SkyLightUpdate($this);
|
||||
}
|
||||
$this->skyLightUpdate->recalculateNode($x, $y, $z);
|
||||
|
||||
$this->timings->doBlockSkyLightUpdates->stopTiming();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the highest block light level available in the positions adjacent to the specified block coordinates.
|
||||
*
|
||||
@ -1315,18 +1315,7 @@ class World implements ChunkManager{
|
||||
return $max;
|
||||
}
|
||||
|
||||
public function updateBlockLight(int $x, int $y, int $z){
|
||||
$this->timings->doBlockLightUpdates->startTiming();
|
||||
|
||||
if($this->blockLightUpdate === null){
|
||||
$this->blockLightUpdate = new BlockLightUpdate($this);
|
||||
}
|
||||
$this->blockLightUpdate->recalculateNode($x, $y, $z);
|
||||
|
||||
$this->timings->doBlockLightUpdates->stopTiming();
|
||||
}
|
||||
|
||||
public function executeQueuedLightUpdates() : void{
|
||||
private function executeQueuedLightUpdates() : void{
|
||||
if($this->blockLightUpdate !== null){
|
||||
$this->timings->doBlockLightUpdates->startTiming();
|
||||
$this->blockLightUpdate->execute();
|
||||
@ -1493,7 +1482,7 @@ class World implements ChunkManager{
|
||||
|
||||
if($update){
|
||||
if($oldBlock->getLightFilter() !== $block->getLightFilter() or $oldBlock->getLightLevel() !== $block->getLightLevel()){
|
||||
$this->updateAllLight($pos);
|
||||
$this->updateAllLight($x, $y, $z);
|
||||
}
|
||||
$this->tryAddToNeighbourUpdateQueue($pos);
|
||||
foreach($pos->sides() as $side){
|
||||
|
Loading…
x
Reference in New Issue
Block a user