mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 08:49:42 +00:00
Merge branch 'stable' of https://github.com/drew-mcbe/pocketmine-mp into drew-1.13
This commit is contained in:
commit
ef8e286277
@ -160,8 +160,6 @@ use pocketmine\tile\ItemFrame;
|
|||||||
use pocketmine\tile\Spawnable;
|
use pocketmine\tile\Spawnable;
|
||||||
use pocketmine\tile\Tile;
|
use pocketmine\tile\Tile;
|
||||||
use pocketmine\timings\Timings;
|
use pocketmine\timings\Timings;
|
||||||
use pocketmine\utils\SerializedImage;
|
|
||||||
use pocketmine\utils\SkinAnimation;
|
|
||||||
use pocketmine\utils\TextFormat;
|
use pocketmine\utils\TextFormat;
|
||||||
use pocketmine\utils\UUID;
|
use pocketmine\utils\UUID;
|
||||||
use function abs;
|
use function abs;
|
||||||
@ -2914,9 +2912,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
public function handleRespawn(RespawnPacket $packet) : bool{
|
public function handleRespawn(RespawnPacket $packet) : bool{
|
||||||
if(!$this->isAlive() && $packet->respawnState === RespawnPacket::CLIENT_READY_TO_SPAWN){
|
if(!$this->isAlive() && $packet->respawnState === RespawnPacket::CLIENT_READY_TO_SPAWN){
|
||||||
$this->sendRespawnPacket($this, RespawnPacket::READY_TO_SPAWN);
|
$this->sendRespawnPacket($this, RespawnPacket::READY_TO_SPAWN);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,10 +55,6 @@ class Skin{
|
|||||||
$this->geometryData = $geometryData;
|
$this->geometryData = $geometryData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function convertToLegacyName(string $name) : string{
|
|
||||||
return '{"geometry" : {"default" : "' . $name . '"}}';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -96,7 +96,7 @@ class FloatingTextParticle extends Particle{
|
|||||||
|
|
||||||
$add = new PlayerListPacket();
|
$add = new PlayerListPacket();
|
||||||
$add->type = PlayerListPacket::TYPE_ADD;
|
$add->type = PlayerListPacket::TYPE_ADD;
|
||||||
$add->entries = [PlayerListEntry::createAdditionEntry($uuid, $this->entityId, $name, new Skin("Standard_Custom", str_repeat("\x00", 8192), "", Skin::convertToLegacyName("geometry.humanoid.custom"), ""))];
|
$add->entries = [PlayerListEntry::createAdditionEntry($uuid, $this->entityId, $name, new Skin("Standard_Custom", str_repeat("\x00", 8192)))];
|
||||||
$p[] = $add;
|
$p[] = $add;
|
||||||
|
|
||||||
$pk = new AddPlayerPacket();
|
$pk = new AddPlayerPacket();
|
||||||
|
@ -38,10 +38,10 @@ use pocketmine\nbt\tag\CompoundTag;
|
|||||||
use pocketmine\nbt\tag\IntTag;
|
use pocketmine\nbt\tag\IntTag;
|
||||||
use pocketmine\network\mcpe\protocol\types\CommandOriginData;
|
use pocketmine\network\mcpe\protocol\types\CommandOriginData;
|
||||||
use pocketmine\network\mcpe\protocol\types\EntityLink;
|
use pocketmine\network\mcpe\protocol\types\EntityLink;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\SkinImage;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\SkinAnimation;
|
||||||
use pocketmine\network\mcpe\protocol\types\StructureSettings;
|
use pocketmine\network\mcpe\protocol\types\StructureSettings;
|
||||||
use pocketmine\utils\BinaryStream;
|
use pocketmine\utils\BinaryStream;
|
||||||
use pocketmine\utils\SerializedImage;
|
|
||||||
use pocketmine\utils\SkinAnimation;
|
|
||||||
use pocketmine\utils\UUID;
|
use pocketmine\utils\UUID;
|
||||||
use function count;
|
use function count;
|
||||||
use function strlen;
|
use function strlen;
|
||||||
@ -80,13 +80,17 @@ class NetworkBinaryStream extends BinaryStream{
|
|||||||
public function getSkin() : Skin{
|
public function getSkin() : Skin{
|
||||||
$skinId = $this->getString();
|
$skinId = $this->getString();
|
||||||
$skinResourcePatch = $this->getString();
|
$skinResourcePatch = $this->getString();
|
||||||
$skinData = $this->getImage();
|
$skinData = $this->getSkinImage();
|
||||||
$animationCount = $this->getLInt();
|
$animationCount = $this->getLInt();
|
||||||
$animations = [];
|
$animations = [];
|
||||||
for($i = 0; $i < $animationCount; ++$i){
|
for($i = 0; $i < $animationCount; ++$i){
|
||||||
$animations[] = new SkinAnimation($this->getImage(), $this->getLInt(), $this->getLFloat());
|
$animations[] = new SkinAnimation(
|
||||||
|
$skinImage = $this->getSkinImage(),
|
||||||
|
$animationType = $this->getLInt(),
|
||||||
|
$animationFrames = $this->getLFloat()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$capeData = $this->getImage();
|
$capeData = $this->getSkinImage();
|
||||||
$geometryData = $this->getString();
|
$geometryData = $this->getString();
|
||||||
$animationData = $this->getString();
|
$animationData = $this->getString();
|
||||||
$premium = $this->getBool();
|
$premium = $this->getBool();
|
||||||
@ -101,16 +105,16 @@ class NetworkBinaryStream extends BinaryStream{
|
|||||||
public function putSkin(Skin $skin){
|
public function putSkin(Skin $skin){
|
||||||
$this->putString($skin->getSkinId());
|
$this->putString($skin->getSkinId());
|
||||||
$this->putString($skin->getGeometryName()); //resource patch
|
$this->putString($skin->getGeometryName()); //resource patch
|
||||||
$this->putImage(SerializedImage::fromLegacy($skin->getSkinData()));
|
$this->putSkinImage(SkinImage::fromLegacy($skin->getSkinData()));
|
||||||
/** @var SkinAnimation[] $animations */
|
/** @var SkinAnimation[] $animations */
|
||||||
$animations = [];
|
$animations = [];
|
||||||
$this->putLInt(count($animations));
|
$this->putLInt(count($animations));
|
||||||
foreach($animations as $animation){
|
foreach($animations as $animation){
|
||||||
$this->putImage($animation->getImage());
|
$this->putSkinImage($animation->getImage());
|
||||||
$this->putLInt($animation->getType());
|
$this->putLInt($animation->getType());
|
||||||
$this->putLFloat($animation->getFrames());
|
$this->putLFloat($animation->getFrames());
|
||||||
}
|
}
|
||||||
$this->putImage(new SerializedImage(0, 0, $skin->getCapeData()));
|
$this->putSkinImage(new SkinImage(0, 0, $skin->getCapeData()));
|
||||||
$this->putString($skin->getGeometryData());
|
$this->putString($skin->getGeometryData());
|
||||||
$this->putString(""); //animation data
|
$this->putString(""); //animation data
|
||||||
$this->putBool(false); //isPremium
|
$this->putBool(false); //isPremium
|
||||||
@ -120,14 +124,14 @@ class NetworkBinaryStream extends BinaryStream{
|
|||||||
$this->putString(""); //fullskinId
|
$this->putString(""); //fullskinId
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImage() : SerializedImage{
|
private function getSkinImage() : SkinImage{
|
||||||
$width = $this->getLInt();
|
$width = $this->getLInt();
|
||||||
$height = $this->getLInt();
|
$height = $this->getLInt();
|
||||||
$data = $this->getString();
|
$data = $this->getString();
|
||||||
return new SerializedImage($height, $width, $data);
|
return new SkinImage($height, $width, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putImage(SerializedImage $image) : void{
|
private function putSkinImage(SkinImage $image) : void{
|
||||||
$this->putLInt($image->getWidth());
|
$this->putLInt($image->getWidth());
|
||||||
$this->putLInt($image->getHeight());
|
$this->putLInt($image->getHeight());
|
||||||
$this->putString($image->getData());
|
$this->putString($image->getData());
|
||||||
|
@ -27,8 +27,6 @@ namespace pocketmine\network\mcpe\protocol;
|
|||||||
|
|
||||||
use pocketmine\entity\Skin;
|
use pocketmine\entity\Skin;
|
||||||
use pocketmine\network\mcpe\NetworkSession;
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
use pocketmine\utils\SerializedImage;
|
|
||||||
use pocketmine\utils\SkinAnimation;
|
|
||||||
use pocketmine\utils\UUID;
|
use pocketmine\utils\UUID;
|
||||||
|
|
||||||
class PlayerSkinPacket extends DataPacket{
|
class PlayerSkinPacket extends DataPacket{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pocketmine\utils;
|
namespace pocketmine\network\mcpe\protocol\types;
|
||||||
|
|
||||||
class SkinAnimation{
|
class SkinAnimation{
|
||||||
|
|
||||||
@ -29,14 +29,14 @@ class SkinAnimation{
|
|||||||
public const TYPE_BODY_32 = 2;
|
public const TYPE_BODY_32 = 2;
|
||||||
public const TYPE_BODY_64 = 3;
|
public const TYPE_BODY_64 = 3;
|
||||||
|
|
||||||
/** @var SerializedImage */
|
/** @var SkinImage */
|
||||||
private $image;
|
private $image;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $type;
|
private $type;
|
||||||
/** @var float */
|
/** @var float */
|
||||||
private $frames;
|
private $frames;
|
||||||
|
|
||||||
public function __construct(SerializedImage $image, int $type, float $frames){
|
public function __construct(SkinImage $image, int $type, float $frames){
|
||||||
$this->image = $image;
|
$this->image = $image;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->frames = $frames;
|
$this->frames = $frames;
|
||||||
@ -45,9 +45,9 @@ class SkinAnimation{
|
|||||||
/**
|
/**
|
||||||
* Image of the animation.
|
* Image of the animation.
|
||||||
*
|
*
|
||||||
* @return SerializedImage
|
* @return SkinImage
|
||||||
*/
|
*/
|
||||||
public function getImage() : SerializedImage{
|
public function getImage() : SkinImage{
|
||||||
return $this->image;
|
return $this->image;
|
||||||
}
|
}
|
||||||
|
|
@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pocketmine\utils;
|
namespace pocketmine\network\mcpe\protocol\types;
|
||||||
|
|
||||||
class SerializedImage{
|
class SkinImage{
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $height;
|
private $height;
|
||||||
@ -38,7 +38,7 @@ class SerializedImage{
|
|||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fromLegacy(string $data) : SerializedImage{
|
public static function fromLegacy(string $data) : SkinImage{
|
||||||
switch(strlen($data)){
|
switch(strlen($data)){
|
||||||
case 64 * 32 * 4:
|
case 64 * 32 * 4:
|
||||||
return new self(64, 32, $data);
|
return new self(64, 32, $data);
|
Loading…
x
Reference in New Issue
Block a user