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

Change Game Mode

Play 0x05, client → server.

play · 0x05 · serverbound (client → server)

Requests a game mode change from the F3+F4 game mode switcher. The server applies it only if the player has permission for the /gamemode command; the result is sent back through GameEvent.

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

Fields

Field Type Notes
mode VarInt Enum: 0 survival, 1 creative, 2 adventure, 3 spectator. also gamemode

Send it

await client.sendPacket("ChangeGameMode", {
  mode: /* VarInt */,
});

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

Source: src/Core/Versions/776/Packets/play/serverbound/ChangeGameMode.ts

Was this page helpful?