mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Update to latest NBT lib version
This commit is contained in:
@ -225,10 +225,7 @@ class LevelDB extends BaseLevelProvider{
|
||||
/** @var CompoundTag[] $entities */
|
||||
$entities = [];
|
||||
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and $entityData !== ""){
|
||||
$entities = $nbt->read($entityData, true);
|
||||
if(!is_array($entities)){
|
||||
$entities = [$entities];
|
||||
}
|
||||
$entities = $nbt->readMultiple($entityData);
|
||||
}
|
||||
|
||||
/** @var CompoundTag $entityNBT */
|
||||
@ -238,12 +235,10 @@ class LevelDB extends BaseLevelProvider{
|
||||
}
|
||||
}
|
||||
|
||||
/** @var CompoundTag[] $tiles */
|
||||
$tiles = [];
|
||||
if(($tileData = $this->db->get($index . self::TAG_BLOCK_ENTITY)) !== false and $tileData !== ""){
|
||||
$tiles = $nbt->read($tileData, true);
|
||||
if(!is_array($tiles)){
|
||||
$tiles = [$tiles];
|
||||
}
|
||||
$tiles = $nbt->readMultiple($tileData);
|
||||
}
|
||||
|
||||
//TODO: extra data should be converted into blockstorage layers (first they need to be implemented!)
|
||||
@ -326,7 +321,7 @@ class LevelDB extends BaseLevelProvider{
|
||||
private function writeTags(array $targets, string $index) : void{
|
||||
if(!empty($targets)){
|
||||
$nbt = new LittleEndianNBTStream();
|
||||
$this->db->put($index, $nbt->write($targets));
|
||||
$this->db->put($index, $nbt->writeMultiple($targets));
|
||||
}else{
|
||||
$this->db->delete($index);
|
||||
}
|
||||
|
Reference in New Issue
Block a user