ServerboundCustomClickActionPacket.java

net.minecraft.network.protocol.common.ServerboundCustomClickActionPacket

信息

  • 全限定名:net.minecraft.network.protocol.common.ServerboundCustomClickActionPacket
  • 类型:public record
  • 包:net.minecraft.network.protocol.common
  • 源码路径:src/main/java/net/minecraft/network/protocol/common/ServerboundCustomClickActionPacket.java
  • 起始行号:L13
  • 实现:Packet
  • 职责:

    TODO

字段/常量

  • UNTRUSTED_TAG_CODEC

    • 类型: StreamCodec<ByteBuf,Optional<Tag>>
    • 修饰符: private static final
    • 源码定位: L14
    • 说明:

      TODO

  • STREAM_CODEC

    • 类型: StreamCodec<ByteBuf,ServerboundCustomClickActionPacket>
    • 修饰符: public static final
    • 源码定位: L16
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public PacketType<ServerboundCustomClickActionPacket> type() @ L24

  • 方法名:type
  • 源码定位:L24
  • 返回类型:PacketType
  • 修饰符:public

参数:

说明:

TODO

public void handle(ServerCommonPacketListener listener) @ L29

  • 方法名:handle
  • 源码定位:L29
  • 返回类型:void
  • 修饰符:public

参数:

  • listener: ServerCommonPacketListener

说明:

TODO

代码

public record ServerboundCustomClickActionPacket(Identifier id, Optional<Tag> payload) implements Packet<ServerCommonPacketListener> {
    private static final StreamCodec<ByteBuf, Optional<Tag>> UNTRUSTED_TAG_CODEC = ByteBufCodecs.optionalTagCodec(() -> new NbtAccounter(32768L, 16))
        .apply(ByteBufCodecs.lengthPrefixed(65536));
    public static final StreamCodec<ByteBuf, ServerboundCustomClickActionPacket> STREAM_CODEC = StreamCodec.composite(
        Identifier.STREAM_CODEC,
        ServerboundCustomClickActionPacket::id,
        UNTRUSTED_TAG_CODEC,
        ServerboundCustomClickActionPacket::payload,
        ServerboundCustomClickActionPacket::new
    );
 
    @Override
    public PacketType<ServerboundCustomClickActionPacket> type() {
        return CommonPacketTypes.SERVERBOUND_CUSTOM_CLICK_ACTION;
    }
 
    public void handle(ServerCommonPacketListener listener) {
        listener.handleCustomClickAction(this);
    }
}

引用的其他类

  • NbtAccounter

    • 引用位置: 构造调用
    • 关联成员: NbtAccounter()
  • Tag

    • 引用位置: 字段
  • ByteBufCodecs

    • 引用位置: 方法调用
    • 关联成员: ByteBufCodecs.lengthPrefixed(), ByteBufCodecs.optionalTagCodec()
  • StreamCodec

    • 引用位置: 字段/方法调用
    • 关联成员: StreamCodec.composite()
  • Packet

    • 引用位置: 实现
  • PacketType

    • 引用位置: 返回值
  • ServerCommonPacketListener

    • 引用位置: 参数