updated pocketmine/nbt dependency

this is going to need work on exception handling, but right now it's so inconsistent that it doesn't matter anyway.
This commit is contained in:
Dylan K. Taylor
2020-03-04 17:53:37 +00:00
parent 6e39e34c1e
commit 995309424e
16 changed files with 45 additions and 32 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\world\format\io\data;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\world\format\io\exception\CorruptedWorldException;
use pocketmine\world\format\io\exception\UnsupportedWorldFormatException;
use pocketmine\world\format\io\WorldData;
@ -124,11 +125,14 @@ abstract class BaseNbtWorldData implements WorldData{
}
public function getTime() : int{
return $this->compoundTag->getLong("Time", 0, true);
if($this->compoundTag->hasTag("Time", IntTag::class)){ //some older PM worlds had this in the wrong format
return $this->compoundTag->getInt("Time");
}
return $this->compoundTag->getLong("Time", 0);
}
public function setTime(int $value) : void{
$this->compoundTag->setLong("Time", $value, true); //some older PM worlds had this in the wrong format
$this->compoundTag->setLong("Time", $value);
}
public function getSpawn() : Vector3{

View File

@ -122,7 +122,7 @@ class BedrockWorldData extends BaseNbtWorldData{
throw new CorruptedWorldException($e->getMessage(), 0, $e);
}
$version = $worldData->getInt("StorageVersion", Limits::INT32_MAX, true);
$version = $worldData->getInt("StorageVersion", Limits::INT32_MAX);
if($version > self::CURRENT_STORAGE_VERSION){
throw new UnsupportedWorldFormatException("LevelDB world format version $version is currently unsupported");
}

View File

@ -90,7 +90,7 @@ class JavaWorldData extends BaseNbtWorldData{
protected function fix() : void{
if(!$this->compoundTag->hasTag("generatorName", StringTag::class)){
$this->compoundTag->setString("generatorName", "default", true);
$this->compoundTag->setString("generatorName", "default");
}elseif(($generatorName = self::hackyFixForGeneratorClasspathInLevelDat($this->compoundTag->getString("generatorName"))) !== null){
$this->compoundTag->setString("generatorName", $generatorName);
}

View File

@ -75,7 +75,7 @@ trait LegacyAnvilChunkTrait{
if($chunk->hasTag("BiomeColors", IntArrayTag::class)){
$biomeIds = ChunkUtils::convertBiomeColors($chunk->getIntArray("BiomeColors")); //Convert back to original format
}else{
$biomeIds = $chunk->getByteArray("Biomes", "", true);
$biomeIds = $chunk->getByteArray("Biomes", "");
}
$result = new Chunk(