diff --git a/src/pocketmine/network/Network.php b/src/pocketmine/network/Network.php index b930460c9..9418159db 100644 --- a/src/pocketmine/network/Network.php +++ b/src/pocketmine/network/Network.php @@ -90,6 +90,7 @@ use pocketmine\network\protocol\SpawnExperienceOrbPacket; use pocketmine\network\protocol\StartGamePacket; use pocketmine\network\protocol\TakeItemEntityPacket; use pocketmine\network\protocol\TextPacket; +use pocketmine\network\protocol\TransferPacket; use pocketmine\network\protocol\UpdateBlockPacket; use pocketmine\network\protocol\UseItemPacket; use pocketmine\Player; @@ -365,6 +366,7 @@ class Network{ $this->registerPacket(ProtocolInfo::START_GAME_PACKET, StartGamePacket::class); $this->registerPacket(ProtocolInfo::TAKE_ITEM_ENTITY_PACKET, TakeItemEntityPacket::class); $this->registerPacket(ProtocolInfo::TEXT_PACKET, TextPacket::class); + $this->registerPacket(ProtocolInfo::TRANSFER_PACKET, TransferPacket::class); $this->registerPacket(ProtocolInfo::UPDATE_BLOCK_PACKET, UpdateBlockPacket::class); $this->registerPacket(ProtocolInfo::USE_ITEM_PACKET, UseItemPacket::class); } diff --git a/src/pocketmine/network/protocol/Info.php b/src/pocketmine/network/protocol/Info.php index 75c6fdda9..227432767 100644 --- a/src/pocketmine/network/protocol/Info.php +++ b/src/pocketmine/network/protocol/Info.php @@ -30,9 +30,9 @@ interface Info{ /** * Actual Minecraft: PE protocol version */ - const CURRENT_PROTOCOL = 100; - const MINECRAFT_VERSION = "v1.0.0.16"; - const MINECRAFT_VERSION_NETWORK = "1.0.0.16"; + const CURRENT_PROTOCOL = 101; + const MINECRAFT_VERSION = "v1.0.3.0"; + const MINECRAFT_VERSION_NETWORK = "1.0.3.0"; const LOGIN_PACKET = 0x01; const PLAY_STATUS_PACKET = 0x02; @@ -115,5 +115,6 @@ interface Info{ const RESOURCE_PACK_DATA_INFO_PACKET = 0x4f; const RESOURCE_PACK_CHUNK_DATA_PACKET = 0x50; const RESOURCE_PACK_CHUNK_REQUEST_PACKET = 0x51; + const TRANSFER_PACKET = 0x52; } \ No newline at end of file diff --git a/src/pocketmine/network/protocol/LoginPacket.php b/src/pocketmine/network/protocol/LoginPacket.php index e293b135a..2b50f78fe 100644 --- a/src/pocketmine/network/protocol/LoginPacket.php +++ b/src/pocketmine/network/protocol/LoginPacket.php @@ -40,6 +40,8 @@ class LoginPacket extends DataPacket{ public $skinId; public $skin = null; + public $clientData = []; + public function decode(){ $this->protocol = $this->getInt(); @@ -70,18 +72,14 @@ class LoginPacket extends DataPacket{ } } - $skinToken = $this->decodeToken($this->get($this->getLInt())); - if(isset($skinToken["ClientRandomId"])){ - $this->clientId = $skinToken["ClientRandomId"]; - } - if(isset($skinToken["ServerAddress"])){ - $this->serverAddress = $skinToken["ServerAddress"]; - } - if(isset($skinToken["SkinData"])){ - $this->skin = base64_decode($skinToken["SkinData"]); - } - if(isset($skinToken["SkinId"])){ - $this->skinId = $skinToken["SkinId"]; + $this->clientData = $this->decodeToken($this->get($this->getLInt())); + + $this->clientId = $this->clientData["ClientRandomId"] ?? null; + $this->serverAddress = $this->clientData["ServerAddress"] ?? null; + $this->skinId = $this->clientData["SkinId"] ?? null; + + if(isset($this->clientData["SkinData"])){ + $this->skin = base64_decode($this->clientData["SkinData"]); } } diff --git a/src/pocketmine/network/protocol/TransferPacket.php b/src/pocketmine/network/protocol/TransferPacket.php new file mode 100644 index 000000000..5696e7bbe --- /dev/null +++ b/src/pocketmine/network/protocol/TransferPacket.php @@ -0,0 +1,42 @@ + + +class TransferPacket extends DataPacket{ + const NETWORK_ID = Info::TRANSFER_PACKET; + + public $address; + public $port = 19132; + + public function decode(){ + + } + + public function encode(){ + $this->reset(); + $this->putString($this->address); + $this->putLShort($this->port); + } + +} \ No newline at end of file