diff --git a/src/pocketmine/network/Network.php b/src/pocketmine/network/Network.php index 9418159db..ac198cc44 100644 --- a/src/pocketmine/network/Network.php +++ b/src/pocketmine/network/Network.php @@ -77,6 +77,7 @@ use pocketmine\network\protocol\RequestChunkRadiusPacket; use pocketmine\network\protocol\ResourcePackClientResponsePacket; use pocketmine\network\protocol\ResourcePacksInfoPacket; use pocketmine\network\protocol\RespawnPacket; +use pocketmine\network\protocol\RiderJumpPacket; use pocketmine\network\protocol\SetCommandsEnabledPacket; use pocketmine\network\protocol\SetDifficultyPacket; use pocketmine\network\protocol\SetEntityDataPacket; @@ -353,6 +354,7 @@ class Network{ $this->registerPacket(ProtocolInfo::RESOURCE_PACK_CLIENT_RESPONSE_PACKET, ResourcePackClientResponsePacket::class); $this->registerPacket(ProtocolInfo::RESOURCE_PACKS_INFO_PACKET, ResourcePacksInfoPacket::class); $this->registerPacket(ProtocolInfo::RESPAWN_PACKET, RespawnPacket::class); + $this->registerPacket(ProtocolInfo::RIDER_JUMP_PACKET, RiderJumpPacket::class); $this->registerPacket(ProtocolInfo::SET_COMMANDS_ENABLED_PACKET, SetCommandsEnabledPacket::class); $this->registerPacket(ProtocolInfo::SET_DIFFICULTY_PACKET, SetDifficultyPacket::class); $this->registerPacket(ProtocolInfo::SET_ENTITY_DATA_PACKET, SetEntityDataPacket::class); diff --git a/src/pocketmine/network/protocol/PlayStatusPacket.php b/src/pocketmine/network/protocol/PlayStatusPacket.php index 47b695ff6..2feaa3e55 100644 --- a/src/pocketmine/network/protocol/PlayStatusPacket.php +++ b/src/pocketmine/network/protocol/PlayStatusPacket.php @@ -31,6 +31,8 @@ class PlayStatusPacket extends DataPacket{ const LOGIN_FAILED_CLIENT = 1; const LOGIN_FAILED_SERVER = 2; const PLAYER_SPAWN = 3; + const LOGIN_FAILED_INVALID_TENANT = 4; + const LOGIN_FAILED_EDITION_MISMATCH = 5; public $status; diff --git a/src/pocketmine/network/protocol/ResourcePackClientResponsePacket.php b/src/pocketmine/network/protocol/ResourcePackClientResponsePacket.php index e74740649..32ff17267 100644 --- a/src/pocketmine/network/protocol/ResourcePackClientResponsePacket.php +++ b/src/pocketmine/network/protocol/ResourcePackClientResponsePacket.php @@ -27,6 +27,11 @@ namespace pocketmine\network\protocol; class ResourcePackClientResponsePacket extends DataPacket{ const NETWORK_ID = Info::RESOURCE_PACK_CLIENT_RESPONSE_PACKET; + const STATUS_REFUSED = 1; + const STATUS_SEND_PACKS = 2; + const STATUS_HAVE_ALL_PACKS = 3; + const STATUS_COMPLETED = 4; + public $status; //TODO: add constants for status types public $packIds = []; diff --git a/src/pocketmine/network/protocol/ResourcePackStackPacket.php b/src/pocketmine/network/protocol/ResourcePackStackPacket.php new file mode 100644 index 000000000..3a9fb43a8 --- /dev/null +++ b/src/pocketmine/network/protocol/ResourcePackStackPacket.php @@ -0,0 +1,73 @@ + + + +use pocketmine\resourcepacks\ResourcePackInfoEntry; + +class ResourcePackStackPacket extends DataPacket{ + const NETWORK_ID = Info::RESOURCE_PACK_STACK_PACKET; + + public $mustAccept = false; + + /** @var ResourcePackInfoEntry[] */ + public $behaviorPackStack = []; + /** @var ResourcePackInfoEntry[] */ + public $resourcePackStack = []; + + public function decode(){ + $this->mustAccept = $this->getBool(); + $behaviorPackCount = $this->getLShort(); + while($behaviorPackCountCount-- > 0){ + $packId = $this->getString(); + $version = $this->getString(); + $this->behaviorPackStack[] = new ResourcePackInfoEntry($packId, $version); + } + + $resourcePackCount = $this->getLShort(); + while($resourcePackCount-- > 0){ + $packId = $this->getString(); + $version = $this->getString(); + $this->resourcePackStack[] = new ResourcePackInfoEntry($packId, $version); + } + } + + public function encode(){ + $this->reset(); + $this->putBool($this->mustAccept); + + $this->putLShort(count($this->behaviorPackStack)); + foreach($this->behaviorPackStack as $entry){ + $this->putString($entry->getPackId()); + $this->putString($entry->getVersion()); + } + + $this->putLShort(count($this->resourcePackStack)); + foreach($this->resourcePackStack as $entry){ + $this->putString($entry->getPackId()); + $this->putString($entry->getVersion()); + } + } +} \ No newline at end of file diff --git a/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php b/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php index 0f844cee3..7dd85cce0 100644 --- a/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php +++ b/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php @@ -21,11 +21,11 @@ namespace pocketmine\network\protocol; -use pocketmine\resourcepacks\ResourcePackInfoEntry; - #include +use pocketmine\resourcepacks\ResourcePackInfoEntry; + class ResourcePacksInfoPacket extends DataPacket{ const NETWORK_ID = Info::RESOURCE_PACKS_INFO_PACKET; diff --git a/src/pocketmine/network/protocol/RiderJumpPacket.php b/src/pocketmine/network/protocol/RiderJumpPacket.php new file mode 100644 index 000000000..636082487 --- /dev/null +++ b/src/pocketmine/network/protocol/RiderJumpPacket.php @@ -0,0 +1,41 @@ + + + +class RiderJumpPacket extends DataPacket{ + const NETWORK_ID = Info::RIDER_JUMP_PACKET; + + public $unknown; + + public function decode(){ + $this->unknown = $this->getVarInt(); + } + + public function encode(){ + $this->reset(); + $this->putVarInt($this->unknown); + } +} \ No newline at end of file diff --git a/src/pocketmine/resourcepacks/ResourcePackInfoEntry.php b/src/pocketmine/resourcepacks/ResourcePackInfoEntry.php index edb70b768..db955c0cd 100644 --- a/src/pocketmine/resourcepacks/ResourcePackInfoEntry.php +++ b/src/pocketmine/resourcepacks/ResourcePackInfoEntry.php @@ -26,7 +26,7 @@ class ResourcePackInfoEntry{ protected $version; protected $packSize; - public function __construct(string $packId, string $version, $packSize){ + public function __construct(string $packId, string $version, $packSize = 0){ $this->packId = $packId; $this->version = $version; $this->packSize = $packSize;