Record Class DataComponentNumberProvider
java.lang.Object
java.lang.Record
com.petrolpark.core.data.loot.numberprovider.DataComponentNumberProvider
- All Implemented Interfaces:
ItemStackNumberProvider,TeamNumberProvider,net.minecraft.world.level.storage.loot.LootContextUser
public record DataComponentNumberProvider(net.minecraft.core.component.DataComponentType<?> componentType)
extends Record
implements ItemStackNumberProvider, TeamNumberProvider
petrolpark:component
Data Component of an Item Stack or ITeam.
Arguments:
-
component- The ID of aDataComponentTypewhich is an Integer, Float, Long or Double
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<DataComponentNumberProvider> Fields inherited from interface com.petrolpark.core.data.loot.numberprovider.itemstack.ItemStackNumberProvider
TYPED_CODECFields inherited from interface com.petrolpark.core.data.loot.numberprovider.team.TeamNumberProvider
TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionDataComponentNumberProvider(net.minecraft.core.component.DataComponentType<?> componentType) Creates an instance of aDataComponentNumberProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.component.DataComponentType<?> Returns the value of thecomponentTyperecord component.final booleanIndicates whether some other object is "equal to" this one.Get the approximate bounds for theoutputof thisItemStackNumberProvideron a best-effort basis.floatfloatgetFloat(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.storage.loot.LootContext lootContext) final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.static final com.mojang.serialization.DataResult<net.minecraft.core.component.DataComponentType<?>> validate(net.minecraft.core.component.DataComponentType<?> componentType) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.petrolpark.core.data.loot.numberprovider.itemstack.ItemStackNumberProvider
getMaxFloatMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams, validateMethods inherited from interface com.petrolpark.core.data.loot.numberprovider.team.TeamNumberProvider
getMaxFloat
-
Field Details
-
CODEC
-
-
Constructor Details
-
DataComponentNumberProvider
public DataComponentNumberProvider(net.minecraft.core.component.DataComponentType<?> componentType) Creates an instance of aDataComponentNumberProviderrecord class.- Parameters:
componentType- the value for thecomponentTyperecord component
-
-
Method Details
-
validate
public static final com.mojang.serialization.DataResult<net.minecraft.core.component.DataComponentType<?>> validate(net.minecraft.core.component.DataComponentType<?> componentType) -
getFloat
public float getFloat(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.storage.loot.LootContext lootContext) - Specified by:
getFloatin interfaceItemStackNumberProvider
-
getFloat
- Specified by:
getFloatin interfaceTeamNumberProvider
-
getEstimate
Description copied from interface:ItemStackNumberProviderGet the approximate bounds for theoutputof thisItemStackNumberProvideron a best-effort basis.- Specified by:
getEstimatein interfaceItemStackNumberProvider- Specified by:
getEstimatein interfaceTeamNumberProvider- See Also:
-
getItemStackNumberProviderType
- Specified by:
getItemStackNumberProviderTypein interfaceItemStackNumberProvider
-
getTeamNumberProviderType
- Specified by:
getTeamNumberProviderTypein interfaceTeamNumberProvider
-
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). -
componentType
public net.minecraft.core.component.DataComponentType<?> componentType()Returns the value of thecomponentTyperecord component.- Returns:
- the value of the
componentTyperecord component
-