ServerboundCommandSuggestionPacket.java
net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket
信息
- 全限定名:net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket
- 类型:public class
- 包:net.minecraft.network.protocol.game
- 源码路径:src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java
- 起始行号:L8
- 实现:Packet
- 职责:
TODO
字段/常量
-
STREAM_CODEC- 类型:
StreamCodec<FriendlyByteBuf,ServerboundCommandSuggestionPacket> - 修饰符:
public static final - 源码定位:
L9 - 说明:
TODO
- 类型:
-
id- 类型:
int - 修饰符:
private final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
command- 类型:
String - 修饰符:
private final - 源码定位:
L13 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ServerboundCommandSuggestionPacket(int id, String command) @ L15
- 构造器名:ServerboundCommandSuggestionPacket
- 源码定位:L15
- 修饰符:public
参数:
- id: int
- command: String
说明:
TODO
private ServerboundCommandSuggestionPacket(FriendlyByteBuf input) @ L20
- 构造器名:ServerboundCommandSuggestionPacket
- 源码定位:L20
- 修饰符:private
参数:
- input: FriendlyByteBuf
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void write(FriendlyByteBuf output) @ L25
- 方法名:write
- 源码定位:L25
- 返回类型:void
- 修饰符:private
参数:
- output: FriendlyByteBuf
说明:
TODO
public PacketType<ServerboundCommandSuggestionPacket> type() @ L30
- 方法名:type
- 源码定位:L30
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ServerGamePacketListener listener) @ L35
- 方法名:handle
- 源码定位:L35
- 返回类型:void
- 修饰符:public
参数:
- listener: ServerGamePacketListener
说明:
TODO
public int getId() @ L39
- 方法名:getId
- 源码定位:L39
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public String getCommand() @ L43
- 方法名:getCommand
- 源码定位:L43
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class ServerboundCommandSuggestionPacket implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundCommandSuggestionPacket> STREAM_CODEC = Packet.codec(
ServerboundCommandSuggestionPacket::write, ServerboundCommandSuggestionPacket::new
);
private final int id;
private final String command;
public ServerboundCommandSuggestionPacket(int id, String command) {
this.id = id;
this.command = command;
}
private ServerboundCommandSuggestionPacket(FriendlyByteBuf input) {
this.id = input.readVarInt();
this.command = input.readUtf(32500);
}
private void write(FriendlyByteBuf output) {
output.writeVarInt(this.id);
output.writeUtf(this.command, 32500);
}
@Override
public PacketType<ServerboundCommandSuggestionPacket> type() {
return GamePacketTypes.SERVERBOUND_COMMAND_SUGGESTION;
}
public void handle(ServerGamePacketListener listener) {
listener.handleCustomCommandSuggestions(this);
}
public int getId() {
return this.id;
}
public String getCommand() {
return this.command;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
Packet.codec()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置: