Record Class PacketContainer<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>

java.lang.Object
java.lang.Record
commonnetwork.networking.data.PacketContainer<T>

public record PacketContainer<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> codec, Consumer<PacketContext<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>> handler, PacketContainer.PacketType packetType) extends Record
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler, PacketContainer.PacketType packetType)
    Creates an instance of a PacketContainer record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T>
    Returns the value of the codec record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the handler record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the packetType 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

    • PacketContainer

      public PacketContainer(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler, PacketContainer.PacketType packetType)
      Creates an instance of a PacketContainer record class.
      Parameters:
      type - the value for the type record component
      codec - the value for the codec record component
      handler - the value for the handler record component
      packetType - the value for the packetType 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
    • codec

      public net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.FriendlyByteBuf, T> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • handler

      public Consumer<PacketContext<T>> handler()
      Returns the value of the handler record component.
      Returns:
      the value of the handler record component
    • packetType

      public PacketContainer.PacketType packetType()
      Returns the value of the packetType record component.
      Returns:
      the value of the packetType record component