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

Player Abilities (clientbound)

Play 0x40, server → client.

play · 0x40 · clientbound (server → client)

Sets the player’s abilities: a flags bitfield (invulnerable, flying, allow flying, creative mode / instant break) plus flyingSpeed and the walkingSpeed field of view modifier. The server sends it after login, on game mode change, and when flight is toggled. The client applies the abilities to the local player.

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

Fields

Field Type Notes
flags Number
flyingSpeed Number
walkingSpeed Number

Send it

import { helpers } from "mc-protocol";

await client.sendPacket("PlayerAbilities", {
  flags: helpers.playerAbilityFlags({ allowFlying: true, flying: true }),
  flyingSpeed: 0.05,
  walkingSpeed: 0.1,
});

flags is one byte: invulnerable 0x01, flying 0x02, allowFlying 0x04, creativeMode 0x08. Read a client’s reply with helpers.unpackFlags(helpers.PLAYER_ABILITY_FLAGS, data.flags). See Packet flags.

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

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

Was this page helpful?