13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol\types\inventory;
20use pocketmine\network\mcpe\protocol\types\GetTypeIdFromConstTrait;
23 use GetTypeIdFromConstTrait;
25 public const ID = InventoryTransactionPacket::TYPE_USE_ITEM_ON_ENTITY;
27 public const ACTION_INTERACT = 0;
28 public const ACTION_ATTACK = 1;
29 public const ACTION_ITEM_INTERACT = 2;
31 private int $actorRuntimeId;
32 private int $actionType;
33 private int $hotbarSlot;
35 private Vector3 $playerPosition;
38 public function getActorRuntimeId() :
int{
39 return $this->actorRuntimeId;
42 public function getActionType() :
int{
43 return $this->actionType;
46 public function getHotbarSlot() :
int{
47 return $this->hotbarSlot;
51 return $this->itemInHand;
54 public function getPlayerPosition() :
Vector3{
55 return $this->playerPosition;
58 public function getClickPosition() :
Vector3{
59 return $this->clickPosition;
63 $this->actorRuntimeId = $stream->getActorRuntimeId();
66 $this->itemInHand = $stream->getItemStackWrapper();
72 $stream->putActorRuntimeId($this->actorRuntimeId);
75 $stream->putItemStackWrapper($this->itemInHand);
83 public static function new(array $actions,
int $actorRuntimeId,
int $actionType,
int $hotbarSlot,
ItemStackWrapper $itemInHand,
Vector3 $playerPosition,
Vector3 $clickPosition) :
self{
85 $result->actions = $actions;
86 $result->actorRuntimeId = $actorRuntimeId;
87 $result->actionType = $actionType;
88 $result->hotbarSlot = $hotbarSlot;
89 $result->itemInHand = $itemInHand;
90 $result->playerPosition = $playerPosition;
91 $result->clickPosition = $clickPosition;
putVector3(Vector3 $vector)
decodeData(PacketSerializer $stream)
putUnsignedVarInt(int $v)