Update to latest NBT lib version

This commit is contained in:
Dylan K. Taylor
2018-10-23 16:47:00 +01:00
parent a49abff099
commit 011b9ae159
10 changed files with 23 additions and 43 deletions

View File

@ -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);
}