ClientIntentionPacket 0x00

ClientIntentionPacket: Minecraft 26.3 packet (0x00 Handshaking serverbound). Wire name 'intention', fields: protocolVersion, hostName, port, intention

Minecraft 26.3HandshakingServerboundnet.minecraft.network.protocol.handshake

Protocol slots (1)

IDdecStateDirectionRegistry
0x000HANDSHAKINGServerboundHandshakePacketTypes.CLIENT_INTENTION: "intention"

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 (4)

FieldType
protocolVersionint
hostNameString
portint
intentionClientIntent

Fields are the components of the packet record.

Stream codec

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

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

Handling

Resolved on the ServerHandshakePacketListener packet-listener interface by void handleIntention(ClientIntentionPacket clientintentionpacket). The implementation in the game is MemoryServerHandshakePacketListenerImpl.

Full Source

ClientIntentionPacket.java41 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.handshake;
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 ClientIntentionPacket(int protocolVersion, String hostName, int port, ClientIntent intention) implements Packet<ServerHandshakePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientIntentionPacket> STREAM_CODEC = Packet.codec(ClientIntentionPacket::write, ClientIntentionPacket::new);
10
	private static final int MAX_HOST_LENGTH = 255;
11
12
	@Deprecated
13
	public ClientIntentionPacket {
14
	}
15
16
	private ClientIntentionPacket(final FriendlyByteBuf input) {
17
		this(input.readVarInt(), input.readUtf(255), input.readUnsignedShort(), ClientIntent.byId(input.readVarInt()));
18
	}
19
20
	private void write(final FriendlyByteBuf output) {
21
		output.writeVarInt(this.protocolVersion);
22
		output.writeUtf(this.hostName);
23
		output.writeShort(this.port);
24
		output.writeVarInt(this.intention.id());
25
	}
26
27
	@Override
28
	public PacketType<ClientIntentionPacket> type() {
29
		return HandshakePacketTypes.CLIENT_INTENTION;
30
	}
31
32
	public void handle(final ServerHandshakePacketListener listener) {
33
		listener.handleIntention(this);
34
	}
35
36
	@Override
37
	public boolean isTerminal() {
38
		return true;
39
	}
40
}
41