mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +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{
|
class AddHangingEntityPacket extends DataPacket{
|
||||||
public const NETWORK_ID = ProtocolInfo::ADD_HANGING_ENTITY_PACKET;
|
public const NETWORK_ID = ProtocolInfo::ADD_HANGING_ENTITY_PACKET;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int|null */
|
||||||
public $entityUniqueId;
|
public $entityUniqueId = null;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $entityRuntimeId;
|
public $entityRuntimeId;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
@ -41,20 +41,20 @@ class AddHangingEntityPacket extends DataPacket{
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $z;
|
public $z;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $unknown; //TODO (rotation?)
|
public $direction;
|
||||||
|
|
||||||
protected function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->unknown = $this->getVarInt();
|
$this->direction = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->putVarInt($this->unknown);
|
$this->putVarInt($this->direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(NetworkSession $session) : bool{
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
@ -28,37 +28,19 @@ namespace pocketmine\network\mcpe\protocol;
|
|||||||
|
|
||||||
use pocketmine\network\mcpe\NetworkSession;
|
use pocketmine\network\mcpe\NetworkSession;
|
||||||
|
|
||||||
class AddPaintingPacket extends DataPacket{
|
class AddPaintingPacket extends AddHangingEntityPacket{
|
||||||
public const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET;
|
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 */
|
/** @var string */
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
protected function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
parent::decodePayload();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
|
||||||
$this->direction = $this->getVarInt();
|
|
||||||
$this->title = $this->getString();
|
$this->title = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
parent::encodePayload();
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
|
||||||
$this->putVarInt($this->direction);
|
|
||||||
$this->putString($this->title);
|
$this->putString($this->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user