Record Class ConstantValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.ConstantValue
- All Implemented Interfaces:
LootContextUser,NumberProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ConstantValue> static final com.mojang.serialization.Codec<ConstantValue> private final floatThe field for thevaluerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionConstantValue(float value) Creates an instance of aConstantValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.static ConstantValueexactly(float p_165693_) floatgetFloat(LootContext p_165695_) getType()inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.floatvalue()Returns the value of thevaluerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams, validateMethods inherited from interface net.minecraft.world.level.storage.loot.providers.number.NumberProvider
getInt
-
Field Details
-
value
private final float valueThe field for thevaluerecord component. -
CODEC
-
INLINE_CODEC
-
-
Constructor Details
-
ConstantValue
public ConstantValue(float value) Creates an instance of aConstantValuerecord class.- Parameters:
value- the value for thevaluerecord component
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceNumberProvider
-
getFloat
- Specified by:
getFloatin interfaceNumberProvider
-
exactly
-
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 with '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
value
public float value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-