ServerboundPingRequestPacket .java

net.minecraft.network.protocol.ping.ServerboundPingRequestPacket (class, 39 lines): members: getTime, time, handle, STREAM_CODEC, type. imports: ByteBuf.

net.minecraft.network.protocol.pingclass39 linescommon1.0 KB

Implements

API Surface (3)

PacketType<ServerboundPingRequestPacket> type()
void handle(final ServerPingPacketListener listener)
long getTime()

Fields & Constants (2)

STREAM_CODEC
time

Code Graph: Dependencies (4)

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

Full Source

ServerboundPingRequestPacket.java39 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.ping;
2
3
import io.netty.buffer.ByteBuf;
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 ServerboundPingRequestPacket implements Packet<ServerPingPacketListener> {
9
	public static final StreamCodec<ByteBuf, ServerboundPingRequestPacket> STREAM_CODEC = Packet.codec(
10
		ServerboundPingRequestPacket::write, ServerboundPingRequestPacket::new
11
	);
12
	private final long time;
13
14
	public ServerboundPingRequestPacket(final long time) {
15
		this.time = time;
16
	}
17
18
	private ServerboundPingRequestPacket(final ByteBuf input) {
19
		this.time = input.readLong();
20
	}
21
22
	private void write(final ByteBuf output) {
23
		output.writeLong(this.time);
24
	}
25
26
	@Override
27
	public PacketType<ServerboundPingRequestPacket> type() {
28
		return PingPacketTypes.SERVERBOUND_PING_REQUEST;
29
	}
30
31
	public void handle(final ServerPingPacketListener listener) {
32
		listener.handlePingRequest(this);
33
	}
34
35
	public long getTime() {
36
		return this.time;
37
	}
38
}
39

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