Record Class EnchantmentLevelProvider
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.EnchantmentLevelProvider
- All Implemented Interfaces:
LootContextUser, NumberProvider, Validatable
public record EnchantmentLevelProvider(LevelBasedValue amount)
extends Record
implements NumberProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LevelBasedValueThe field for theamountrecord component.static final com.mojang.serialization.MapCodec<EnchantmentLevelProvider> -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of aEnchantmentLevelProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionamount()Returns the value of theamountrecord component.com.mojang.serialization.MapCodec<EnchantmentLevelProvider> codec()final booleanIndicates whether some other object is "equal to" this one.static EnchantmentLevelProviderforEnchantmentLevel(LevelBasedValue amount) floatgetFloat(LootContext context) final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from interface LootContextUser
getReferencedContextParams, validateMethods inherited from interface NumberProvider
getInt
-
Field Details
-
amount
The field for theamountrecord component. -
MAP_CODEC
-
-
Constructor Details
-
EnchantmentLevelProvider
Creates an instance of aEnchantmentLevelProviderrecord class.- Parameters:
amount- the value for theamountrecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceNumberProvider
-
getFloat
- Specified by:
getFloatin interfaceNumberProvider
-
forEnchantmentLevel
-
toString
-
hashCode
-
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 theamountrecord component.- Returns:
- the value of the
amountrecord component
-