mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
SkinData: fixed loss of data from packet decode
This commit is contained in:
parent
778814a35e
commit
93597dcd50
@ -100,7 +100,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$capeId = $this->getString();
|
||||
$fullSkinId = $this->getString();
|
||||
|
||||
return new SkinData($skinId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId);
|
||||
return new SkinData($skinId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId, $fullSkinId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,9 +123,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$this->putBool($skin->isPersona());
|
||||
$this->putBool($skin->isPersonaCapeOnClassic());
|
||||
$this->putString($skin->getCapeId());
|
||||
|
||||
//this has to be unique or the client will do stupid things
|
||||
$this->putString(UUID::fromRandom()->toString()); //full skin ID
|
||||
$this->putString($skin->getFullSkinId());
|
||||
}
|
||||
|
||||
private function getSkinImage() : SkinImage{
|
||||
|
@ -23,6 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
use pocketmine\utils\UUID;
|
||||
|
||||
class SkinData{
|
||||
|
||||
/** @var string */
|
||||
@ -47,11 +49,13 @@ class SkinData{
|
||||
private $personaCapeOnClassic;
|
||||
/** @var string */
|
||||
private $capeId;
|
||||
/** @var string */
|
||||
private $fullSkinId;
|
||||
|
||||
/**
|
||||
* @param SkinAnimation[] $animations
|
||||
*/
|
||||
public function __construct(string $skinId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = ""){
|
||||
public function __construct(string $skinId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = "", ?string $fullSkinId = null){
|
||||
$this->skinId = $skinId;
|
||||
$this->resourcePatch = $resourcePatch;
|
||||
$this->skinImage = $skinImage;
|
||||
@ -63,6 +67,8 @@ class SkinData{
|
||||
$this->persona = $persona;
|
||||
$this->personaCapeOnClassic = $personaCapeOnClassic;
|
||||
$this->capeId = $capeId;
|
||||
//this has to be unique or the client will do stupid things
|
||||
$this->fullSkinId = $fullSkinId ?? UUID::fromRandom()->toString();
|
||||
}
|
||||
|
||||
public function getSkinId() : string{
|
||||
@ -112,4 +118,7 @@ class SkinData{
|
||||
return $this->capeId;
|
||||
}
|
||||
|
||||
public function getFullSkinId() : string{
|
||||
return $this->fullSkinId;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user