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
Modifier and TypeFieldDescriptionprivate final StreamCodec
<BUF, MSG> The field for thecodec
record component.private final BiConsumer
<MSG, CustomPayloadEvent.Context> The field for theconsumer
record component.private final @Nullable PacketFlow
The field for thedirection
record component.private final @Nullable NetworkProtocol
<BUF> The field for theprotocol
record component.private final CustomPacketPayload.Type
<MSG> The field for thetype
record component. -
Constructor Summary
ModifierConstructorDescriptionprivate
Message
(CustomPacketPayload.Type<MSG> type, @Nullable NetworkProtocol<BUF> protocol, @Nullable PacketFlow direction, StreamCodec<BUF, MSG> codec, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Creates an instance of aMessage
record class. -
Method Summary
Modifier and TypeMethodDescriptioncodec()
Returns the value of thecodec
record component.consumer()
Returns the value of theconsumer
record component.@Nullable PacketFlow
Returns the value of thedirection
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@Nullable NetworkProtocol
<BUF> protocol()
Returns the value of theprotocol
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Field Details
-
type
The field for thetype
record component. -
protocol
The field for theprotocol
record component. -
direction
The field for thedirection
record component. -
codec
The field for thecodec
record component. -
consumer
The field for theconsumer
record 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 aMessage
record class.- Parameters:
type
- the value for thetype
record componentprotocol
- the value for theprotocol
record componentdirection
- the value for thedirection
record componentcodec
- the value for thecodec
record componentconsumer
- the value for theconsumer
record 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 thetype
record component.- Returns:
- the value of the
type
record component
-
protocol
Returns the value of theprotocol
record component.- Returns:
- the value of the
protocol
record component
-
direction
Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-
codec
Returns the value of thecodec
record component.- Returns:
- the value of the
codec
record component
-
consumer
Returns the value of theconsumer
record component.- Returns:
- the value of the
consumer
record component
-