mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Clean up on AddHangingEntityPacket and AddPaintingPacket
AddPainting is a subclass of AddHangingEntity in vanilla.
This commit is contained in:
parent
e85fc54037
commit
5b532fdcf5
@ -30,8 +30,8 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class AddHangingEntityPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_HANGING_ENTITY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $entityUniqueId;
|
||||
/** @var int|null */
|
||||
public $entityUniqueId = null;
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
@ -41,20 +41,20 @@ class AddHangingEntityPacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $unknown; //TODO (rotation?)
|
||||
public $direction;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->unknown = $this->getVarInt();
|
||||
$this->direction = $this->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityUniqueId($this->entityUniqueId);
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putVarInt($this->unknown);
|
||||
$this->putVarInt($this->direction);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -28,37 +28,19 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
class AddPaintingPacket extends DataPacket{
|
||||
class AddPaintingPacket extends AddHangingEntityPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET;
|
||||
|
||||
/** @var int|null */
|
||||
public $entityUniqueId = null; //TODO
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
/** @var int */
|
||||
public $z;
|
||||
/** @var int */
|
||||
public $direction;
|
||||
/** @var string */
|
||||
public $title;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->direction = $this->getVarInt();
|
||||
parent::decodePayload();
|
||||
$this->title = $this->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putVarInt($this->direction);
|
||||
parent::encodePayload();
|
||||
$this->putString($this->title);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user