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

Change Difficulty (serverbound)

Play 0x04, client → server.

play · 0x04 · serverbound (client → server)

Requests a new world difficulty from the difficulty screen in the options menu. The server applies it only if the sender is an operator and the difficulty is not locked, then broadcasts ChangeDifficulty (clientbound) to all players.

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

Fields

Field Type Notes
newDifficulty VarInt Enum: 0 peaceful, 1 easy, 2 normal, 3 hard. also difficulty

Send it

await client.sendPacket("ChangeDifficulty", {
  newDifficulty: /* VarInt */,
});

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

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

Was this page helpful?