fixed oldmcpe->pmf2

This commit is contained in:
GameHerobrine 2023-12-09 20:17:26 +03:00
parent 6f68baf7e2
commit ad8cbb81ff

View file

@ -49,7 +49,8 @@ class LevelImport{
"spawnZ" => $level["SpawnZ"],
"extra" => "",
"width" => 16,
"height" => 8
"height" => 8,
"generator" => get_class(LevelAPI::createGenerator(LevelAPI::$defaultLevelType))
]);
$chunks = new PocketChunkParser();
$chunks->loadFile($this->path . "chunks.dat");
@ -72,8 +73,12 @@ class LevelImport{
$meta = $chunks->getChunkColumn($X, $Z, $x, $z, 1);
for($Y = 0; $Y < 8; ++$Y){
$chunk[$Y] .= substr($block, $Y << 4, 16);
$chunk[$Y] .= substr($meta, $Y << 3, 8);
$chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00";
$metaf = str_split(substr($meta, $Y << 3, 8));
foreach($metaf as $m2){
$chunk[$Y] .= chr(ord($m2) << 4) . chr(ord($m2) & 0xf);
}
$chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
$chunk[$Y] .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
}
}
}