ClientboundSetChunkCacheCenterPacket 0x60

ClientboundSetChunkCacheCenterPacket: Minecraft 26.3 packet (0x60 Play clientbound). Wire name 'set_chunk_cache_center', fields: x, z, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x6096PLAYClientboundGamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_CENTER: "set_chunk_cache_center"

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 (2)

FieldType
xint
zint

Stream codec

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

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

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleSetChunkCacheCenter(ClientboundSetChunkCacheCenterPacket clientboundsetchunkcachecenterpacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSetChunkCacheCenterPacket.java47 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 ClientboundSetChunkCacheCenterPacket implements Packet<ClientGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundSetChunkCacheCenterPacket> STREAM_CODEC = Packet.codec(
10
		ClientboundSetChunkCacheCenterPacket::write, ClientboundSetChunkCacheCenterPacket::new
11
	);
12
	private final int x;
13
	private final int z;
14
15
	public ClientboundSetChunkCacheCenterPacket(final int x, final int z) {
16
		this.x = x;
17
		this.z = z;
18
	}
19
20
	private ClientboundSetChunkCacheCenterPacket(final FriendlyByteBuf input) {
21
		this.x = input.readVarInt();
22
		this.z = input.readVarInt();
23
	}
24
25
	private void write(final FriendlyByteBuf output) {
26
		output.writeVarInt(this.x);
27
		output.writeVarInt(this.z);
28
	}
29
30
	@Override
31
	public PacketType<ClientboundSetChunkCacheCenterPacket> type() {
32
		return GamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_CENTER;
33
	}
34
35
	public void handle(final ClientGamePacketListener listener) {
36
		listener.handleSetChunkCacheCenter(this);
37
	}
38
39
	public int getX() {
40
		return this.x;
41
	}
42
43
	public int getZ() {
44
		return this.z;
45
	}
46
}
47