13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
21 public const NETWORK_ID = ProtocolInfo::MOVE_PLAYER_PACKET;
23 public const MODE_NORMAL = 0;
24 public const MODE_RESET = 1;
25 public const MODE_TELEPORT = 2;
26 public const MODE_PITCH = 3;
28 public int $actorRuntimeId;
32 public float $headYaw;
33 public int $mode = self::MODE_NORMAL;
34 public bool $onGround =
false;
35 public int $ridingActorRuntimeId = 0;
36 public int $teleportCause = 0;
37 public int $teleportItem = 0;
51 int $ridingActorRuntimeId,
57 $result->actorRuntimeId = $actorRuntimeId;
58 $result->position = $position;
59 $result->pitch = $pitch;
61 $result->headYaw = $headYaw;
62 $result->mode = $mode;
63 $result->onGround = $onGround;
64 $result->ridingActorRuntimeId = $ridingActorRuntimeId;
65 $result->teleportCause = $teleportCause;
66 $result->teleportItem = $teleportItem;
67 $result->tick = $tick;
71 public static function simple(
79 int $ridingActorRuntimeId,
82 return self::create($actorRuntimeId, $position, $pitch, $yaw, $headYaw, $mode, $onGround, $ridingActorRuntimeId, 0, 0, $tick);
86 $this->actorRuntimeId = $in->getActorRuntimeId();
92 $this->onGround = $in->
getBool();
94 if($this->mode === MovePlayerPacket::MODE_TELEPORT){
95 $this->teleportCause = $in->
getLInt();
96 $this->teleportItem = $in->
getLInt();
102 $out->putActorRuntimeId($this->actorRuntimeId);
104 $out->putLFloat($this->pitch);
105 $out->putLFloat($this->yaw);
106 $out->putLFloat($this->headYaw);
107 $out->putByte($this->mode);
108 $out->putBool($this->onGround);
109 $out->putActorRuntimeId($this->ridingActorRuntimeId);
110 if($this->mode === MovePlayerPacket::MODE_TELEPORT){
111 $out->putLInt($this->teleportCause);
112 $out->putLInt($this->teleportItem);
118 return $handler->handleMovePlayer($this);
encodePayload(PacketSerializer $out)
static create(int $actorRuntimeId, Vector3 $position, float $pitch, float $yaw, float $headYaw, int $mode, bool $onGround, int $ridingActorRuntimeId, int $teleportCause, int $teleportItem, int $tick,)
decodePayload(PacketSerializer $in)
handle(PacketHandlerInterface $handler)
putVector3(Vector3 $vector)
putUnsignedVarLong(int $v)