diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index 4c5bb7b8d..0f0af85cf 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -114,14 +114,20 @@ class NetworkBinaryStream extends BinaryStream{ $this->putLInt($animation->getType()); $this->putLFloat($animation->getFrames()); } - $this->putSkinImage(new SkinImage(0, 0, $skin->getCapeData())); + if($skin->getCapeData() !== ""){ + $this->putSkinImage(new SkinImage(32, 64, $skin->getCapeData())); + }else{ + $this->putSkinImage(new SkinImage(0, 0, "")); + } $this->putString($skin->getGeometryData()); $this->putString(""); //animation data $this->putBool(false); //isPremium $this->putBool(false); //isPersona $this->putBool(false); //isCapeOnClassic $this->putString(""); //capeId - $this->putString(""); //fullskinId + + //this has to be unique or the client will do stupid things + $this->putString(UUID::fromRandom()->toString()); //full skin ID } private function getSkinImage() : SkinImage{ diff --git a/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php b/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php index 7964b1b45..28c61b970 100644 --- a/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php @@ -74,6 +74,8 @@ class AddPlayerPacket extends DataPacket{ /** @var string */ public $deviceId = ""; //TODO: fill player's device ID (???) + /** @var int */ + public $buildPlatform = -1; protected function decodePayload(){ $this->uuid = $this->getUUID(); @@ -103,6 +105,7 @@ class AddPlayerPacket extends DataPacket{ } $this->deviceId = $this->getString(); + $this->buildPlatform = $this->getLInt(); } protected function encodePayload(){ @@ -133,6 +136,7 @@ class AddPlayerPacket extends DataPacket{ } $this->putString($this->deviceId); + $this->putLInt($this->buildPlatform); } public function handle(NetworkSession $session) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/MultiplayerSettingsPacket.php b/src/pocketmine/network/mcpe/protocol/MultiplayerSettingsPacket.php index 28a0d9145..b12afd01a 100644 --- a/src/pocketmine/network/mcpe/protocol/MultiplayerSettingsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MultiplayerSettingsPacket.php @@ -27,15 +27,32 @@ namespace pocketmine\network\mcpe\protocol; use pocketmine\network\mcpe\NetworkSession; -class MultiplayerSettingsPacket extends DataPacket{ +class MultiplayerSettingsPacket extends DataPacket/* implements ServerboundPacket*/{ //TODO: this might be clientbound too, but unsure public const NETWORK_ID = ProtocolInfo::MULTIPLAYER_SETTINGS_PACKET; + public const ACTION_ENABLE_MULTIPLAYER = 0; + public const ACTION_DISABLE_MULTIPLAYER = 1; + public const ACTION_REFRESH_JOIN_CODE = 2; + + /** @var int */ + private $action; + + public static function create(int $action) : self{ + $result = new self; + $result->action = $action; + return $result; + } + + public function getAction() : int{ + return $this->action; + } + protected function decodePayload() : void{ - //TODO + $this->action = $this->getVarInt(); } protected function encodePayload() : void{ - //TODO + $this->putVarInt($this->action); } public function handle(NetworkSession $handler) : bool{