Record Class ScoreboardValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.ScoreboardValue
- All Implemented Interfaces:
LootContextUser
,NumberProvider
public record ScoreboardValue(ScoreboardNameProvider target, String score, float scale)
extends Record
implements NumberProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ScoreboardValue>
private final float
The field for thescale
record component.private final String
The field for thescore
record component.private final ScoreboardNameProvider
The field for thetarget
record component. -
Constructor Summary
ConstructorsConstructorDescriptionScoreboardValue
(ScoreboardNameProvider target, String score, float scale) Creates an instance of aScoreboardValue
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.static ScoreboardValue
fromScoreboard
(LootContext.EntityTarget p_165750_, String p_165751_) static ScoreboardValue
fromScoreboard
(LootContext.EntityTarget p_165753_, String p_165754_, float p_165755_) float
getFloat
(LootContext p_165758_) Set<LootContextParam<?>>
getType()
final int
hashCode()
Returns a hash code value for this object.float
scale()
Returns the value of thescale
record component.score()
Returns the value of thescore
record component.target()
Returns the value of thetarget
record component.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
validate
Methods inherited from interface net.minecraft.world.level.storage.loot.providers.number.NumberProvider
getInt
-
Field Details
-
target
The field for thetarget
record component. -
score
The field for thescore
record component. -
scale
private final float scaleThe field for thescale
record component. -
CODEC
-
-
Constructor Details
-
ScoreboardValue
Creates an instance of aScoreboardValue
record class.- Parameters:
target
- the value for thetarget
record componentscore
- the value for thescore
record componentscale
- the value for thescale
record component
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceNumberProvider
-
getReferencedContextParams
- Specified by:
getReferencedContextParams
in interfaceLootContextUser
-
fromScoreboard
-
fromScoreboard
public static ScoreboardValue fromScoreboard(LootContext.EntityTarget p_165753_, String p_165754_, float p_165755_) -
getFloat
- Specified by:
getFloat
in interfaceNumberProvider
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
target
Returns the value of thetarget
record component.- Returns:
- the value of the
target
record component
-
score
Returns the value of thescore
record component.- Returns:
- the value of the
score
record component
-
scale
public float scale()Returns the value of thescale
record component.- Returns:
- the value of the
scale
record component
-