mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 21:05:12 +00:00
Player: added a constant for resource pack chunk sending size
This commit is contained in:
parent
3f2455f090
commit
11cedc4011
@ -217,6 +217,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
public const SPECTATOR = 3;
|
public const SPECTATOR = 3;
|
||||||
public const VIEW = Player::SPECTATOR;
|
public const VIEW = Player::SPECTATOR;
|
||||||
|
|
||||||
|
private const RESOURCE_PACK_CHUNK_SIZE = 1048576; //1MB
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates the given username.
|
* Validates the given username.
|
||||||
*/
|
*/
|
||||||
@ -2070,7 +2072,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
$pk = new ResourcePackDataInfoPacket();
|
$pk = new ResourcePackDataInfoPacket();
|
||||||
$pk->packId = $pack->getPackId();
|
$pk->packId = $pack->getPackId();
|
||||||
$pk->maxChunkSize = 1048576; //1MB
|
$pk->maxChunkSize = self::RESOURCE_PACK_CHUNK_SIZE;
|
||||||
$pk->chunkCount = (int) ceil($pack->getPackSize() / $pk->maxChunkSize);
|
$pk->chunkCount = (int) ceil($pack->getPackSize() / $pk->maxChunkSize);
|
||||||
$pk->compressedPackSize = $pack->getPackSize();
|
$pk->compressedPackSize = $pack->getPackSize();
|
||||||
$pk->sha256 = $pack->getSha256();
|
$pk->sha256 = $pack->getSha256();
|
||||||
@ -3053,8 +3055,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$pk = new ResourcePackChunkDataPacket();
|
$pk = new ResourcePackChunkDataPacket();
|
||||||
$pk->packId = $pack->getPackId();
|
$pk->packId = $pack->getPackId();
|
||||||
$pk->chunkIndex = $packet->chunkIndex;
|
$pk->chunkIndex = $packet->chunkIndex;
|
||||||
$pk->data = $pack->getPackChunk(1048576 * $packet->chunkIndex, 1048576);
|
$pk->data = $pack->getPackChunk(self::RESOURCE_PACK_CHUNK_SIZE * $packet->chunkIndex, self::RESOURCE_PACK_CHUNK_SIZE);
|
||||||
$pk->progress = (1048576 * $packet->chunkIndex);
|
$pk->progress = (self::RESOURCE_PACK_CHUNK_SIZE * $packet->chunkIndex);
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user