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

Change Difficulty (clientbound)

Play 0x0A, server → client.

play · 0x0A · clientbound (server → client)

Tells the client the world’s current difficulty (peaceful, easy, normal, hard) and whether it is locked. The server sends it after login and whenever the difficulty changes. The client only uses this to display the value in the options menu.

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

Fields

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

Send it

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

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

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

Was this page helpful?