Package net.minecraftforge.network
Record Class SimpleChannel.Message<MSG,BUF extends FriendlyByteBuf>
java.lang.Object
java.lang.Record
net.minecraftforge.network.SimpleChannel.Message<MSG,BUF>
- Enclosing class:
SimpleChannel
protected static record SimpleChannel.Message<MSG,BUF extends FriendlyByteBuf> (int index, Class<MSG> type, NetworkProtocol<BUF extends FriendlyByteBuf> protocol, PacketFlow direction, BiConsumer<MSG,BUF extends FriendlyByteBuf> encoder, Function<BUF extends 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.The field for thedecoder
record component.private final PacketFlow
The field for thedirection
record component.private final BiConsumer
<MSG, BUF> The field for theencoder
record component.private final int
The field for theindex
record component.private final NetworkProtocol
<BUF> The field for theprotocol
record component.The field for thetype
record component. -
Constructor Summary
ModifierConstructorDescriptionprotected
Message
(int index, Class<MSG> type, NetworkProtocol<BUF> protocol, PacketFlow direction, BiConsumer<MSG, BUF> encoder, Function<BUF, 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.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
-
index
private final int indexThe field for theindex
record component. -
type
The field for thetype
record component. -
protocol
The field for theprotocol
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
protected Message(int index, Class<MSG> type, NetworkProtocol<BUF> protocol, PacketFlow direction, BiConsumer<MSG, BUF> encoder, Function<BUF, 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 componentprotocol
- the value for theprotocol
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
-
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
-
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
-