Fixed Mojang world converters barfing on PocketMine-MP generated McRegion worlds

blame @shoghicp
This commit is contained in:
Dylan K. Taylor 2017-05-21 12:44:42 +01:00
parent 0f174f7605
commit 0207b22110
3 changed files with 17 additions and 1 deletions

View File

@ -156,6 +156,10 @@ class Anvil extends McRegion{
return "anvil";
}
public static function getPcWorldFormatVersion() : int{
return 19133; //anvil
}
public function getWorldHeight() : int{
//TODO: add world height options
return 256;

View File

@ -210,6 +210,14 @@ class McRegion extends BaseLevelProvider{
return "mcregion";
}
/**
* Returns the storage version as per Minecraft PC world formats.
* @return int
*/
public static function getPcWorldFormatVersion() : int{
return 19132; //mcregion
}
public function getWorldHeight() : int{
//TODO: add world height options
return 128;
@ -251,7 +259,7 @@ class McRegion extends BaseLevelProvider{
"SpawnX" => new IntTag("SpawnX", 256),
"SpawnY" => new IntTag("SpawnY", 70),
"SpawnZ" => new IntTag("SpawnZ", 256),
"version" => new IntTag("version", 19133),
"version" => new IntTag("version", static::getPcWorldFormatVersion()),
"DayTime" => new IntTag("DayTime", 0),
"LastPlayed" => new LongTag("LastPlayed", microtime(true) * 1000),
"RandomSeed" => new LongTag("RandomSeed", $seed),

View File

@ -150,4 +150,8 @@ class PMAnvil extends Anvil{
public static function getProviderName() : string{
return "pmanvil";
}
public static function getPcWorldFormatVersion() : int{
return -1; //Not a PC format, only PocketMine-MP
}
}