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 Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<ItemDropProvider>
     
    static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,ItemDropProvider>
     
    static final com.mojang.serialization.Codec<List<ItemDropProvider>>
     
    static final com.mojang.serialization.Codec<ItemDropProviderType<?>>
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,? extends ItemDropProviderType<?>>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.serialization.MapCodec<T>
    Returns the value of the codec record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    get(net.minecraft.resources.ResourceLocation id)
     
    getLazy(net.minecraft.resources.ResourceLocation id)
     
    final int
    Returns a hash code value for this object.
    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.
    net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T>
    Returns the value of the stream record component.
    final String
    Returns a string representation of this record class.
    net.minecraft.resources.ResourceLocation
    Returns the value of the typeID record component.

    Methods inherited from class java.lang.Object

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

    • TYPE_CODEC

      public static final com.mojang.serialization.Codec<ItemDropProviderType<?>> TYPE_CODEC
    • TYPE_STREAM

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,? extends ItemDropProviderType<?>> TYPE_STREAM
    • DROP_PROVIDER_CODEC

      public static final com.mojang.serialization.Codec<ItemDropProvider> DROP_PROVIDER_CODEC
    • DROP_PROVIDER_STREAM

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,ItemDropProvider> DROP_PROVIDER_STREAM
    • LIST_CODEC

      public static final com.mojang.serialization.Codec<List<ItemDropProvider>> LIST_CODEC
  • 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

    • getLazy

      public static Supplier<ItemDropProviderType<?>> getLazy(net.minecraft.resources.ResourceLocation id)
    • get

      public static ItemDropProviderType<?> get(net.minecraft.resources.ResourceLocation id)
    • 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