Level: clone Block object passed to setBlock() if set successfully

closes #2042
This commit is contained in:
Dylan K. Taylor 2018-03-17 16:35:10 +00:00
parent 7f6b8ad7c2
commit 7fcc538a75

View File

@ -1519,6 +1519,8 @@ class Level implements ChunkManager, Metadatable{
$pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z); $pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z);
} }
$block = clone $block;
$block->position($pos); $block->position($pos);
$block->clearCaches(); $block->clearCaches();
@ -1535,7 +1537,7 @@ class Level implements ChunkManager, Metadatable{
$this->changedBlocks[$chunkHash] = []; $this->changedBlocks[$chunkHash] = [];
} }
$this->changedBlocks[$chunkHash][$blockHash] = clone $block; $this->changedBlocks[$chunkHash][$blockHash] = $block;
} }
foreach($this->getChunkLoaders($pos->x >> 4, $pos->z >> 4) as $loader){ foreach($this->getChunkLoaders($pos->x >> 4, $pos->z >> 4) as $loader){