ClientboundPongResponsePacket 0x3F

ClientboundPongResponsePacket: Minecraft 26.3 packet (0x3F Play clientbound, 0x01 Status clientbound).

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.ping

Protocol slots (2)

IDdecStateDirectionRegistry
0x3F63PLAYClientboundPingPacketTypes.CLIENTBOUND_PONG_RESPONSE: "pong_response"
0x011STATUSClientboundPingPacketTypes.CLIENTBOUND_PONG_RESPONSE: "pong_response"

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
timelong

Fields are the components of the packet record.

Stream codec

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

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

Handling

Resolved on the ClientPongPacketListener packet-listener interface by void handlePongResponse(ClientboundPongResponsePacket clientboundpongresponsepacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundPongResponsePacket.java30 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.ping;
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 record ClientboundPongResponsePacket(long time) implements Packet<ClientPongPacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundPongResponsePacket> STREAM_CODEC = Packet.codec(
10
		ClientboundPongResponsePacket::write, ClientboundPongResponsePacket::new
11
	);
12
13
	private ClientboundPongResponsePacket(final FriendlyByteBuf input) {
14
		this(input.readLong());
15
	}
16
17
	private void write(final FriendlyByteBuf output) {
18
		output.writeLong(this.time);
19
	}
20
21
	@Override
22
	public PacketType<ClientboundPongResponsePacket> type() {
23
		return PingPacketTypes.CLIENTBOUND_PONG_RESPONSE;
24
	}
25
26
	public void handle(final ClientPongPacketListener listener) {
27
		listener.handlePongResponse(this);
28
	}
29
}
30