Record Class StringTemplate

java.lang.Object
java.lang.Record
net.minecraft.commands.functions.StringTemplate

public record StringTemplate(List<String> segments, List<String> variables) extends Record
  • Field Details

    • segments

      private final List<String> segments
      The field for the segments record component.
    • variables

      private final List<String> variables
      The field for the variables record component.
  • Constructor Details

    • StringTemplate

      public StringTemplate(List<String> segments, List<String> variables)
      Creates an instance of a StringTemplate record class.
      Parameters:
      segments - the value for the segments record component
      variables - the value for the variables record component
  • Method Details

    • fromString

      public static StringTemplate fromString(String p_306229_, int p_305937_)
    • isValidVariableName

      private static boolean isValidVariableName(String p_306141_)
    • substitute

      public String substitute(List<String> p_306329_)
    • toString

      public final 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.
    • segments

      public List<String> segments()
      Returns the value of the segments record component.
      Returns:
      the value of the segments record component
    • variables

      public List<String> variables()
      Returns the value of the variables record component.
      Returns:
      the value of the variables record component