World: add notifyNeighbourBlockUpdate() to allow triggering neighbour block updates on blocks manually

this can be useful if blocks were modified asynchronously.
This commit is contained in:
Dylan K. Taylor 2021-09-07 20:18:53 +01:00
parent ac55b21fb4
commit 72fb49b356
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -1164,6 +1164,17 @@ class World implements ChunkManager{
}
}
/**
* Notify the blocks at and around the position that the block at the position may have changed.
* This will cause onNeighbourBlockUpdate() to be called for these blocks.
*/
public function notifyNeighbourBlockUpdate(Vector3 $pos) : void{
$this->tryAddToNeighbourUpdateQueue($pos);
foreach($pos->sides() as $side){
$this->tryAddToNeighbourUpdateQueue($side);
}
}
/**
* @return Block[]
*/