ServerboundHelloPacket 0x00

ServerboundHelloPacket: Minecraft 26.3 packet (0x00 Login serverbound). Wire name 'hello', fields: name, profileId, handled

Minecraft 26.3LoginServerboundnet.minecraft.network.protocol.login

Protocol slots (1)

IDdecStateDirectionRegistry
0x000LOGINServerboundLoginPacketTypes.SERVERBOUND_HELLO: "hello"

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
nameString
profileIdUUID

Fields are the components of the packet record.

Stream codec

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

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

Handling

Resolved on the ServerLoginPacketListener packet-listener interface by void handleHello(ServerboundHelloPacket serverboundhellopacket). The implementation in the game is ServerLoginPacketListenerImpl.

Full Source

ServerboundHelloPacket.java32 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.login;
2
3
import java.util.UUID;
4
import net.minecraft.network.FriendlyByteBuf;
5
import net.minecraft.network.codec.StreamCodec;
6
import net.minecraft.network.protocol.Packet;
7
import net.minecraft.network.protocol.PacketType;
8
9
public record ServerboundHelloPacket(String name, UUID profileId) implements Packet<ServerLoginPacketListener> {
10
	public static final StreamCodec<FriendlyByteBuf, ServerboundHelloPacket> STREAM_CODEC = Packet.codec(
11
		ServerboundHelloPacket::write, ServerboundHelloPacket::new
12
	);
13
14
	private ServerboundHelloPacket(final FriendlyByteBuf input) {
15
		this(input.readUtf(16), input.readUUID());
16
	}
17
18
	private void write(final FriendlyByteBuf output) {
19
		output.writeUtf(this.name, 16);
20
		output.writeUUID(this.profileId);
21
	}
22
23
	@Override
24
	public PacketType<ServerboundHelloPacket> type() {
25
		return LoginPacketTypes.SERVERBOUND_HELLO;
26
	}
27
28
	public void handle(final ServerLoginPacketListener listener) {
29
		listener.handleHello(this);
30
	}
31
}
32