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 thenamerecord component.private final StringThe field for theobjectiverecord component.static final ComponentContents.Type<ScoreContents> -
Constructor Summary
ConstructorsConstructorDescriptionScoreContents(com.mojang.datafixers.util.Either<SelectorPattern, String> name, String objective) Creates an instance of aScoreContentsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.private ScoreHolderfindTargetName(CommandSourceStack pSource) private MutableComponentgetScore(ScoreHolder pScoreHolder, CommandSourceStack pSource) 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(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, waitMethods inherited from interface net.minecraft.network.chat.ComponentContents
visit, visit
-
Field Details
-
name
The field for thenamerecord component. -
objective
The field for theobjectiverecord component. -
INNER_CODEC
-
CODEC
-
TYPE
-
-
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
-
type
- Specified by:
typein interfaceComponentContents
-
findTargetName
private ScoreHolder findTargetName(CommandSourceStack pSource) 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:
resolvein 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 thenamerecord component.- Returns:
- the value of the
namerecord component
-
objective
Returns the value of theobjectiverecord component.- Returns:
- the value of the
objectiverecord component
-