ClientIntentionPacket .java

net.minecraft.network.protocol.handshake.ClientIntentionPacket (record): members: protocolVersion, hostName, port, intention, MAX_HOST_LENGTH, isTerminal.

net.minecraft.network.protocol.handshakerecord41 linescommon1.3 KB

Implements

API Surface (3)

PacketType<ClientIntentionPacket> type()
void handle(final ServerHandshakePacketListener listener)
boolean isTerminal()

Fields & Constants (2)

STREAM_CODEC
MAX_HOST_LENGTH

Code Graph: Dependencies (6)

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

Full Source

ClientIntentionPacket.java41 lines · Minecraft 26.3 · verbatim
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

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