Record Class ModdedConfigurationPayloadRegistration<T extends CustomPacketPayload>

java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.registration.ModdedConfigurationPayloadRegistration<T>
Type Parameters:
T - The type of payload.
Record Components:
id - The id of the payload.
type - The type of payload.
handler - The handler for the payload.
reader - The reader for the payload.

@Internal public record ModdedConfigurationPayloadRegistration<T extends CustomPacketPayload>(ResourceLocation id, Class<T extends CustomPacketPayload> type, IPayloadHandler<T extends CustomPacketPayload> handler, StreamCodec<FriendlyByteBuf,T extends CustomPacketPayload> reader) extends Record
Registration for a custom packet payload. This type holds the negotiated preferredVersion of the payload to use, and the handler for it.
  • Field Details

  • Constructor Details

    • ModdedConfigurationPayloadRegistration

      public ModdedConfigurationPayloadRegistration(ResourceLocation id, Class<T> type, IPayloadHandler<T> handler, StreamCodec<FriendlyByteBuf,T> reader)
      Creates an instance of a ModdedConfigurationPayloadRegistration record class.
      Parameters:
      id - the value for the id record component
      type - the value for the type record component
      handler - the value for the handler record component
      reader - the value for the reader 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.
    • id

      public ResourceLocation id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • type

      public Class<T> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • handler

      public IPayloadHandler<T> handler()
      Returns the value of the handler record component.
      Returns:
      the value of the handler record component
    • reader

      public StreamCodec<FriendlyByteBuf,T> reader()
      Returns the value of the reader record component.
      Returns:
      the value of the reader record component