Package net.minecraftforge.network
Record Class SimpleChannel.Message<MSG>
java.lang.Object
java.lang.Record
net.minecraftforge.network.SimpleChannel.Message<MSG>
- Enclosing class:
- SimpleChannel
private static record SimpleChannel.Message<MSG>(int index, Class<MSG> type, Optional<NetworkDirection> direction, BiConsumer<MSG,FriendlyByteBuf> encoder, Function<FriendlyByteBuf,MSG> decoder, BiConsumer<MSG,CustomPayloadEvent.Context> consumer)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiConsumer<MSG,CustomPayloadEvent.Context> The field for theconsumerrecord component.private final Function<FriendlyByteBuf,MSG> The field for thedecoderrecord component.private final Optional<NetworkDirection>The field for thedirectionrecord component.private final BiConsumer<MSG,FriendlyByteBuf> The field for theencoderrecord component.private final intThe field for theindexrecord component.The field for thetyperecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMessage(int index, Class<MSG> type, Optional<NetworkDirection> direction, BiConsumer<MSG, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, MSG> decoder, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Creates an instance of aMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionconsumer()Returns the value of theconsumerrecord component.decoder()Returns the value of thedecoderrecord component.Returns the value of thedirectionrecord component.encoder()Returns the value of theencoderrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Field Details
-
index
private final int indexThe field for theindexrecord component. -
type
The field for thetyperecord component. -
direction
The field for thedirectionrecord component. -
encoder
The field for theencoderrecord component. -
decoder
The field for thedecoderrecord component. -
consumer
The field for theconsumerrecord component.
-
-
Constructor Details
-
Message
private Message(int index, Class<MSG> type, Optional<NetworkDirection> direction, BiConsumer<MSG, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, MSG> decoder, BiConsumer<MSG, CustomPayloadEvent.Context> consumer) Creates an instance of aMessagerecord class.- Parameters:
index- the value for theindexrecord componenttype- the value for thetyperecord componentdirection- the value for thedirectionrecord componentencoder- the value for theencoderrecord componentdecoder- the value for thedecoderrecord 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
index
public int index()Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
encoder
Returns the value of theencoderrecord component.- Returns:
- the value of the
encoderrecord component
-
decoder
Returns the value of thedecoderrecord component.- Returns:
- the value of the
decoderrecord component
-
consumer
Returns the value of theconsumerrecord component.- Returns:
- the value of the
consumerrecord component
-