mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
DaylightSensor: Avoid triggering useless block updates if calculated power is unchanged
This commit is contained in:
parent
774e6fe8a3
commit
4c694c57f4
@ -95,8 +95,11 @@ class DaylightSensor extends Transparent{
|
||||
}
|
||||
|
||||
public function onScheduledUpdate() : void{
|
||||
$this->power = $this->recalculatePower();
|
||||
$this->pos->getWorld()->setBlock($this->pos, $this);
|
||||
$newPower = $this->recalculatePower();
|
||||
if($this->power !== $newPower){
|
||||
$this->power = $newPower;
|
||||
$this->pos->getWorld()->setBlock($this->pos, $this);
|
||||
}
|
||||
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, 20);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user