ClientboundPingPacket .java

net.minecraft.network.protocol.common.ClientboundPingPacket (class, 37 lines): members: getId, handle, STREAM_CODEC, type. imports: FriendlyByteBuf.

net.minecraft.network.protocol.commonclass37 linescommon1005 B

Implements

API Surface (3)

PacketType<ClientboundPingPacket> type()
void handle(final ClientCommonPacketListener listener)
int getId()

Fields & Constants (2)

STREAM_CODEC
id

Code Graph: Dependencies (5)

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

Full Source

ClientboundPingPacket.java37 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.common;
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 ClientboundPingPacket implements Packet<ClientCommonPacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundPingPacket> STREAM_CODEC = Packet.codec(ClientboundPingPacket::write, ClientboundPingPacket::new);
10
	private final int id;
11
12
	public ClientboundPingPacket(final int id) {
13
		this.id = id;
14
	}
15
16
	private ClientboundPingPacket(final FriendlyByteBuf input) {
17
		this.id = input.readInt();
18
	}
19
20
	private void write(final FriendlyByteBuf output) {
21
		output.writeInt(this.id);
22
	}
23
24
	@Override
25
	public PacketType<ClientboundPingPacket> type() {
26
		return CommonPacketTypes.CLIENTBOUND_PING;
27
	}
28
29
	public void handle(final ClientCommonPacketListener listener) {
30
		listener.handlePing(this);
31
	}
32
33
	public int getId() {
34
		return this.id;
35
	}
36
}
37

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