489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
//TODO: use this properly
$write->put($index . self::TAG_STATE_FINALISATION, chr($chunk->isPopulated() ? self::FINALISATION_DONE : self::FINALISATION_NEEDS_POPULATION));
$this->writeTags($chunkData->getTileNBT(), $index . self::TAG_BLOCK_ENTITY, $write);
$this->writeTags($chunkData->getEntityNBT(), $index . self::TAG_ENTITY, $write);
$write->delete($index . self::TAG_DATA_2D_LEGACY);
$write->delete($index . self::TAG_LEGACY_TERRAIN);
$this->db->write($write);
}
/**
* @param CompoundTag[] $targets
*/
private function writeTags(array $targets, string $index, \LevelDBWriteBatch $write) : void{
if(count($targets) > 0){
$nbt = new LittleEndianNbtSerializer();
$write->put($index, $nbt->writeMultiple(array_map(fn(CompoundTag $tag) => new TreeRoot($tag), $targets)));
}else{
#0 pmsrc/src/world/format/io/leveldb/LevelDB(498): LevelDB->write(object LevelDBWriteBatch#123039)
#1 pmsrc/src/world/World(2630): pocketmine\world\format\io\leveldb\LevelDB->saveChunk(integer 2, integer 12, object pocketmine\world\format\io\ChunkData#125633)
#2 pmsrc/src/world/World(3087): pocketmine\world\World->unloadChunk(integer 2, integer 12, true)
#3 pmsrc/src/world/World(832): pocketmine\world\World->unloadChunks()
#4 pmsrc/src/world/World(807): pocketmine\world\World->actuallyDoTick(integer 3363)
#5 pmsrc/src/world/WorldManager(362): pocketmine\world\World->doTick(integer 3363)
#6 pmsrc/src/Server(1776): pocketmine\world\WorldManager->tick(integer 3363)
#7 pmsrc/src/Server(1658): pocketmine\Server->tick()
#8 pmsrc/src/Server(1047): pocketmine\Server->tickProcessor()
#9 pmsrc/src/PocketMine(304): pocketmine\Server->__construct(object BaseClassLoader#3, object pocketmine\utils\MainLogger#2, string[34] /home/clientservers/server-810270/, string[42] /home/clientservers/server-810270/plugins/)
#10 pmsrc/src/PocketMine(327): pocketmine\server()
#11 pmsrc(11): require(string[71] phar:///home/serversoftwares/PocketMine_1.18.30.phar/src/PocketMine.php)