mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
LevelDB: fixed incorrectly writing always newest protocol version in world saves
this made it impossible to tell the difference between PM worlds and bedrock worlds modified post-1.12.
This commit is contained in:
parent
bd4c2b5245
commit
75d4c47384
@ -29,7 +29,6 @@ use pocketmine\nbt\tag\CompoundTag;
|
|||||||
use pocketmine\nbt\tag\IntTag;
|
use pocketmine\nbt\tag\IntTag;
|
||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
use pocketmine\nbt\TreeRoot;
|
use pocketmine\nbt\TreeRoot;
|
||||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
|
||||||
use pocketmine\utils\Binary;
|
use pocketmine\utils\Binary;
|
||||||
use pocketmine\utils\Filesystem;
|
use pocketmine\utils\Filesystem;
|
||||||
use pocketmine\utils\Limits;
|
use pocketmine\utils\Limits;
|
||||||
@ -50,6 +49,12 @@ use function time;
|
|||||||
class BedrockWorldData extends BaseNbtWorldData{
|
class BedrockWorldData extends BaseNbtWorldData{
|
||||||
|
|
||||||
public const CURRENT_STORAGE_VERSION = 8;
|
public const CURRENT_STORAGE_VERSION = 8;
|
||||||
|
/**
|
||||||
|
* WARNING: In the future, this should be only as high as the newest world format currently supported. We don't
|
||||||
|
* actually support worlds from 1.18.10 yet, but due to an old stupid bug, all worlds created by PM will report this
|
||||||
|
* version.
|
||||||
|
*/
|
||||||
|
public const CURRENT_STORAGE_NETWORK_VERSION = 486; // 1.18.10
|
||||||
|
|
||||||
public const GENERATOR_LIMITED = 0;
|
public const GENERATOR_LIMITED = 0;
|
||||||
public const GENERATOR_INFINITE = 1;
|
public const GENERATOR_INFINITE = 1;
|
||||||
@ -74,7 +79,7 @@ class BedrockWorldData extends BaseNbtWorldData{
|
|||||||
->setInt("Generator", $generatorType)
|
->setInt("Generator", $generatorType)
|
||||||
->setLong("LastPlayed", time())
|
->setLong("LastPlayed", time())
|
||||||
->setString("LevelName", $name)
|
->setString("LevelName", $name)
|
||||||
->setInt("NetworkVersion", ProtocolInfo::CURRENT_PROTOCOL)
|
->setInt("NetworkVersion", self::CURRENT_STORAGE_NETWORK_VERSION)
|
||||||
//->setInt("Platform", 2) //TODO: find out what the possible values are for
|
//->setInt("Platform", 2) //TODO: find out what the possible values are for
|
||||||
->setLong("RandomSeed", $options->getSeed())
|
->setLong("RandomSeed", $options->getSeed())
|
||||||
->setInt("SpawnX", $options->getSpawnPosition()->getFloorX())
|
->setInt("SpawnX", $options->getSpawnPosition()->getFloorX())
|
||||||
@ -161,7 +166,7 @@ class BedrockWorldData extends BaseNbtWorldData{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function save() : void{
|
public function save() : void{
|
||||||
$this->compoundTag->setInt("NetworkVersion", ProtocolInfo::CURRENT_PROTOCOL);
|
$this->compoundTag->setInt("NetworkVersion", self::CURRENT_STORAGE_NETWORK_VERSION);
|
||||||
$this->compoundTag->setInt("StorageVersion", self::CURRENT_STORAGE_VERSION);
|
$this->compoundTag->setInt("StorageVersion", self::CURRENT_STORAGE_VERSION);
|
||||||
|
|
||||||
$nbt = new LittleEndianNbtSerializer();
|
$nbt = new LittleEndianNbtSerializer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user