Record Class ItemDropProviderType<T extends ItemDropProvider>

java.lang.Object
java.lang.Record
net.darkhax.botanypots.common.api.data.itemdrops.ItemDropProviderType<T>
Type Parameters:
T - The type of the provider.
Record Components:
typeID - The ID for the type.
codec - A codec that serializes the provider.
stream - A stream codec that serializes the provider.

public record ItemDropProviderType<T extends ItemDropProvider>(net.minecraft.resources.ResourceLocation typeID, com.mojang.serialization.MapCodec<T extends ItemDropProvider> codec, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T extends ItemDropProvider> stream) extends Record
Represents a type of drop provider. Handles serialization.
  • Field Details

  • Constructor Details

    • ItemDropProviderType

      public ItemDropProviderType(net.minecraft.resources.ResourceLocation typeID, com.mojang.serialization.MapCodec<T> codec, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> stream)
      Creates an instance of a ItemDropProviderType record class.
      Parameters:
      typeID - the value for the typeID record component
      codec - the value for the codec record component
      stream - the value for the stream record component
  • Method Details

    • register

      public static <T extends ItemDropProvider> ItemDropProviderType<T> register(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.MapCodec<T> codec, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> stream)
      Creates and registers a drop provider type.
      Type Parameters:
      T - The provider represented by the type.
      Parameters:
      id - The ID for the type.
      codec - The codec for the type.
      stream - The stream codec for the type.
      Returns:
      The newly created and registered type.
    • 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.
    • typeID

      public net.minecraft.resources.ResourceLocation typeID()
      Returns the value of the typeID record component.
      Returns:
      the value of the typeID record component
    • codec

      public com.mojang.serialization.MapCodec<T> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • stream

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