ServerboundPlayerCommandPacket.java
net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket
信息
- 全限定名:net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket
- 类型:public class
- 包:net.minecraft.network.protocol.game
- 源码路径:src/main/java/net/minecraft/network/protocol/game/ServerboundPlayerCommandPacket.java
- 起始行号:L9
- 实现:Packet
- 职责:
TODO
字段/常量
-
STREAM_CODEC- 类型:
StreamCodec<FriendlyByteBuf,ServerboundPlayerCommandPacket> - 修饰符:
public static final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
id- 类型:
int - 修饰符:
private final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
action- 类型:
ServerboundPlayerCommandPacket.Action - 修饰符:
private final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
data- 类型:
int - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket.Action- 类型:
enum - 修饰符:
public static - 源码定位:
L60 - 说明:
TODO
- 类型:
构造器
public ServerboundPlayerCommandPacket(Entity entity, ServerboundPlayerCommandPacket.Action action) @ L17
- 构造器名:ServerboundPlayerCommandPacket
- 源码定位:L17
- 修饰符:public
参数:
- entity: Entity
- action: ServerboundPlayerCommandPacket.Action
说明:
TODO
public ServerboundPlayerCommandPacket(Entity entity, ServerboundPlayerCommandPacket.Action action, int data) @ L21
- 构造器名:ServerboundPlayerCommandPacket
- 源码定位:L21
- 修饰符:public
参数:
- entity: Entity
- action: ServerboundPlayerCommandPacket.Action
- data: int
说明:
TODO
private ServerboundPlayerCommandPacket(FriendlyByteBuf input) @ L27
- 构造器名:ServerboundPlayerCommandPacket
- 源码定位:L27
- 修饰符:private
参数:
- input: FriendlyByteBuf
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void write(FriendlyByteBuf output) @ L33
- 方法名:write
- 源码定位:L33
- 返回类型:void
- 修饰符:private
参数:
- output: FriendlyByteBuf
说明:
TODO
public PacketType<ServerboundPlayerCommandPacket> type() @ L39
- 方法名:type
- 源码定位:L39
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ServerGamePacketListener listener) @ L44
- 方法名:handle
- 源码定位:L44
- 返回类型:void
- 修饰符:public
参数:
- listener: ServerGamePacketListener
说明:
TODO
public int getId() @ L48
- 方法名:getId
- 源码定位:L48
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public ServerboundPlayerCommandPacket.Action getAction() @ L52
- 方法名:getAction
- 源码定位:L52
- 返回类型:ServerboundPlayerCommandPacket.Action
- 修饰符:public
参数:
- 无
说明:
TODO
public int getData() @ L56
- 方法名:getData
- 源码定位:L56
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class ServerboundPlayerCommandPacket implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundPlayerCommandPacket> STREAM_CODEC = Packet.codec(
ServerboundPlayerCommandPacket::write, ServerboundPlayerCommandPacket::new
);
private final int id;
private final ServerboundPlayerCommandPacket.Action action;
private final int data;
public ServerboundPlayerCommandPacket(Entity entity, ServerboundPlayerCommandPacket.Action action) {
this(entity, action, 0);
}
public ServerboundPlayerCommandPacket(Entity entity, ServerboundPlayerCommandPacket.Action action, int data) {
this.id = entity.getId();
this.action = action;
this.data = data;
}
private ServerboundPlayerCommandPacket(FriendlyByteBuf input) {
this.id = input.readVarInt();
this.action = input.readEnum(ServerboundPlayerCommandPacket.Action.class);
this.data = input.readVarInt();
}
private void write(FriendlyByteBuf output) {
output.writeVarInt(this.id);
output.writeEnum(this.action);
output.writeVarInt(this.data);
}
@Override
public PacketType<ServerboundPlayerCommandPacket> type() {
return GamePacketTypes.SERVERBOUND_PLAYER_COMMAND;
}
public void handle(ServerGamePacketListener listener) {
listener.handlePlayerCommand(this);
}
public int getId() {
return this.id;
}
public ServerboundPlayerCommandPacket.Action getAction() {
return this.action;
}
public int getData() {
return this.data;
}
public static enum Action {
STOP_SLEEPING,
START_SPRINTING,
STOP_SPRINTING,
START_RIDING_JUMP,
STOP_RIDING_JUMP,
OPEN_INVENTORY,
START_FALL_FLYING;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
Packet.codec()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: