extracted a HeightArray type from Chunk

This commit is contained in:
Dylan K. Taylor
2020-05-16 18:41:27 +01:00
parent a31240f60b
commit 88715c7055
3 changed files with 84 additions and 24 deletions

View File

@ -27,6 +27,7 @@ use pocketmine\block\BlockLegacyIds;
use pocketmine\utils\BinaryStream;
use pocketmine\world\format\BiomeArray;
use pocketmine\world\format\Chunk;
use pocketmine\world\format\HeightArray;
use pocketmine\world\format\LightArray;
use pocketmine\world\format\PalettedBlockArray;
use pocketmine\world\format\SubChunk;
@ -120,7 +121,7 @@ final class FastChunkSerializer{
$subChunks = [];
$biomeIds = null;
$heightMap = [];
$heightMap = null;
if($terrainGenerated){
$count = $stream->getByte();
for($subCount = 0; $subCount < $count; ++$subCount){
@ -142,7 +143,7 @@ final class FastChunkSerializer{
$biomeIds = new BiomeArray($stream->get(256));
if($lightPopulated){
$heightMap = array_values(unpack("S*", $stream->get(512)));
$heightMap = new HeightArray(array_values(unpack("S*", $stream->get(512))));
}
}