Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from dktapps/drew-1.13
Browse files Browse the repository at this point in the history
more 1.13
  • Loading branch information
Stephen authored Nov 12, 2019
2 parents ba5a598 + 10d4429 commit 7f34601
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/pocketmine/network/mcpe/NetworkBinaryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,20 @@ public function putSkin(Skin $skin){
$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{
Expand Down
4 changes: 4 additions & 0 deletions src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -103,6 +105,7 @@ protected function decodePayload(){
}

$this->deviceId = $this->getString();
$this->buildPlatform = $this->getLInt();
}

protected function encodePayload(){
Expand Down Expand Up @@ -133,6 +136,7 @@ protected function encodePayload(){
}

$this->putString($this->deviceId);
$this->putLInt($this->buildPlatform);
}

public function handle(NetworkSession $session) : bool{
Expand Down
23 changes: 20 additions & 3 deletions src/pocketmine/network/mcpe/protocol/MultiplayerSettingsPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,32 @@

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{
Expand Down

0 comments on commit 7f34601

Please sign in to comment.