Skip to content
mc-protocol
Esc
↑↓navigate↵open⌘Jpreview
On this page

Set Experience

Play 0x67, server → client.

play · 0x67 · clientbound (server → client)

Sets the player’s experience bar fill, level and total experience. The server sends it when the player gains or loses experience. The client updates the XP bar and level display.

Sent by the server, read by the client. Listen for it with client.on("SetExperience", (data) => …) on the receiving side.

Fields

Field Type Notes
experienceBar Float
level VarInt
totalExperience VarInt

Send it

await client.sendPacket("SetExperience", {
  experienceBar: 0.5, // 0 to 1
  level: 30,
  totalExperience: 1395,
});

experienceBar fills the bar, level is the number shown on it. totalExperience is the raw point total and only matters for the client’s own bookkeeping.

Field aliases listed under Notes are accepted as alternative keys when writing.

Source: src/Core/Versions/776/Packets/play/clientbound/SetExperience.ts

Was this page helpful?