extract a BiomeArray unit from Chunk

this now also properly validates data read from disk.
This commit is contained in:
Dylan K. Taylor
2020-05-16 17:36:22 +01:00
parent c30dd9f1b6
commit 82d361d75f
6 changed files with 107 additions and 26 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\world\format\io;
use pocketmine\block\BlockLegacyIds;
use pocketmine\utils\BinaryStream;
use pocketmine\world\format\BiomeArray;
use pocketmine\world\format\Chunk;
use pocketmine\world\format\LightArray;
use pocketmine\world\format\PalettedBlockArray;
@ -111,7 +112,7 @@ final class FastChunkSerializer{
$terrainGenerated = (bool) ($flags & 1);
$subChunks = [];
$biomeIds = "";
$biomeIds = null;
$heightMap = [];
if($terrainGenerated){
$count = $stream->getByte();
@ -132,7 +133,7 @@ final class FastChunkSerializer{
);
}
$biomeIds = $stream->get(256);
$biomeIds = new BiomeArray($stream->get(256));
if($lightPopulated){
$heightMap = array_values(unpack("S*", $stream->get(512)));
}