ServerboundKeepAlivePacket .java

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

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

Implements

API Surface (3)

PacketType<ServerboundKeepAlivePacket> type()
void handle(final ServerCommonPacketListener listener)
long 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

ServerboundKeepAlivePacket.java39 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 ServerboundKeepAlivePacket implements Packet<ServerCommonPacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ServerboundKeepAlivePacket> STREAM_CODEC = Packet.codec(
10
		ServerboundKeepAlivePacket::write, ServerboundKeepAlivePacket::new
11
	);
12
	private final long id;
13
14
	public ServerboundKeepAlivePacket(final long id) {
15
		this.id = id;
16
	}
17
18
	private ServerboundKeepAlivePacket(final FriendlyByteBuf input) {
19
		this.id = input.readLong();
20
	}
21
22
	private void write(final FriendlyByteBuf output) {
23
		output.writeLong(this.id);
24
	}
25
26
	@Override
27
	public PacketType<ServerboundKeepAlivePacket> type() {
28
		return CommonPacketTypes.SERVERBOUND_KEEP_ALIVE;
29
	}
30
31
	public void handle(final ServerCommonPacketListener listener) {
32
		listener.handleKeepAlive(this);
33
	}
34
35
	public long getId() {
36
		return this.id;
37
	}
38
}
39

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