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 Details

  • 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 a Message record class.
      Parameters:
      type - the value for the type record component
      protocol - the value for the protocol record component
      direction - the value for the direction record component
      codec - the value for the codec record component
      consumer - the value for the consumer record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public CustomPacketPayload.Type<MSG> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • protocol

      @Nullable public @Nullable NetworkProtocol<BUF> protocol()
      Returns the value of the protocol record component.
      Returns:
      the value of the protocol record component
    • direction

      @Nullable public @Nullable PacketFlow direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • codec

      public StreamCodec<BUF,MSG> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • consumer

      Returns the value of the consumer record component.
      Returns:
      the value of the consumer record component