mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Merge branch 'release/3.4'
This commit is contained in:
commit
e94dd367ef
@ -26,7 +26,6 @@ namespace pocketmine\network\mcpe;
|
|||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\network\mcpe\protocol\FullChunkDataPacket;
|
use pocketmine\network\mcpe\protocol\FullChunkDataPacket;
|
||||||
use pocketmine\scheduler\AsyncTask;
|
use pocketmine\scheduler\AsyncTask;
|
||||||
use pocketmine\tile\Spawnable;
|
|
||||||
|
|
||||||
class ChunkRequestTask extends AsyncTask{
|
class ChunkRequestTask extends AsyncTask{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
@ -35,38 +34,24 @@ class ChunkRequestTask extends AsyncTask{
|
|||||||
protected $chunkX;
|
protected $chunkX;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $chunkZ;
|
protected $chunkZ;
|
||||||
/** @var string */
|
|
||||||
protected $tiles;
|
|
||||||
/** @var int */
|
|
||||||
protected $compressionLevel;
|
protected $compressionLevel;
|
||||||
|
|
||||||
public function __construct(int $chunkX, int $chunkZ, Chunk $chunk, CompressBatchPromise $promise){
|
public function __construct(int $chunkX, int $chunkZ, Chunk $chunk, CompressBatchPromise $promise){
|
||||||
$this->compressionLevel = NetworkCompression::$LEVEL;
|
$this->compressionLevel = NetworkCompression::$LEVEL;
|
||||||
|
|
||||||
$this->chunk = $chunk->fastSerialize();
|
$this->chunk = $chunk->networkSerialize();
|
||||||
$this->chunkX = $chunkX;
|
$this->chunkX = $chunkX;
|
||||||
$this->chunkZ = $chunkZ;
|
$this->chunkZ = $chunkZ;
|
||||||
|
|
||||||
//TODO: serialize tiles with chunks
|
|
||||||
$tiles = "";
|
|
||||||
foreach($chunk->getTiles() as $tile){
|
|
||||||
if($tile instanceof Spawnable){
|
|
||||||
$tiles .= $tile->getSerializedSpawnCompound();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->tiles = $tiles;
|
|
||||||
|
|
||||||
$this->storeLocal($promise);
|
$this->storeLocal($promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onRun() : void{
|
public function onRun() : void{
|
||||||
$chunk = Chunk::fastDeserialize($this->chunk);
|
|
||||||
|
|
||||||
$pk = new FullChunkDataPacket();
|
$pk = new FullChunkDataPacket();
|
||||||
$pk->chunkX = $this->chunkX;
|
$pk->chunkX = $this->chunkX;
|
||||||
$pk->chunkZ = $this->chunkZ;
|
$pk->chunkZ = $this->chunkZ;
|
||||||
$pk->data = $chunk->networkSerialize() . $this->tiles;
|
$pk->data = $this->chunk;
|
||||||
|
|
||||||
$stream = new PacketStream();
|
$stream = new PacketStream();
|
||||||
$stream->putPacket($pk);
|
$stream->putPacket($pk);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user