ClientboundSetChunkCacheRadiusPacket 0x61

ClientboundSetChunkCacheRadiusPacket: Minecraft 26.3 packet (0x61 Play clientbound). Wire name 'set_chunk_cache_radius', fields: radius, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x6197PLAYClientboundGamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_RADIUS: "set_chunk_cache_radius"

Packet ids are positional: the id is the index of the addPacket call in the protocol builder (see ProtocolInfoBuilder.listPackets). Ids change between game versions.

Wire fields (1)

FieldType
radiusint

Stream codec

static final StreamCodec<FriendlyByteBuf, ClientboundSetChunkCacheRadiusPacket> STREAM_CODEC = Packet.codec( ClientboundSetChunkCacheRadiusPacket::write, ClientboundSetChunkCacheRadiusPacket::new );

Modern packets serialize through StreamCodecs instead of read/write methods.

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleSetChunkCacheRadius(ClientboundSetChunkCacheRadiusPacket clientboundsetchunkcacheradiuspacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSetChunkCacheRadiusPacket.java39 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.FriendlyByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
8
public class ClientboundSetChunkCacheRadiusPacket implements Packet<ClientGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundSetChunkCacheRadiusPacket> STREAM_CODEC = Packet.codec(
10
		ClientboundSetChunkCacheRadiusPacket::write, ClientboundSetChunkCacheRadiusPacket::new
11
	);
12
	private final int radius;
13
14
	public ClientboundSetChunkCacheRadiusPacket(final int radius) {
15
		this.radius = radius;
16
	}
17
18
	private ClientboundSetChunkCacheRadiusPacket(final FriendlyByteBuf input) {
19
		this.radius = input.readVarInt();
20
	}
21
22
	private void write(final FriendlyByteBuf output) {
23
		output.writeVarInt(this.radius);
24
	}
25
26
	@Override
27
	public PacketType<ClientboundSetChunkCacheRadiusPacket> type() {
28
		return GamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_RADIUS;
29
	}
30
31
	public void handle(final ClientGamePacketListener listener) {
32
		listener.handleSetChunkCacheRadius(this);
33
	}
34
35
	public int getRadius() {
36
		return this.radius;
37
	}
38
}
39