Improved chunk sending

This commit is contained in:
Shoghi Cervantes 2014-08-26 11:50:51 +02:00
parent 35b86af2af
commit d169734781
2 changed files with 6 additions and 8 deletions

View File

@ -100,9 +100,9 @@ class ChunkRequestTask extends AsyncTask{
} }
} }
foreach($this->biomeColors as $color){ $biomeColors = $this->biomeColors;
$biomeColors .= Binary::writeInt($color); 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); $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);

View File

@ -122,11 +122,9 @@ class McRegion extends BaseLevelProvider{
} }
} }
$biomeColors = ""; $biomeColors = $chunk->getBiomeColorArray();
array_unshift($biomeColors, "N*");
foreach($chunk->getBiomeColorArray() as $color){ $biomeColors = call_user_func_array("pack", $biomeColors);
$biomeColors .= Binary::writeInt($color);
}
$ordered = zlib_encode( $ordered = zlib_encode(
Binary::writeLInt($x) . Binary::writeLInt($z) . Binary::writeLInt($x) . Binary::writeLInt($z) .