ServerboundKeepAlivePacket.java
net.minecraft.network.protocol.common.ServerboundKeepAlivePacket
信息
- 全限定名:net.minecraft.network.protocol.common.ServerboundKeepAlivePacket
- 类型:public class
- 包:net.minecraft.network.protocol.common
- 源码路径:src/main/java/net/minecraft/network/protocol/common/ServerboundKeepAlivePacket.java
- 起始行号:L8
- 实现:Packet
- 职责:
TODO
字段/常量
-
STREAM_CODEC- 类型:
StreamCodec<FriendlyByteBuf,ServerboundKeepAlivePacket> - 修饰符:
public static final - 源码定位:
L9 - 说明:
TODO
- 类型:
-
id- 类型:
long - 修饰符:
private final - 源码定位:
L12 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ServerboundKeepAlivePacket(long id) @ L14
- 构造器名:ServerboundKeepAlivePacket
- 源码定位:L14
- 修饰符:public
参数:
- id: long
说明:
TODO
private ServerboundKeepAlivePacket(FriendlyByteBuf input) @ L18
- 构造器名:ServerboundKeepAlivePacket
- 源码定位:L18
- 修饰符:private
参数:
- input: FriendlyByteBuf
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void write(FriendlyByteBuf output) @ L22
- 方法名:write
- 源码定位:L22
- 返回类型:void
- 修饰符:private
参数:
- output: FriendlyByteBuf
说明:
TODO
public PacketType<ServerboundKeepAlivePacket> type() @ L26
- 方法名:type
- 源码定位:L26
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ServerCommonPacketListener listener) @ L31
- 方法名:handle
- 源码定位:L31
- 返回类型:void
- 修饰符:public
参数:
- listener: ServerCommonPacketListener
说明:
TODO
public long getId() @ L35
- 方法名:getId
- 源码定位:L35
- 返回类型:long
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class ServerboundKeepAlivePacket implements Packet<ServerCommonPacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundKeepAlivePacket> STREAM_CODEC = Packet.codec(
ServerboundKeepAlivePacket::write, ServerboundKeepAlivePacket::new
);
private final long id;
public ServerboundKeepAlivePacket(long id) {
this.id = id;
}
private ServerboundKeepAlivePacket(FriendlyByteBuf input) {
this.id = input.readLong();
}
private void write(FriendlyByteBuf output) {
output.writeLong(this.id);
}
@Override
public PacketType<ServerboundKeepAlivePacket> type() {
return CommonPacketTypes.SERVERBOUND_KEEP_ALIVE;
}
public void handle(ServerCommonPacketListener listener) {
listener.handleKeepAlive(this);
}
public long getId() {
return this.id;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
Packet.codec()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置: