24 public const NETWORK_ID = ProtocolInfo::ANIMATE_PACKET;
26 public const ACTION_SWING_ARM = 1;
28 public const ACTION_STOP_SLEEP = 3;
29 public const ACTION_CRITICAL_HIT = 4;
30 public const ACTION_MAGICAL_CRITICAL_HIT = 5;
31 public const ACTION_ROW_RIGHT = 128;
32 public const ACTION_ROW_LEFT = 129;
35 public int $actorRuntimeId;
36 public float $data = 0.0;
37 public float $rowingTime = 0.0;
39 public static function create(
int $actorRuntimeId,
int $actionId,
float $data = 0.0) :
self{
41 $result->actorRuntimeId = $actorRuntimeId;
42 $result->action = $actionId;
43 $result->data = $data;
47 public static function boatHack(
int $actorRuntimeId,
int $actionId,
float $rowingTime) :
self{
48 if($actionId !== self::ACTION_ROW_LEFT && $actionId !== self::ACTION_ROW_RIGHT){
49 throw new \InvalidArgumentException(
"Invalid actionId for boatHack: $actionId");
52 $result = self::create($actorRuntimeId, $actionId);
53 $result->rowingTime = $rowingTime;
58 $this->action = VarInt::readSignedInt($in);
59 $this->actorRuntimeId = CommonTypes::getActorRuntimeId($in);
60 $this->data = LE::readFloat($in);
61 if($this->action === self::ACTION_ROW_LEFT || $this->action === self::ACTION_ROW_RIGHT){
62 $this->rowingTime = LE::readFloat($in);
67 VarInt::writeSignedInt($out, $this->action);
68 CommonTypes::putActorRuntimeId($out, $this->actorRuntimeId);
69 LE::writeFloat($out, $this->data);
70 if($this->action === self::ACTION_ROW_LEFT || $this->action === self::ACTION_ROW_RIGHT){
71 LE::writeFloat($out, $this->rowingTime);
76 return $handler->handleAnimate($this);