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
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ConstantValue>
static final com.mojang.serialization.Codec<ConstantValue>
private final float
The field for thevalue
record component. -
Constructor Summary
ConstructorDescriptionConstantValue
(float value) Creates an instance of aConstantValue
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.static ConstantValue
exactly
(float p_165693_) float
getFloat
(LootContext p_165695_) getType()
int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.float
value()
Returns the value of thevalue
record component.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
-
value
private final float valueThe field for thevalue
record component. -
CODEC
-
INLINE_CODEC
-
-
Constructor Details
-
ConstantValue
public ConstantValue(float value) Creates an instance of aConstantValue
record class.- Parameters:
value
- the value for thevalue
record component
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceNumberProvider
-
getFloat
- Specified by:
getFloat
in 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 thevalue
record component.- Returns:
- the value of the
value
record component
-