Record Class LiteralText

java.lang.Object
java.lang.Record
net.minecraft.text.LiteralText
Record Components:
string -
All Implemented Interfaces:
class_7417

public record LiteralText(String string) extends Record implements class_7417
Mappings:
Namespace Name
official rm
intermediary net/minecraft/class_2585
named net/minecraft/text/LiteralText
official b
intermediary comp_737
named string
  • Field Details

    • string

      private final String string
      The field for the string record component.
  • Constructor Details

    • LiteralText

      public LiteralText(String string)
      Creates an instance of a LiteralText record class.
      Parameters:
      string - the value for the string record component
  • Method Details

    • visitSelf

      public <T> Optional<T> visitSelf(StringVisitable.Visitor<T> visitor)
      Specified by:
      visitSelf in interface class_7417
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Lrb$a;)Ljava/util/Optional;
      intermediary method_27659 Lnet/minecraft/class_7417;method_27659(Lnet/minecraft/class_5348$class_5245;)Ljava/util/Optional;
      named visitSelf Lnet/minecraft/class_7417;visitSelf(Lnet/minecraft/text/StringVisitable$Visitor;)Ljava/util/Optional;
    • visitSelf

      public <T> Optional<T> visitSelf(StringVisitable.StyledVisitor<T> styledVisitor, Style style)
      Specified by:
      visitSelf in interface class_7417
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Lrb$b;Lre;)Ljava/util/Optional;
      intermediary method_27660 Lnet/minecraft/class_7417;method_27660(Lnet/minecraft/class_5348$class_5246;Lnet/minecraft/class_2583;)Ljava/util/Optional;
      named visitSelf Lnet/minecraft/class_7417;visitSelf(Lnet/minecraft/text/StringVisitable$StyledVisitor;Lnet/minecraft/text/Style;)Ljava/util/Optional;
    • 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 object)
      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:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • string

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