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
-
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 thenamerecord component.private final StringThe field for theobjectiverecord component. -
Constructor Summary
ConstructorsConstructorDescriptionScoreContents(com.mojang.datafixers.util.Either<SelectorPattern, String> name, String objective) Creates an instance of aScoreContentsrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<ScoreContents> codec()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.com.mojang.datafixers.util.Either<SelectorPattern, String> name()Returns the value of thenamerecord component.Returns the value of theobjectiverecord component.resolve(@Nullable CommandSourceStack source, @Nullable Entity entity, 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
public ScoreContents(com.mojang.datafixers.util.Either<SelectorPattern, String> name, String objective) 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
private ScoreHolder findTargetName(CommandSourceStack source) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getScore
-
resolve
public MutableComponent resolve(@Nullable CommandSourceStack source, @Nullable Entity entity, int recursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
resolvein interfaceComponentContents- Throws:
com.mojang.brigadier.exceptions.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
-