From a0cda3b45ae41021143d65d45529328bd12777ed Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 4 Dec 2016 17:46:56 +0000 Subject: [PATCH] Fixed extra data encoding --- .../level/format/generic/GenericChunk.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/level/format/generic/GenericChunk.php b/src/pocketmine/level/format/generic/GenericChunk.php index f58d195c5..bd903533b 100644 --- a/src/pocketmine/level/format/generic/GenericChunk.php +++ b/src/pocketmine/level/format/generic/GenericChunk.php @@ -619,9 +619,16 @@ class GenericChunk implements Chunk{ $result .= $this->subChunks[$y]->networkSerialize(); } $result .= pack("v*", ...$this->heightMap) - . $this->biomeIds - . "\x00" //border block array count (TODO) - . "\x00\x00\x00\x00"; //extra data array (TODO) + . $this->biomeIds + . chr(0); //border block array count (TODO) + + $extraData = new BinaryStream(); + $extraData->putVarInt(count($this->extraData)); //WHY, Mojang, WHY + foreach($this->extraData as $key => $value){ + $extraData->putVarInt($key); + $extraData->putLShort($value); + } + $result .= $extraData->getBuffer(); if(count($this->tiles) > 0){ $nbt = new NBT(NBT::LITTLE_ENDIAN);