From d1697347814d5252320c7466ee82b8131b11dc96 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 26 Aug 2014 11:50:51 +0200 Subject: [PATCH] Improved chunk sending --- src/pocketmine/level/format/anvil/ChunkRequestTask.php | 6 +++--- src/pocketmine/level/format/mcregion/McRegion.php | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/pocketmine/level/format/anvil/ChunkRequestTask.php b/src/pocketmine/level/format/anvil/ChunkRequestTask.php index 8fa2c94638..cd2661f7fe 100644 --- a/src/pocketmine/level/format/anvil/ChunkRequestTask.php +++ b/src/pocketmine/level/format/anvil/ChunkRequestTask.php @@ -100,9 +100,9 @@ class ChunkRequestTask extends AsyncTask{ } } - foreach($this->biomeColors as $color){ - $biomeColors .= Binary::writeInt($color); - } + $biomeColors = $this->biomeColors; + array_unshift($biomeColors, "N*"); + $biomeColors = call_user_func_array("pack", $biomeColors); $ordered = zlib_encode(Binary::writeLInt($this->chunkX) . Binary::writeLInt($this->chunkZ) . $orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $this->biomeIds . $biomeColors . $this->tiles, ZLIB_ENCODING_DEFLATE, $this->compressionLevel); diff --git a/src/pocketmine/level/format/mcregion/McRegion.php b/src/pocketmine/level/format/mcregion/McRegion.php index 8eb1c4baa1..5e6a4e19fe 100644 --- a/src/pocketmine/level/format/mcregion/McRegion.php +++ b/src/pocketmine/level/format/mcregion/McRegion.php @@ -122,11 +122,9 @@ class McRegion extends BaseLevelProvider{ } } - $biomeColors = ""; - - foreach($chunk->getBiomeColorArray() as $color){ - $biomeColors .= Binary::writeInt($color); - } + $biomeColors = $chunk->getBiomeColorArray(); + array_unshift($biomeColors, "N*"); + $biomeColors = call_user_func_array("pack", $biomeColors); $ordered = zlib_encode( Binary::writeLInt($x) . Binary::writeLInt($z) .