Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/PocketMine.php
#	src/pocketmine/Server.php
#	src/pocketmine/item/Bucket.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	src/pocketmine/network/mcpe/protocol/BatchPacket.php
#	src/pocketmine/tile/Furnace.php
#	src/pocketmine/utils/UUID.php
#	src/utils/ServerKiller.php
This commit is contained in:
Dylan K. Taylor
2020-12-20 20:54:13 +00:00
18 changed files with 221 additions and 127 deletions

View File

@ -126,7 +126,9 @@ final class FastChunkSerializer{
for($i = 0, $layerCount = $stream->getByte(); $i < $layerCount; ++$i){
$bitsPerBlock = $stream->getByte();
$words = $stream->get(PalettedBlockArray::getExpectedWordArraySize($bitsPerBlock));
$palette = array_values(unpack("L*", $stream->get($stream->getInt())));
/** @var int[] $unpackedPalette */
$unpackedPalette = unpack("L*", $stream->get($stream->getInt())); //unpack() will never fail here
$palette = array_values($unpackedPalette);
$layers[] = PalettedBlockArray::fromData($bitsPerBlock, $words, $palette);
}
@ -137,7 +139,9 @@ final class FastChunkSerializer{
$biomeIds = new BiomeArray($stream->get(256));
if($lightPopulated){
$heightMap = new HeightArray(array_values(unpack("S*", $stream->get(512))));
/** @var int[] $unpackedHeightMap */
$unpackedHeightMap = unpack("S*", $stream->get(512)); //unpack() will never fail here
$heightMap = new HeightArray(array_values($unpackedHeightMap));
}
$chunk = new Chunk($subChunks, null, null, $biomeIds, $heightMap);