mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Only save batch buffer when compressing chunks
faster due to not needing to serialize, and reduces memory footprint of caching
This commit is contained in:
parent
60f5c7ccef
commit
905d3f1610
@ -74,14 +74,18 @@ class ChunkRequestTask extends AsyncTask{
|
|||||||
$batch = new BatchPacket();
|
$batch = new BatchPacket();
|
||||||
$batch->addPacket($pk);
|
$batch->addPacket($pk);
|
||||||
$batch->compress($this->compressionLevel);
|
$batch->compress($this->compressionLevel);
|
||||||
|
$batch->encode();
|
||||||
|
|
||||||
$this->setResult($batch);
|
$this->setResult($batch->buffer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCompletion(Server $server){
|
public function onCompletion(Server $server){
|
||||||
$level = $server->getLevel($this->levelId);
|
$level = $server->getLevel($this->levelId);
|
||||||
if($level instanceof Level and $this->hasResult()){
|
if($level instanceof Level and $this->hasResult()){
|
||||||
$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult());
|
$batch = new BatchPacket($this->getResult());
|
||||||
|
$batch->compressed = true;
|
||||||
|
$batch->isEncoded = true;
|
||||||
|
$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $batch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user