use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\protocol\types\ContainerIds; /** * One of the most useless packets. */ class PlayerHotbarPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::PLAYER_HOTBAR_PACKET; /** @var int */ public $selectedHotbarSlot; /** @var int */ public $windowId = ContainerIds::INVENTORY; /** @var bool */ public $selectHotbarSlot = true; protected function decodePayload(){ $this->selectedHotbarSlot = $this->getUnsignedVarInt(); $this->windowId = $this->getByte(); $this->selectHotbarSlot = $this->getBool(); } protected function encodePayload(){ $this->putUnsignedVarInt($this->selectedHotbarSlot); $this->putByte($this->windowId); $this->putBool($this->selectHotbarSlot); } public function handle(NetworkSession $session) : bool{ return $session->handlePlayerHotbar($this); } }