Class BaseText

java.lang.Object
net.minecraft.text.BaseText
All Implemented Interfaces:
com.mojang.brigadier.Message, MutableText, StringVisitable, Text
Direct Known Subclasses:
KeybindText, LiteralText, NbtText, ScoreText, SelectorText, TranslatableText

public abstract class BaseText
extends Object
implements MutableText
  • Field Details

    • siblings

      protected final List<Text> siblings
    • orderedText

      private OrderedText orderedText
    • previousLanguage

      @Environment(CLIENT) @Nullable private Language previousLanguage
    • style

      private Style style
  • Constructor Details

    • BaseText

      public BaseText()
  • Method Details

    • append

      public MutableText append​(Text text)
      Appends a text to this text's siblings.
      Specified by:
      append in interface MutableText
      Parameters:
      text - the sibling
    • asString

      public String asString()
      Returns the string representation of this text itself, excluding siblings.
      Specified by:
      asString in interface Text
    • getSiblings

      public List<Text> getSiblings()
      Returns the siblings of this text.
      Specified by:
      getSiblings in interface Text
    • setStyle

      public MutableText setStyle​(Style style)
      Sets the style of this text.
      Specified by:
      setStyle in interface MutableText
    • getStyle

      public Style getStyle()
      Returns the style of this text.
      Specified by:
      getStyle in interface Text
    • copy

      public abstract BaseText copy()
      Description copied from interface: Text
      Copies the text itself, excluding the styles or siblings.
      Specified by:
      copy in interface Text
    • shallowCopy

      public final MutableText shallowCopy()
      Copies the text itself, the style, and the siblings.

      A shallow copy is made for the siblings.

      Specified by:
      shallowCopy in interface Text
    • asOrderedText

      @Environment(CLIENT) public OrderedText asOrderedText()
      Specified by:
      asOrderedText in interface Text
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object