26    use GetTypeIdFromConstTrait;
 
   28    public const ID = InventoryTransactionPacket::TYPE_USE_ITEM_ON_ENTITY;
 
   30    public const ACTION_INTERACT = 0;
 
   31    public const ACTION_ATTACK = 1;
 
   32    public const ACTION_ITEM_INTERACT = 2;
 
   34    private int $actorRuntimeId;
 
   35    private int $actionType;
 
   36    private int $hotbarSlot;
 
   38    private Vector3 $playerPosition;
 
   41    public function getActorRuntimeId() : 
int{
 
   42        return $this->actorRuntimeId;
 
   45    public function getActionType() : 
int{
 
   46        return $this->actionType;
 
   49    public function getHotbarSlot() : 
int{
 
   50        return $this->hotbarSlot;
 
   54        return $this->itemInHand;
 
   57    public function getPlayerPosition() : 
Vector3{
 
   58        return $this->playerPosition;
 
   61    public function getClickPosition() : 
Vector3{
 
   62        return $this->clickPosition;
 
   65    protected function decodeData(ByteBufferReader $in) : void{
 
   66        $this->actorRuntimeId = 
CommonTypes::getActorRuntimeId($in);
 
   67        $this->actionType = VarInt::readUnsignedInt($in);
 
   68        $this->hotbarSlot = VarInt::readSignedInt($in);
 
   69        $this->itemInHand = CommonTypes::getItemStackWrapper($in);
 
   70        $this->playerPosition = CommonTypes::getVector3($in);
 
   71        $this->clickPosition = CommonTypes::getVector3($in);
 
 
   74    protected function encodeData(ByteBufferWriter $out) : void{
 
   75        CommonTypes::putActorRuntimeId($out, $this->actorRuntimeId);
 
   76        VarInt::writeUnsignedInt($out, $this->actionType);
 
   77        VarInt::writeSignedInt($out, $this->hotbarSlot);
 
   78        CommonTypes::putItemStackWrapper($out, $this->itemInHand);
 
   79        CommonTypes::putVector3($out, $this->playerPosition);
 
   80        CommonTypes::putVector3($out, $this->clickPosition);
 
   86    private static function initSelf(
int $actorRuntimeId, 
int $actionType, 
int $hotbarSlot, 
ItemStackWrapper $itemInHand, 
Vector3 $playerPosition, 
Vector3 $clickPosition) : self{
 
   88        $result->actorRuntimeId = $actorRuntimeId;
 
   89        $result->actionType = $actionType;
 
   90        $result->hotbarSlot = $hotbarSlot;
 
   91        $result->itemInHand = $itemInHand;
 
   92        $result->playerPosition = $playerPosition;
 
   93        $result->clickPosition = $clickPosition;
 
  100    public static function new(array $actions, 
int $actorRuntimeId, 
int $actionType, 
int $hotbarSlot, 
ItemStackWrapper $itemInHand, 
Vector3 $playerPosition, 
Vector3 $clickPosition) : self{
 
  101        $result = self::initSelf($actorRuntimeId, $actionType, $hotbarSlot, $itemInHand, $playerPosition, $clickPosition);
 
  102        $result->actions = $actions;