mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
World: remove local static recursion guard variable, closes #3125
This commit is contained in:
parent
f88c4d9a8c
commit
ca4b8a5827
@ -171,6 +171,8 @@ class World implements ChunkManager{
|
|||||||
|
|
||||||
/** @var Entity[] */
|
/** @var Entity[] */
|
||||||
public $updateEntities = [];
|
public $updateEntities = [];
|
||||||
|
|
||||||
|
private bool $inDynamicStateRecalculation = false;
|
||||||
/** @var Block[][] */
|
/** @var Block[][] */
|
||||||
private array $blockCache = [];
|
private array $blockCache = [];
|
||||||
|
|
||||||
@ -1536,17 +1538,15 @@ class World implements ChunkManager{
|
|||||||
|
|
||||||
$block->position($this, $x, $y, $z);
|
$block->position($this, $x, $y, $z);
|
||||||
|
|
||||||
static $dynamicStateRead = false;
|
if($this->inDynamicStateRecalculation){
|
||||||
|
|
||||||
if($dynamicStateRead){
|
|
||||||
//this call was generated by a parent getBlock() call calculating dynamic stateinfo
|
//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).
|
//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.
|
//this ensures that it's impossible for dynamic state properties to recursively depend on each other.
|
||||||
$addToCache = false;
|
$addToCache = false;
|
||||||
}else{
|
}else{
|
||||||
$dynamicStateRead = true;
|
$this->inDynamicStateRecalculation = true;
|
||||||
$block->readStateFromWorld();
|
$block->readStateFromWorld();
|
||||||
$dynamicStateRead = false;
|
$this->inDynamicStateRecalculation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($addToCache && $relativeBlockHash !== null){
|
if($addToCache && $relativeBlockHash !== null){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user