mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
BatchPacket, compress any packet depending on the size, really fast threaded chunk sending
This commit is contained in:
@ -34,7 +34,6 @@ class ChunkRequestTask extends AsyncTask{
|
||||
protected $levelId;
|
||||
protected $chunkX;
|
||||
protected $chunkZ;
|
||||
protected $compressionLevel;
|
||||
|
||||
/** @var \pocketmine\level\format\ChunkSection[] */
|
||||
protected $sections;
|
||||
@ -69,8 +68,6 @@ class ChunkRequestTask extends AsyncTask{
|
||||
|
||||
$this->tiles = $tiles;
|
||||
|
||||
$this->compressionLevel = Level::$COMPRESSION_LEVEL;
|
||||
|
||||
}
|
||||
|
||||
public function onRun(){
|
||||
@ -102,9 +99,9 @@ class ChunkRequestTask extends AsyncTask{
|
||||
|
||||
$biomeColors = pack("N*", ...$this->biomeColors);
|
||||
|
||||
$ordered = zlib_encode($orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $this->biomeIds . $biomeColors . $this->tiles, ZLIB_ENCODING_DEFLATE, $this->compressionLevel);
|
||||
$ordered = $orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $this->biomeIds . $biomeColors . $this->tiles;
|
||||
|
||||
$this->setResult($ordered);
|
||||
$this->setResult($ordered, false);
|
||||
}
|
||||
|
||||
public function getColumn(&$data, $x, $z){
|
||||
|
@ -148,15 +148,13 @@ class LevelDB extends BaseLevelProvider{
|
||||
|
||||
$biomeColors = pack("N*", ...$chunk->getBiomeColorArray());
|
||||
|
||||
$ordered = zlib_encode(
|
||||
$chunk->getBlockIdArray() .
|
||||
$ordered = $chunk->getBlockIdArray() .
|
||||
$chunk->getBlockDataArray() .
|
||||
$chunk->getBlockSkyLightArray() .
|
||||
$chunk->getBlockLightArray() .
|
||||
$chunk->getBiomeIdArray() .
|
||||
$biomeColors .
|
||||
$tiles
|
||||
, ZLIB_ENCODING_DEFLATE, Level::$COMPRESSION_LEVEL);
|
||||
$tiles;
|
||||
|
||||
$this->getLevel()->chunkRequestCallback($x, $z, $ordered);
|
||||
|
||||
|
@ -129,15 +129,13 @@ class McRegion extends BaseLevelProvider{
|
||||
|
||||
$biomeColors = pack("N*", ...$chunk->getBiomeColorArray());
|
||||
|
||||
$ordered = zlib_encode(
|
||||
$chunk->getBlockIdArray() .
|
||||
$ordered = $chunk->getBlockIdArray() .
|
||||
$chunk->getBlockDataArray() .
|
||||
$chunk->getBlockSkyLightArray() .
|
||||
$chunk->getBlockLightArray() .
|
||||
$chunk->getBiomeIdArray() .
|
||||
$biomeColors .
|
||||
$tiles
|
||||
, ZLIB_ENCODING_DEFLATE, Level::$COMPRESSION_LEVEL);
|
||||
$tiles;
|
||||
|
||||
$this->getLevel()->chunkRequestCallback($x, $z, $ordered);
|
||||
|
||||
|
Reference in New Issue
Block a user