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
FieldsModifier and TypeFieldDescriptionstatic 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
ConstructorsConstructorDescriptionItemDropProviderType(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 aItemDropProviderTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<T> codec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.static ItemDropProviderType<?> get(net.minecraft.resources.ResourceLocation id) static Supplier<ItemDropProviderType<?>> getLazy(net.minecraft.resources.ResourceLocation id) final inthashCode()Returns a hash code value for this object.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.net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> stream()Returns the value of thestreamrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.resources.ResourceLocationtypeID()Returns the value of thetypeIDrecord component.
-
Field Details
-
TYPE_CODEC
-
TYPE_STREAM
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,? extends ItemDropProviderType<?>> TYPE_STREAM -
DROP_PROVIDER_CODEC
-
DROP_PROVIDER_STREAM
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,ItemDropProvider> DROP_PROVIDER_STREAM -
LIST_CODEC
-
-
Constructor Details
-
Method Details
-
getLazy
public static Supplier<ItemDropProviderType<?>> getLazy(net.minecraft.resources.ResourceLocation id) -
get
-
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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
typeID
public net.minecraft.resources.ResourceLocation typeID()Returns the value of thetypeIDrecord component.- Returns:
- the value of the
typeIDrecord component
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
stream
public net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> stream()Returns the value of thestreamrecord component.- Returns:
- the value of the
streamrecord component
-