ClientIntentionPacket.java
net.minecraft.network.protocol.handshake.ClientIntentionPacket
信息
- 全限定名:net.minecraft.network.protocol.handshake.ClientIntentionPacket
- 类型:public record
- 包:net.minecraft.network.protocol.handshake
- 源码路径:src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java
- 起始行号:L8
- 实现:Packet
- 职责:
TODO
字段/常量
-
STREAM_CODEC- 类型:
StreamCodec<FriendlyByteBuf,ClientIntentionPacket> - 修饰符:
public static final - 源码定位:
L9 - 说明:
TODO
- 类型:
-
MAX_HOST_LENGTH- 类型:
int - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ClientIntentionPacket(int protocolVersion, String hostName, int port, ClientIntent intention) @ L14
- 构造器名:ClientIntentionPacket
- 源码定位:L14
- 修饰符:public
参数:
- protocolVersion: int
- hostName: String
- port: int
- intention: ClientIntent
说明:
TODO
private ClientIntentionPacket(FriendlyByteBuf input) @ L22
- 构造器名:ClientIntentionPacket
- 源码定位:L22
- 修饰符:private
参数:
- input: FriendlyByteBuf
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void write(FriendlyByteBuf output) @ L26
- 方法名:write
- 源码定位:L26
- 返回类型:void
- 修饰符:private
参数:
- output: FriendlyByteBuf
说明:
TODO
public PacketType<ClientIntentionPacket> type() @ L33
- 方法名:type
- 源码定位:L33
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ServerHandshakePacketListener listener) @ L38
- 方法名:handle
- 源码定位:L38
- 返回类型:void
- 修饰符:public
参数:
- listener: ServerHandshakePacketListener
说明:
TODO
public boolean isTerminal() @ L42
- 方法名:isTerminal
- 源码定位:L42
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public record ClientIntentionPacket(int protocolVersion, String hostName, int port, ClientIntent intention) implements Packet<ServerHandshakePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ClientIntentionPacket> STREAM_CODEC = Packet.codec(
ClientIntentionPacket::write, ClientIntentionPacket::new
);
private static final int MAX_HOST_LENGTH = 255;
@Deprecated
public ClientIntentionPacket(int protocolVersion, String hostName, int port, ClientIntent intention) {
this.protocolVersion = protocolVersion;
this.hostName = hostName;
this.port = port;
this.intention = intention;
}
private ClientIntentionPacket(FriendlyByteBuf input) {
this(input.readVarInt(), input.readUtf(255), input.readUnsignedShort(), ClientIntent.byId(input.readVarInt()));
}
private void write(FriendlyByteBuf output) {
output.writeVarInt(this.protocolVersion);
output.writeUtf(this.hostName);
output.writeShort(this.port);
output.writeVarInt(this.intention.id());
}
@Override
public PacketType<ClientIntentionPacket> type() {
return HandshakePacketTypes.CLIENT_INTENTION;
}
public void handle(ServerHandshakePacketListener listener) {
listener.handleIntention(this);
}
@Override
public boolean isTerminal() {
return true;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
Packet.codec()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数/方法调用 - 关联成员:
ClientIntent.byId()
- 引用位置:
-
- 引用位置:
参数
- 引用位置: