Record Class AbstractPacket.Definition<T extends AbstractPacket<T>>

java.lang.Object
java.lang.Record
de.luckymcdev.foundryengine.common.network.AbstractPacket.Definition<T>
Enclosing interface:
AbstractPacket<T extends AbstractPacket<T>>

public static record AbstractPacket.Definition<T extends AbstractPacket<T>>(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T extends AbstractPacket<T>> type, PacketBounds bounds, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T extends AbstractPacket<T>> codec, @Nullable BiConsumer<T extends AbstractPacket<T>, net.neoforged.neoforge.network.handling.IPayloadContext> clientHandler, @Nullable BiConsumer<T extends AbstractPacket<T>, net.neoforged.neoforge.network.handling.IPayloadContext> serverHandler) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    Definition(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, PacketBounds bounds, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec, @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext> clientHandler, @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext> serverHandler)
    Creates an instance of a Definition record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the bounds record component.
    @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext>
    Returns the value of the clientHandler record component.
    net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T>
    Returns the value of the codec record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext>
    Returns the value of the serverHandler record component.
    final String
    Returns a string representation of this record class.
    net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T>
    Returns the value of the type record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Definition

      public Definition(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, PacketBounds bounds, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec, @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext> clientHandler, @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext> serverHandler)
      Creates an instance of a Definition record class.
      Parameters:
      type - the value for the type record component
      bounds - the value for the bounds record component
      codec - the value for the codec record component
      clientHandler - the value for the clientHandler record component
      serverHandler - the value for the serverHandler 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 net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • bounds

      public PacketBounds bounds()
      Returns the value of the bounds record component.
      Returns:
      the value of the bounds record component
    • codec

      public net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • clientHandler

      public @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext> clientHandler()
      Returns the value of the clientHandler record component.
      Returns:
      the value of the clientHandler record component
    • serverHandler

      public @Nullable BiConsumer<T, net.neoforged.neoforge.network.handling.IPayloadContext> serverHandler()
      Returns the value of the serverHandler record component.
      Returns:
      the value of the serverHandler record component