From 72fb49b35616b6ecf6c9f012ebfac966fbec73dc Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 7 Sep 2021 20:18:53 +0100 Subject: [PATCH] World: add notifyNeighbourBlockUpdate() to allow triggering neighbour block updates on blocks manually this can be useful if blocks were modified asynchronously. --- src/world/World.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/world/World.php b/src/world/World.php index f4304b08e8..1675aef96d 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -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[] */