ClientboundHelloPacket.java
net.minecraft.network.protocol.login.ClientboundHelloPacket
信息
- 全限定名:net.minecraft.network.protocol.login.ClientboundHelloPacket
- 类型:public class
- 包:net.minecraft.network.protocol.login
- 源码路径:src/main/java/net/minecraft/network/protocol/login/ClientboundHelloPacket.java
- 起始行号:L11
- 实现:Packet
- 职责:
TODO
字段/常量
-
STREAM_CODEC- 类型:
StreamCodec<FriendlyByteBuf,ClientboundHelloPacket> - 修饰符:
public static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
serverId- 类型:
String - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
publicKey- 类型:
byte[] - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
challenge- 类型:
byte[] - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
shouldAuthenticate- 类型:
boolean - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ClientboundHelloPacket(String serverId, byte[] publicKey, byte[] challenge, boolean shouldAuthenticate) @ L20
- 构造器名:ClientboundHelloPacket
- 源码定位:L20
- 修饰符:public
参数:
- serverId: String
- publicKey: byte[]
- challenge: byte[]
- shouldAuthenticate: boolean
说明:
TODO
private ClientboundHelloPacket(FriendlyByteBuf input) @ L27
- 构造器名:ClientboundHelloPacket
- 源码定位:L27
- 修饰符:private
参数:
- input: FriendlyByteBuf
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void write(FriendlyByteBuf output) @ L34
- 方法名:write
- 源码定位:L34
- 返回类型:void
- 修饰符:private
参数:
- output: FriendlyByteBuf
说明:
TODO
public PacketType<ClientboundHelloPacket> type() @ L41
- 方法名:type
- 源码定位:L41
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ClientLoginPacketListener listener) @ L46
- 方法名:handle
- 源码定位:L46
- 返回类型:void
- 修饰符:public
参数:
- listener: ClientLoginPacketListener
说明:
TODO
public String getServerId() @ L50
- 方法名:getServerId
- 源码定位:L50
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
public PublicKey getPublicKey() @ L54
- 方法名:getPublicKey
- 源码定位:L54
- 返回类型:PublicKey
- 修饰符:public
参数:
- 无
说明:
TODO
public byte[] getChallenge() @ L58
- 方法名:getChallenge
- 源码定位:L58
- 返回类型:byte[]
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean shouldAuthenticate() @ L62
- 方法名:shouldAuthenticate
- 源码定位:L62
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class ClientboundHelloPacket implements Packet<ClientLoginPacketListener> {
public static final StreamCodec<FriendlyByteBuf, ClientboundHelloPacket> STREAM_CODEC = Packet.codec(
ClientboundHelloPacket::write, ClientboundHelloPacket::new
);
private final String serverId;
private final byte[] publicKey;
private final byte[] challenge;
private final boolean shouldAuthenticate;
public ClientboundHelloPacket(String serverId, byte[] publicKey, byte[] challenge, boolean shouldAuthenticate) {
this.serverId = serverId;
this.publicKey = publicKey;
this.challenge = challenge;
this.shouldAuthenticate = shouldAuthenticate;
}
private ClientboundHelloPacket(FriendlyByteBuf input) {
this.serverId = input.readUtf(20);
this.publicKey = input.readByteArray();
this.challenge = input.readByteArray();
this.shouldAuthenticate = input.readBoolean();
}
private void write(FriendlyByteBuf output) {
output.writeUtf(this.serverId);
output.writeByteArray(this.publicKey);
output.writeByteArray(this.challenge);
output.writeBoolean(this.shouldAuthenticate);
}
@Override
public PacketType<ClientboundHelloPacket> type() {
return LoginPacketTypes.CLIENTBOUND_HELLO;
}
public void handle(ClientLoginPacketListener listener) {
listener.handleHello(this);
}
public String getServerId() {
return this.serverId;
}
public PublicKey getPublicKey() throws CryptException {
return Crypt.byteToPublicKey(this.publicKey);
}
public byte[] getChallenge() {
return this.challenge;
}
public boolean shouldAuthenticate() {
return this.shouldAuthenticate;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
Packet.codec()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Crypt.byteToPublicKey()
- 引用位置: