Record Class ScoreContents
java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.ScoreContents
- All Implemented Interfaces:
ComponentContents
public record ScoreContents(Either<CompilableString<EntitySelector>, String> name, String objective)
extends Record
implements ComponentContents
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MapCodec<ScoreContents> static final MapCodec<ScoreContents> private final Either<CompilableString<EntitySelector>, String> The field for thenamerecord component.private final StringThe field for theobjectiverecord component. -
Constructor Summary
ConstructorsConstructorDescriptionScoreContents(Either<CompilableString<EntitySelector>, String> name, String objective) Creates an instance of aScoreContentsrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncodec()final booleanIndicates whether some other object is "equal to" this one.private ScoreHolderfindTargetName(CommandSourceStack source) private MutableComponentgetScore(ScoreHolder name, CommandSourceStack source) final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.Returns the value of theobjectiverecord component.resolve(ResolutionContext context, int recursionDepth) toString()Returns a string representation of this record class.Methods inherited from interface ComponentContents
visit, visit
-
Field Details
-
name
The field for thenamerecord component. -
objective
The field for theobjectiverecord component. -
INNER_CODEC
-
MAP_CODEC
-
-
Constructor Details
-
ScoreContents
Creates an instance of aScoreContentsrecord class.- Parameters:
name- the value for thenamerecord componentobjective- the value for theobjectiverecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceComponentContents
-
findTargetName
- Throws:
CommandSyntaxException
-
getScore
-
resolve
public MutableComponent resolve(ResolutionContext context, int recursionDepth) throws CommandSyntaxException - Specified by:
resolvein interfaceComponentContents- Throws:
CommandSyntaxException
-
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). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
objective
Returns the value of theobjectiverecord component.- Returns:
- the value of the
objectiverecord component
-