ClientboundChangeDifficultyPacket .java

net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket (record): members: difficulty, locked, handle, STREAM_CODEC, type. imports: ByteBuf.

net.minecraft.network.protocol.gamerecord28 linescommon992 B

Implements

API Surface (2)

PacketType<ClientboundChangeDifficultyPacket> type()
void handle(final ClientGamePacketListener listener)

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ClientboundChangeDifficultyPacket.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.codec.ByteBufCodecs;
5
import net.minecraft.network.codec.StreamCodec;
6
import net.minecraft.network.protocol.Packet;
7
import net.minecraft.network.protocol.PacketType;
8
import net.minecraft.world.Difficulty;
9
10
public record ClientboundChangeDifficultyPacket(Difficulty difficulty, boolean locked) implements Packet<ClientGamePacketListener> {
11
	public static final StreamCodec<ByteBuf, ClientboundChangeDifficultyPacket> STREAM_CODEC = StreamCodec.composite(
12
		Difficulty.STREAM_CODEC,
13
		ClientboundChangeDifficultyPacket::difficulty,
14
		ByteBufCodecs.BOOL,
15
		ClientboundChangeDifficultyPacket::locked,
16
		ClientboundChangeDifficultyPacket::new
17
	);
18
19
	@Override
20
	public PacketType<ClientboundChangeDifficultyPacket> type() {
21
		return GamePacketTypes.CLIENTBOUND_CHANGE_DIFFICULTY;
22
	}
23
24
	public void handle(final ClientGamePacketListener listener) {
25
		listener.handleChangeDifficulty(this);
26
	}
27
}
28

Decompiled Minecraft 26.3 source of ClientboundChangeDifficultyPacket (net/minecraft/network/protocol/game/ClientboundChangeDifficultyPacket.java) with Mojang official mappings, stored verbatim on the site.