From 92fd2d35a4e11fbd1228d5691f0897cc0914aeb1 Mon Sep 17 00:00:00 2001 From: Carson <51865762+BoomYourBang@users.noreply.github.com> Date: Mon, 24 May 2021 15:33:24 -0400 Subject: [PATCH 1/3] SetDisplayObjectivePacket: added order and display slot constants (#4232) --- .../network/mcpe/protocol/SetDisplayObjectivePacket.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pocketmine/network/mcpe/protocol/SetDisplayObjectivePacket.php b/src/pocketmine/network/mcpe/protocol/SetDisplayObjectivePacket.php index a4b1aa54a..e61e0cd73 100644 --- a/src/pocketmine/network/mcpe/protocol/SetDisplayObjectivePacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetDisplayObjectivePacket.php @@ -30,6 +30,13 @@ use pocketmine\network\mcpe\NetworkSession; class SetDisplayObjectivePacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::SET_DISPLAY_OBJECTIVE_PACKET; + public const DISPLAY_SLOT_LIST = "list"; + public const DISPLAY_SLOT_SIDEBAR = "sidebar"; + public const DISPLAY_SLOT_BELOW_NAME = "belowname"; + + public const SORT_ORDER_ASCENDING = 0; + public const SORT_ORDER_DESCENDING = 1; + /** @var string */ public $displaySlot; /** @var string */ From 12c66d33624428c0aaf21afb6da97a7226daa6f0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 4 Jun 2021 17:13:19 +0100 Subject: [PATCH 2/3] CraftingDataPacket: fixed assert failure on debug builds --- src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php b/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php index da2ad43fb..84c795a2c 100644 --- a/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php @@ -276,7 +276,7 @@ class CraftingDataPacket extends DataPacket{ $writer = new NetworkBinaryStream(); $counter = 0; foreach($this->entries as $d){ - $entryType = self::writeEntry($d, $writer, $counter++); + $entryType = self::writeEntry($d, $writer, ++$counter); if($entryType >= 0){ $this->putVarInt($entryType); $this->put($writer->getBuffer()); From b257348a3a2377ae9251983cc90cf31f77bbbc8e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 4 Jun 2021 17:18:24 +0100 Subject: [PATCH 3/3] Renamed fields of AddEntityPacket and RemoveEntityPacket --- .../network/mcpe/protocol/AddEntityPacket.php | 14 +++++++------- .../network/mcpe/protocol/RemoveEntityPacket.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php b/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php index 726a3c7d5..a2c4e57dd 100644 --- a/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php @@ -31,24 +31,24 @@ class AddEntityPacket extends DataPacket/* implements ClientboundPacket*/{ public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET; /** @var int */ - private $uvarint1; + private $entityNetId; - public static function create(int $uvarint1) : self{ + public static function create(int $entityNetId) : self{ $result = new self; - $result->uvarint1 = $uvarint1; + $result->entityNetId = $entityNetId; return $result; } - public function getUvarint1() : int{ - return $this->uvarint1; + public function getEntityNetId() : int{ + return $this->entityNetId; } protected function decodePayload() : void{ - $this->uvarint1 = $this->getUnsignedVarInt(); + $this->entityNetId = $this->getUnsignedVarInt(); } protected function encodePayload() : void{ - $this->putUnsignedVarInt($this->uvarint1); + $this->putUnsignedVarInt($this->entityNetId); } public function handle(NetworkSession $handler) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php b/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php index ca5b0a6d9..9b301c064 100644 --- a/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php @@ -31,24 +31,24 @@ class RemoveEntityPacket extends DataPacket/* implements ClientboundPacket*/{ public const NETWORK_ID = ProtocolInfo::REMOVE_ENTITY_PACKET; /** @var int */ - private $uvarint1; + private $entityNetId; - public static function create(int $uvarint1) : self{ + public static function create(int $entityNetId) : self{ $result = new self; - $result->uvarint1 = $uvarint1; + $result->entityNetId = $entityNetId; return $result; } - public function getUvarint1() : int{ - return $this->uvarint1; + public function getEntityNetId() : int{ + return $this->entityNetId; } protected function decodePayload() : void{ - $this->uvarint1 = $this->getUnsignedVarInt(); + $this->entityNetId = $this->getUnsignedVarInt(); } protected function encodePayload() : void{ - $this->putUnsignedVarInt($this->uvarint1); + $this->putUnsignedVarInt($this->entityNetId); } public function handle(NetworkSession $handler) : bool{