mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
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:
@ -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{
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user