Record Class EnchantmentLevelProvider
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.EnchantmentLevelProvider
- All Implemented Interfaces:
LootContextUser
,NumberProvider
public record EnchantmentLevelProvider(LevelBasedValue amount)
extends Record
implements NumberProvider
-
Field Summary
Modifier and TypeFieldDescriptionprivate final LevelBasedValue
The field for theamount
record component.static final com.mojang.serialization.MapCodec
<EnchantmentLevelProvider> -
Constructor Summary
ConstructorDescriptionCreates an instance of aEnchantmentLevelProvider
record class. -
Method Summary
Modifier and TypeMethodDescriptionamount()
Returns the value of theamount
record component.final boolean
Indicates whether some other object is "equal to" this one.static EnchantmentLevelProvider
forEnchantmentLevel
(LevelBasedValue p_343548_) float
getFloat
(LootContext p_344453_) getType()
final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams, validate
Methods inherited from interface net.minecraft.world.level.storage.loot.providers.number.NumberProvider
getInt
-
Field Details
-
amount
The field for theamount
record component. -
CODEC
-
-
Constructor Details
-
EnchantmentLevelProvider
Creates an instance of aEnchantmentLevelProvider
record class.- Parameters:
amount
- the value for theamount
record component
-
-
Method Details
-
getFloat
- Specified by:
getFloat
in interfaceNumberProvider
-
getType
- Specified by:
getType
in interfaceNumberProvider
-
forEnchantmentLevel
-
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)
. -
amount
Returns the value of theamount
record component.- Returns:
- the value of the
amount
record component
-