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_RELEASE_ITEM;
27 public const ACTION_RELEASE = 0;
28 public const ACTION_CONSUME = 1;
30 private int $actionType;
31 private int $hotbarSlot;
35 public function getActionType() :
int{
36 return $this->actionType;
39 public function getHotbarSlot() :
int{
40 return $this->hotbarSlot;
44 return $this->itemInHand;
47 public function getHeadPosition() :
Vector3{
48 return $this->headPosition;
52 $this->actionType = $stream->getUnsignedVarInt();
54 $this->itemInHand = $stream->getItemStackWrapper();
59 $stream->putUnsignedVarInt($this->actionType);
61 $stream->putItemStackWrapper($this->itemInHand);
68 public static function new(array $actions,
int $actionType,
int $hotbarSlot,
ItemStackWrapper $itemInHand,
Vector3 $headPosition) :
self{
70 $result->actions = $actions;
71 $result->actionType = $actionType;
72 $result->hotbarSlot = $hotbarSlot;
73 $result->itemInHand = $itemInHand;
74 $result->headPosition = $headPosition;
putVector3(Vector3 $vector)
decodeData(PacketSerializer $stream)