diff --git a/src/world/World.php b/src/world/World.php index 13dc24d1e..549a0f501 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -171,6 +171,8 @@ class World implements ChunkManager{ /** @var Entity[] */ public $updateEntities = []; + + private bool $inDynamicStateRecalculation = false; /** @var Block[][] */ private array $blockCache = []; @@ -1536,17 +1538,15 @@ class World implements ChunkManager{ $block->position($this, $x, $y, $z); - static $dynamicStateRead = false; - - if($dynamicStateRead){ + if($this->inDynamicStateRecalculation){ //this call was generated by a parent getBlock() call calculating dynamic stateinfo //don't calculate dynamic state and don't add to block cache (since it won't have dynamic state calculated). //this ensures that it's impossible for dynamic state properties to recursively depend on each other. $addToCache = false; }else{ - $dynamicStateRead = true; + $this->inDynamicStateRecalculation = true; $block->readStateFromWorld(); - $dynamicStateRead = false; + $this->inDynamicStateRecalculation = false; } if($addToCache && $relativeBlockHash !== null){