Record Class SimpleDropProvider
java.lang.Object
java.lang.Record
net.darkhax.botanypots.common.impl.data.itemdrops.SimpleDropProvider
- All Implemented Interfaces:
ItemDropProvider
public record SimpleDropProvider(List<SimpleDropProvider.SimpleDrop> drops)
extends Record
implements ItemDropProvider
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SimpleDropProvider> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SimpleDropProvider> static final Supplier<ItemDropProviderType<?>> -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of aSimpleDropProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(BotanyPotContext context, net.minecraft.world.level.Level level, Consumer<net.minecraft.world.item.ItemStack> drops) Performs the outcome of the drop provider.drops()Returns the value of thedropsrecord component.final booleanIndicates whether some other object is "equal to" this one.List<net.minecraft.world.item.ItemStack> Provides a list of items that can be produced by the provider.getType()Gets the type of the provider.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
TYPE
-
CODEC
-
STREAM
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,SimpleDropProvider> STREAM
-
-
Constructor Details
-
SimpleDropProvider
Creates an instance of aSimpleDropProviderrecord class.- Parameters:
drops- the value for thedropsrecord component
-
-
Method Details
-
apply
public void apply(BotanyPotContext context, net.minecraft.world.level.Level level, Consumer<net.minecraft.world.item.ItemStack> drops) Description copied from interface:ItemDropProviderPerforms the outcome of the drop provider.- Specified by:
applyin interfaceItemDropProvider- Parameters:
context- The context of the action.level- The current game level.drops- A consumer that adds produced items to the output.
-
getType
Description copied from interface:ItemDropProviderGets the type of the provider.- Specified by:
getTypein interfaceItemDropProvider- Returns:
- The type of the provider.
-
getDisplayItems
Description copied from interface:ItemDropProviderProvides a list of items that can be produced by the provider. These are used to display potential outcomes in recipe viewers like JEI.- Specified by:
getDisplayItemsin interfaceItemDropProvider- Returns:
- A list of items to display. Can be empty, can not be null.
-
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). -
drops
Returns the value of thedropsrecord component.- Returns:
- the value of the
dropsrecord component
-