mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Added __clone() for Chunk and SubChunk
we need this because the flatworld generator uses clone to produce new chunks, so we don't want the chunks getting fucked up.
This commit is contained in:
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\format;
|
||||
|
||||
use function array_map;
|
||||
use function array_values;
|
||||
use function count;
|
||||
|
||||
@ -141,4 +142,13 @@ class SubChunk{
|
||||
$this->skyLight->collectGarbage();
|
||||
$this->blockLight->collectGarbage();
|
||||
}
|
||||
|
||||
public function __clone(){
|
||||
$this->blockLayers = array_map(function(PalettedBlockArray $array) : PalettedBlockArray{
|
||||
return clone $array;
|
||||
}, $this->blockLayers);
|
||||
|
||||
$this->skyLight = clone $this->skyLight;
|
||||
$this->blockLight = clone $this->blockLight;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user