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
Modifier and TypeFieldDescriptionprivate final BiConsumer<MSG,
CustomPayloadEvent.Context> The field for theconsumer
record component.private final Function<FriendlyByteBuf,
MSG> The field for thedecoder
record component.private final Optional<NetworkDirection>
The field for thedirection
record component.private final BiConsumer<MSG,
FriendlyByteBuf> The field for theencoder
record component.private final int
The field for theindex
record component.The field for thetype
record component. -
Constructor Summary
ModifierConstructorDescriptionprivate
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 aMessage
record class. -
Method Summary
Modifier and TypeMethodDescriptionconsumer()
Returns the value of theconsumer
record component.decoder()
Returns the value of thedecoder
record component.Returns the value of thedirection
record component.encoder()
Returns the value of theencoder
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.int
index()
Returns the value of theindex
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Field Details
-
index
private final int indexThe field for theindex
record component. -
type
The field for thetype
record component. -
direction
The field for thedirection
record component. -
encoder
The field for theencoder
record component. -
decoder
The field for thedecoder
record component. -
consumer
The field for theconsumer
record 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 aMessage
record class.- Parameters:
index
- the value for theindex
record componenttype
- the value for thetype
record componentdirection
- the value for thedirection
record componentencoder
- the value for theencoder
record componentdecoder
- the value for thedecoder
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
index
public int index()Returns the value of theindex
record component.- Returns:
- the value of the
index
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
direction
Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-
encoder
Returns the value of theencoder
record component.- Returns:
- the value of the
encoder
record component
-
decoder
Returns the value of thedecoder
record component.- Returns:
- the value of the
decoder
record component
-
consumer
Returns the value of theconsumer
record component.- Returns:
- the value of the
consumer
record component
-