mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Added support for handling MCPE 1.2 leveldb worlds
requires php-leveldb version >=0.2.1 and the latest version of pmmp/leveldb-mcpe
This commit is contained in:
parent
7e496afdd1
commit
ea3c7383fb
@ -466,8 +466,8 @@ namespace pocketmine {
|
||||
|
||||
if(extension_loaded("leveldb")){
|
||||
$leveldb_version = phpversion("leveldb");
|
||||
if(version_compare($leveldb_version, "0.2.0") < 0){
|
||||
$logger->critical("php-leveldb >= 0.2.0 is required, while you have $leveldb_version");
|
||||
if(version_compare($leveldb_version, "0.2.1") < 0){
|
||||
$logger->critical("php-leveldb >= 0.2.1 is required, while you have $leveldb_version");
|
||||
++$errors;
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ class LevelDB extends BaseLevelProvider{
|
||||
const GENERATOR_INFINITE = 1;
|
||||
const GENERATOR_FLAT = 2;
|
||||
|
||||
const CURRENT_STORAGE_VERSION = 5; //Current MCPE level format version
|
||||
const CURRENT_LEVEL_CHUNK_VERSION = 4;
|
||||
const CURRENT_STORAGE_VERSION = 6; //Current MCPE level format version
|
||||
const CURRENT_LEVEL_CHUNK_VERSION = 7;
|
||||
const CURRENT_LEVEL_SUBCHUNK_VERSION = 0;
|
||||
|
||||
/** @var Chunk[] */
|
||||
@ -100,13 +100,17 @@ class LevelDB extends BaseLevelProvider{
|
||||
throw new LevelException("Invalid level.dat");
|
||||
}
|
||||
|
||||
if(!defined('LEVELDB_ZLIB_RAW_COMPRESSION')){
|
||||
throw new LevelException("Given version of php-leveldb doesn't support zlib raw compression");
|
||||
}
|
||||
|
||||
$this->db = new \LevelDB($this->path . "/db", [
|
||||
"compression" => LEVELDB_ZLIB_COMPRESSION
|
||||
"compression" => LEVELDB_ZLIB_RAW_COMPRESSION
|
||||
]);
|
||||
|
||||
if($this->levelData->getInt("StorageVersion", INT32_MAX, true) > self::CURRENT_STORAGE_VERSION){
|
||||
throw new LevelException("Specified LevelDB world format version is not supported by " . \pocketmine\NAME);
|
||||
$version = $this->levelData->getInt("StorageVersion", INT32_MAX, true);
|
||||
if($version > self::CURRENT_STORAGE_VERSION){
|
||||
throw new LevelException("Specified LevelDB world format version ($version) is not supported by " . \pocketmine\NAME);
|
||||
}
|
||||
|
||||
if(!$this->levelData->hasTag("generatorName", StringTag::class)){
|
||||
@ -217,7 +221,7 @@ class LevelDB extends BaseLevelProvider{
|
||||
|
||||
|
||||
$db = new \LevelDB($path . "/db", [
|
||||
"compression" => LEVELDB_ZLIB_COMPRESSION
|
||||
"compression" => LEVELDB_ZLIB_RAW_COMPRESSION
|
||||
]);
|
||||
|
||||
if($generatorType === self::GENERATOR_FLAT and isset($options["preset"])){
|
||||
@ -329,6 +333,7 @@ class LevelDB extends BaseLevelProvider{
|
||||
$binaryStream = new BinaryStream();
|
||||
|
||||
switch($chunkVersion){
|
||||
case 7: //MCPE 1.2 (???)
|
||||
case 4: //MCPE 1.1
|
||||
//TODO: check beds
|
||||
case 3: //MCPE 1.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user