Package net.minecraftforge.network
Record Class PayloadChannel.Message<MSG extends CustomPacketPayload,BUF extends FriendlyByteBuf>
java.lang.Object
java.lang.Record
net.minecraftforge.network.PayloadChannel.Message<MSG,BUF>
- Enclosing class:
PayloadChannel
private static record PayloadChannel.Message<MSG extends CustomPacketPayload,BUF extends FriendlyByteBuf> (CustomPacketPayload.Type<MSG extends CustomPacketPayload> type, @Nullable NetworkProtocol<BUF extends FriendlyByteBuf> protocol, @Nullable PacketFlow direction, StreamCodec<BUF extends FriendlyByteBuf,MSG extends CustomPacketPayload> codec, BiConsumer<MSG extends CustomPacketPayload,CustomPayloadEvent.Context> consumer)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StreamCodec<BUF, MSG> The field for thecodecrecord component.private final BiConsumer<MSG, CustomPayloadEvent.Context> The field for theconsumerrecord component.private final @Nullable PacketFlowThe field for thedirectionrecord component.private final @Nullable NetworkProtocol<BUF> The field for theprotocolrecord component.private final CustomPacketPayload.Type<MSG> The field for thetyperecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMessage(CustomPacketPayload.Type<MSG> type, @Nullable NetworkProtocol<BUF> protocol, @Nullable PacketFlow direction, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Creates an instance of aMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncodec()Returns the value of thecodecrecord component.consumer()Returns the value of theconsumerrecord component.@Nullable PacketFlowReturns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable NetworkProtocol<BUF> protocol()Returns the value of theprotocolrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Field Details
-
type
The field for thetyperecord component. -
protocol
The field for theprotocolrecord component. -
direction
The field for thedirectionrecord component. -
codec
The field for thecodecrecord component. -
consumer
The field for theconsumerrecord component.
-
-
Constructor Details
-
Message
private Message(CustomPacketPayload.Type<MSG> type, @Nullable @Nullable NetworkProtocol<BUF> protocol, @Nullable @Nullable PacketFlow direction, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Creates an instance of aMessagerecord class.- Parameters:
type- the value for thetyperecord componentprotocol- the value for theprotocolrecord componentdirection- the value for thedirectionrecord componentcodec- the value for thecodecrecord componentconsumer- the value for theconsumerrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
protocol
Returns the value of theprotocolrecord component.- Returns:
- the value of the
protocolrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
consumer
Returns the value of theconsumerrecord component.- Returns:
- the value of the
consumerrecord component
-