Record Class ScoreContents
java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.ScoreContents
- All Implemented Interfaces:
ComponentContents
public record ScoreContents(com.mojang.datafixers.util.Either<SelectorPattern,String> name, String objective)
extends Record
implements ComponentContents
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.chat.ComponentContents
ComponentContents.Type<T extends ComponentContents>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<ScoreContents> static final com.mojang.serialization.MapCodec
<ScoreContents> private final com.mojang.datafixers.util.Either
<SelectorPattern, String> The field for thename
record component.private final String
The field for theobjective
record component.static final ComponentContents.Type
<ScoreContents> -
Constructor Summary
ConstructorsConstructorDescriptionScoreContents
(com.mojang.datafixers.util.Either<SelectorPattern, String> name, String objective) Creates an instance of aScoreContents
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.private ScoreHolder
findTargetName
(CommandSourceStack p_237442_) private MutableComponent
getScore
(ScoreHolder p_313863_, CommandSourceStack p_237451_) final int
hashCode()
Returns a hash code value for this object.com.mojang.datafixers.util.Either
<SelectorPattern, String> name()
Returns the value of thename
record component.Returns the value of theobjective
record component.resolve
(CommandSourceStack p_237444_, Entity p_237445_, int p_237446_) toString()
Returns a string representation of this record class.type()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.network.chat.ComponentContents
visit, visit
-
Field Details
-
name
The field for thename
record component. -
objective
The field for theobjective
record component. -
INNER_CODEC
-
CODEC
-
TYPE
-
-
Constructor Details
-
ScoreContents
public ScoreContents(com.mojang.datafixers.util.Either<SelectorPattern, String> name, String objective) Creates an instance of aScoreContents
record class.- Parameters:
name
- the value for thename
record componentobjective
- the value for theobjective
record component
-
-
Method Details
-
type
- Specified by:
type
in interfaceComponentContents
-
findTargetName
private ScoreHolder findTargetName(CommandSourceStack p_237442_) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getScore
-
resolve
public MutableComponent resolve(@Nullable CommandSourceStack p_237444_, @Nullable Entity p_237445_, int p_237446_) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
resolve
in interfaceComponentContents
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
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)
. -
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
objective
Returns the value of theobjective
record component.- Returns:
- the value of the
objective
record component
-