ServerboundSwingPacket.java
net.minecraft.network.protocol.game.ServerboundSwingPacket
信息
- 全限定名:net.minecraft.network.protocol.game.ServerboundSwingPacket
- 类型:public class
- 包:net.minecraft.network.protocol.game
- 源码路径:src/main/java/net/minecraft/network/protocol/game/ServerboundSwingPacket.java
- 起始行号:L9
- 实现:Packet
- 职责:
TODO
字段/常量
-
STREAM_CODEC- 类型:
StreamCodec<FriendlyByteBuf,ServerboundSwingPacket> - 修饰符:
public static final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
hand- 类型:
InteractionHand - 修饰符:
private final - 源码定位:
L13 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ServerboundSwingPacket(InteractionHand hand) @ L15
- 构造器名:ServerboundSwingPacket
- 源码定位:L15
- 修饰符:public
参数:
- hand: InteractionHand
说明:
TODO
private ServerboundSwingPacket(FriendlyByteBuf input) @ L19
- 构造器名:ServerboundSwingPacket
- 源码定位:L19
- 修饰符:private
参数:
- input: FriendlyByteBuf
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void write(FriendlyByteBuf output) @ L23
- 方法名:write
- 源码定位:L23
- 返回类型:void
- 修饰符:private
参数:
- output: FriendlyByteBuf
说明:
TODO
public PacketType<ServerboundSwingPacket> type() @ L27
- 方法名:type
- 源码定位:L27
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ServerGamePacketListener listener) @ L32
- 方法名:handle
- 源码定位:L32
- 返回类型:void
- 修饰符:public
参数:
- listener: ServerGamePacketListener
说明:
TODO
public InteractionHand getHand() @ L36
- 方法名:getHand
- 源码定位:L36
- 返回类型:InteractionHand
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class ServerboundSwingPacket implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundSwingPacket> STREAM_CODEC = Packet.codec(
ServerboundSwingPacket::write, ServerboundSwingPacket::new
);
private final InteractionHand hand;
public ServerboundSwingPacket(InteractionHand hand) {
this.hand = hand;
}
private ServerboundSwingPacket(FriendlyByteBuf input) {
this.hand = input.readEnum(InteractionHand.class);
}
private void write(FriendlyByteBuf output) {
output.writeEnum(this.hand);
}
@Override
public PacketType<ServerboundSwingPacket> type() {
return GamePacketTypes.SERVERBOUND_SWING;
}
public void handle(ServerGamePacketListener listener) {
listener.handleAnimate(this);
}
public InteractionHand getHand() {
return this.hand;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
Packet.codec()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置: