Synchronize Player Position
Play 0x48, server → client.
play · 0x48 · clientbound (server → client)
Teleports the player to an absolute or relative position, rotation and velocity. The server sends it on join, respawn, teleport, or when it rejects client movement. The client applies the values and must reply with AcceptTeleportation echoing teleportId; the server ignores movement packets until it does.
Sent by the server, read by the client. Listen for it with client.on("SynchronizePlayerPosition", (data) => …) on the receiving side.
Fields
| Field | Type | Notes |
|---|---|---|
teleportId |
VarInt | |
x |
Double | |
y |
Double | |
z |
Double | |
velocityX |
Double | Optional. |
velocityY |
Double | Optional. |
velocityZ |
Double | Optional. |
yaw |
Float | Optional. |
pitch |
Float | Optional. |
flags |
U32 | Optional. |
Send it
import { helpers } from "mc-protocol";
// Absolute teleport to spawn; the client answers with AcceptTeleportation.
await client.sendPacket("SynchronizePlayerPosition", {
teleportId: 1,
x: 0.5, y: 65, z: 0.5,
yaw: 0, pitch: 0,
flags: 0,
});
// Move 5 blocks up and keep the current rotation.
await client.sendPacket("SynchronizePlayerPosition", {
teleportId: 2,
x: 0, y: 5, z: 0,
flags: helpers.teleportFlags(["x", "y", "z", "yaw", "pitch"]),
});
flags is a 32-bit bitmask; a set bit makes that field relative. Build it with helpers.teleportFlags or helpers.packFlags(helpers.TELEPORT_FLAGS, …). See Packet flags for every bit.
Field aliases listed under Notes are accepted as alternative keys when writing.
Source: src/Core/Versions/776/Packets/play/clientbound/SynchronizePlayerPosition.ts