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 Details

    • name

      private final com.mojang.datafixers.util.Either<SelectorPattern,String> name
      The field for the name record component.
    • objective

      private final String objective
      The field for the objective record component.
    • INNER_CODEC

      public static final com.mojang.serialization.MapCodec<ScoreContents> INNER_CODEC
    • CODEC

      public static final com.mojang.serialization.MapCodec<ScoreContents> CODEC
    • TYPE

      public static final ComponentContents.Type<ScoreContents> TYPE
  • Constructor Details

    • ScoreContents

      public ScoreContents(com.mojang.datafixers.util.Either<SelectorPattern,String> name, String objective)
      Creates an instance of a ScoreContents record class.
      Parameters:
      name - the value for the name record component
      objective - the value for the objective record component
  • Method Details

    • type

      public ComponentContents.Type<?> type()
      Specified by:
      type in interface ComponentContents
    • findTargetName

      private ScoreHolder findTargetName(CommandSourceStack p_237442_) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getScore

      private MutableComponent getScore(ScoreHolder p_313863_, CommandSourceStack p_237451_)
    • 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 interface ComponentContents
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public com.mojang.datafixers.util.Either<SelectorPattern,String> name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • objective

      public String objective()
      Returns the value of the objective record component.
      Returns:
      the value of the objective record component