记录类 PayloadRegistration<T extends CustomPacketPayload>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.registration.PayloadRegistration<T>
- 类型参数:
T
- The type of the payload- 记录组件:
type
- The type of the payloadcodec
- The codec for the payloadprotocols
- The protocols this payload supportsflow
- The flow this payload supports (empty if both)version
- The version of the payloadoptional
- If the payload is optional
@Internal
public record PayloadRegistration<T extends CustomPacketPayload>(CustomPacketPayload.Type<T extends CustomPacketPayload> type, StreamCodec<? super RegistryFriendlyByteBuf,T extends CustomPacketPayload> codec, List<ConnectionProtocol> protocols, Optional<PacketFlow> flow, String version, boolean optional)
extends Record
Holds the information needed to describe a registered payload.
-
字段概要
字段修饰符和类型字段说明private final StreamCodec
<? super RegistryFriendlyByteBuf, T> codec
记录组件的字段。private final Optional
<PacketFlow> flow
记录组件的字段。private final boolean
optional
记录组件的字段。private final List
<ConnectionProtocol> protocols
记录组件的字段。private final CustomPacketPayload.Type
<T> type
记录组件的字段。private final String
version
记录组件的字段。 -
构造器概要
构造器构造器说明PayloadRegistration
(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, List<ConnectionProtocol> protocols, Optional<PacketFlow> flow, String version, boolean optional) 创建PayloadRegistration
记录类的实例。 -
方法概要
修饰符和类型方法说明StreamCodec
<? super RegistryFriendlyByteBuf, T> codec()
返回codec
记录组件的值。final boolean
指示某个其他对象是否“等于”此对象。flow()
返回flow
记录组件的值。final int
hashCode()
返回此对象的哈希代码值。id()
boolean
matchesFlow
(PacketFlow flow) 返回 true if the registered flow is compatible with the passed flow。boolean
optional()
返回optional
记录组件的值。返回protocols
记录组件的值。final String
toString()
返回此记录类的字符串表示形式。type()
返回type
记录组件的值。version()
返回version
记录组件的值。
-
字段详细资料
-
构造器详细资料
-
PayloadRegistration
public PayloadRegistration(CustomPacketPayload.Type<T> type, StreamCodec<? super RegistryFriendlyByteBuf, T> codec, List<ConnectionProtocol> protocols, Optional<PacketFlow> flow, String version, boolean optional) 创建PayloadRegistration
记录类的实例。
-
-
方法详细资料
-
id
-
matchesFlow
返回 true if the registered flow is compatible with the passed flow。- 返回:
- true if the registered flow is compatible with the passed flow
-
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 使用Objects::equals(Object,Object)
对参考组件进行比较;使用 '==' 对基元组件进行比较 -
type
返回type
记录组件的值。- 返回:
type
记录组件的值
-
codec
返回codec
记录组件的值。- 返回:
codec
记录组件的值
-
protocols
返回protocols
记录组件的值。- 返回:
protocols
记录组件的值
-
flow
返回flow
记录组件的值。- 返回:
flow
记录组件的值
-
version
返回version
记录组件的值。- 返回:
version
记录组件的值
-
optional
public boolean optional()返回optional
记录组件的值。- 返回:
optional
记录组件的值
-