mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-17 19:50:18 +00:00
Merge branch 'next-minor' into next-major
This commit is contained in:
@@ -173,6 +173,8 @@ class World implements ChunkManager{
|
||||
|
||||
/** @var Entity[] */
|
||||
public array $updateEntities = [];
|
||||
|
||||
private bool $inDynamicStateRecalculation = false;
|
||||
/** @var Block[][] */
|
||||
private array $blockCache = [];
|
||||
|
||||
@@ -1559,21 +1561,19 @@ 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;
|
||||
$replacement = $block->readStateFromWorld();
|
||||
if($replacement !== $block){
|
||||
$replacement->position($this, $x, $y, $z);
|
||||
$block = $replacement;
|
||||
}
|
||||
$dynamicStateRead = false;
|
||||
$this->inDynamicStateRecalculation = false;
|
||||
}
|
||||
|
||||
if($addToCache && $relativeBlockHash !== null){
|
||||
|
Reference in New Issue
Block a user