Package net.minecraft.text
Interface Text
- All Superinterfaces:
- com.mojang.brigadier.Message,- StringVisitable
- All Known Implementing Classes:
- MutableText
A text. Can be converted to and from JSON format.
 
Each text has a tree structure, embodying all its siblings. To iterate contents in the text and all
 its siblings, call visit methods.
 
This interface does not expose mutation operations. For mutation,
 refer to MutableText.
- See Also:
- Mappings:
- Namespace - Name - official - sw- intermediary - net/minecraft/class_2561- named - net/minecraft/text/Text
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from interface net.minecraft.text.StringVisitableStringVisitable.StyledVisitor<T>, StringVisitable.Visitor<T>
- 
Field SummaryFields inherited from interface net.minecraft.text.StringVisitableEMPTY, TERMINATE_VISIT
- 
Method SummaryModifier and TypeMethodDescriptiondefault StringasTruncatedString(int length) Returns the full string representation of this text, truncated beyond the suppliedlength.default booleanReturns whether the text containstext, without considering styles.default MutableTextcopy()Copies the text's content, the style, and the siblings.default MutableTextCopies the text's content, excluding the styles or siblings.static MutableTextempty()Returns the content of the text.Returns the siblings of this text.default StringgetStyle()Returns the style of this text.getWithStyle(Style style) static MutableTextstatic MutableTextstatic MutableTextnbt(String rawPath, boolean interpret, Optional<Text> separator, NbtDataSource dataSource) static TextCreates a literal text with the given string as content.static MutableTextstatic MutableTextstatic MutableTexttranslatable(String key) static MutableTexttranslatable(String key, Object[] args) static MutableTexttranslatableWithFallback(String key, @Nullable String fallback) static MutableTexttranslatableWithFallback(String key, @Nullable String fallback, Object[] args) default <T> Optional<T>visit(StringVisitable.StyledVisitor<T> styledVisitor, Style style) Supplies this visitable's literal content and contextual style to the visitor.default <T> Optional<T>visit(StringVisitable.Visitor<T> visitor) Supplies this visitable's literal content to the visitor.
- 
Method Details- 
getStyleStyle getStyle()Returns the style of this text.- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a()Lts;- intermediary - method_10866- Lnet/minecraft/class_2561;method_10866()Lnet/minecraft/class_2583;- named - getStyle- Lnet/minecraft/text/Text;getStyle()Lnet/minecraft/text/Style;
 
- 
getContentTextContent getContent()Returns the content of the text.- Returns:
- the content of the text
- Mappings:
- Namespace - Name - Mixin selector - official - b- Lsw;b()Lsx;- intermediary - method_10851- Lnet/minecraft/class_2561;method_10851()Lnet/minecraft/class_7417;- named - getContent- Lnet/minecraft/text/Text;getContent()Lnet/minecraft/text/TextContent;
 
- 
getString- Specified by:
- getStringin interface- com.mojang.brigadier.Message
- Specified by:
- getStringin interface- StringVisitable
 
- 
asTruncatedStringReturns the full string representation of this text, truncated beyond the suppliedlength.- Parameters:
- length- the max length allowed for the string representation of the text
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(I)Ljava/lang/String;- intermediary - method_10858- Lnet/minecraft/class_2561;method_10858(I)Ljava/lang/String;- named - asTruncatedString- Lnet/minecraft/text/Text;asTruncatedString(I)Ljava/lang/String;
 
- 
getSiblingsReturns the siblings of this text.- Mappings:
- Namespace - Name - Mixin selector - official - c- Lsw;c()Ljava/util/List;- intermediary - method_10855- Lnet/minecraft/class_2561;method_10855()Ljava/util/List;- named - getSiblings- Lnet/minecraft/text/Text;getSiblings()Ljava/util/List;
 
- 
copyContentOnlyCopies the text's content, excluding the styles or siblings.- Mappings:
- Namespace - Name - Mixin selector - official - d- Lsw;d()Ltj;- intermediary - method_27662- Lnet/minecraft/class_2561;method_27662()Lnet/minecraft/class_5250;- named - copyContentOnly- Lnet/minecraft/text/Text;copyContentOnly()Lnet/minecraft/text/MutableText;
 
- 
copyCopies the text's content, the style, and the siblings.A shallow copy is made for the siblings. - Mappings:
- Namespace - Name - Mixin selector - official - e- Lsw;e()Ltj;- intermediary - method_27661- Lnet/minecraft/class_2561;method_27661()Lnet/minecraft/class_5250;- named - copy- Lnet/minecraft/text/Text;copy()Lnet/minecraft/text/MutableText;
 
- 
asOrderedTextOrderedText asOrderedText()- Mappings:
- Namespace - Name - Mixin selector - official - f- Lsw;f()Laom;- intermediary - method_30937- Lnet/minecraft/class_2561;method_30937()Lnet/minecraft/class_5481;- named - asOrderedText- Lnet/minecraft/text/Text;asOrderedText()Lnet/minecraft/text/OrderedText;
 
- 
visitSupplies this visitable's literal content and contextual style to the visitor.- Specified by:
- visitin interface- StringVisitable
- Parameters:
- styledVisitor- the visitor
- style- the contextual style
- Returns:
- Optional.empty()if the visit finished, or a terminating result from the- visitor
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lta;a(Lta$b;Lts;)Ljava/util/Optional;- intermediary - method_27658- Lnet/minecraft/class_5348;method_27658(Lnet/minecraft/class_5348$class_5246;Lnet/minecraft/class_2583;)Ljava/util/Optional;- named - visit- Lnet/minecraft/text/StringVisitable;visit(Lnet/minecraft/text/StringVisitable$StyledVisitor;Lnet/minecraft/text/Style;)Ljava/util/Optional;
 
- 
visitSupplies this visitable's literal content to the visitor.- Specified by:
- visitin interface- StringVisitable
- Parameters:
- visitor- the visitor
- Returns:
- Optional.empty()if the visit finished, or a terminating result from the- visitor
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lta;a(Lta$a;)Ljava/util/Optional;- intermediary - method_27657- Lnet/minecraft/class_5348;method_27657(Lnet/minecraft/class_5348$class_5245;)Ljava/util/Optional;- named - visit- Lnet/minecraft/text/StringVisitable;visit(Lnet/minecraft/text/StringVisitable$Visitor;)Ljava/util/Optional;
 
- 
withoutStyle- Mappings:
- Namespace - Name - Mixin selector - official - g- Lsw;g()Ljava/util/List;- intermediary - method_44746- Lnet/minecraft/class_2561;method_44746()Ljava/util/List;- named - withoutStyle- Lnet/minecraft/text/Text;withoutStyle()Ljava/util/List;
 
- 
getWithStyle- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Lts;)Ljava/util/List;- intermediary - method_36136- Lnet/minecraft/class_2561;method_36136(Lnet/minecraft/class_2583;)Ljava/util/List;- named - getWithStyle- Lnet/minecraft/text/Text;getWithStyle(Lnet/minecraft/text/Style;)Ljava/util/List;
 
- 
containsReturns whether the text containstext, without considering styles.- Returns:
- whether the text contains text, without considering styles
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Lsw;)Z- intermediary - method_44745- Lnet/minecraft/class_2561;method_44745(Lnet/minecraft/class_2561;)Z- named - contains- Lnet/minecraft/text/Text;contains(Lnet/minecraft/text/Text;)Z
 
- 
ofCreates a literal text with the given string as content.- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Ljava/lang/String;)Lsw;- intermediary - method_30163- Lnet/minecraft/class_2561;method_30163(Ljava/lang/String;)Lnet/minecraft/class_2561;- named - of- Lnet/minecraft/text/Text;of(Ljava/lang/String;)Lnet/minecraft/text/Text;
 
- 
literal- Mappings:
- Namespace - Name - Mixin selector - official - b- Lsw;b(Ljava/lang/String;)Ltj;- intermediary - method_43470- Lnet/minecraft/class_2561;method_43470(Ljava/lang/String;)Lnet/minecraft/class_5250;- named - literal- Lnet/minecraft/text/Text;literal(Ljava/lang/String;)Lnet/minecraft/text/MutableText;
 
- 
translatable- Mappings:
- Namespace - Name - Mixin selector - official - c- Lsw;c(Ljava/lang/String;)Ltj;- intermediary - method_43471- Lnet/minecraft/class_2561;method_43471(Ljava/lang/String;)Lnet/minecraft/class_5250;- named - translatable- Lnet/minecraft/text/Text;translatable(Ljava/lang/String;)Lnet/minecraft/text/MutableText;
 
- 
translatable- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Ljava/lang/String;[Ljava/lang/Object;)Ltj;- intermediary - method_43469- Lnet/minecraft/class_2561;method_43469(Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/class_5250;- named - translatable- Lnet/minecraft/text/Text;translatable(Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/text/MutableText;
 
- 
translatableWithFallback- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Ljava/lang/String;Ljava/lang/String;)Ltj;- intermediary - method_48321- Lnet/minecraft/class_2561;method_48321(Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/class_5250;- named - translatableWithFallback- Lnet/minecraft/text/Text;translatableWithFallback(Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/text/MutableText;
 
- 
translatableWithFallbackstatic MutableText translatableWithFallback(String key, @Nullable @Nullable String fallback, Object[] args) - Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ltj;- intermediary - method_48322- Lnet/minecraft/class_2561;method_48322(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/class_5250;- named - translatableWithFallback- Lnet/minecraft/text/Text;translatableWithFallback(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/text/MutableText;
 
- 
empty- Mappings:
- Namespace - Name - Mixin selector - official - h- Lsw;h()Ltj;- intermediary - method_43473- Lnet/minecraft/class_2561;method_43473()Lnet/minecraft/class_5250;- named - empty- Lnet/minecraft/text/Text;empty()Lnet/minecraft/text/MutableText;
 
- 
keybind- Mappings:
- Namespace - Name - Mixin selector - official - d- Lsw;d(Ljava/lang/String;)Ltj;- intermediary - method_43472- Lnet/minecraft/class_2561;method_43472(Ljava/lang/String;)Lnet/minecraft/class_5250;- named - keybind- Lnet/minecraft/text/Text;keybind(Ljava/lang/String;)Lnet/minecraft/text/MutableText;
 
- 
nbtstatic MutableText nbt(String rawPath, boolean interpret, Optional<Text> separator, NbtDataSource dataSource) - Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Ljava/lang/String;ZLjava/util/Optional;Ltx;)Ltj;- intermediary - method_43468- Lnet/minecraft/class_2561;method_43468(Ljava/lang/String;ZLjava/util/Optional;Lnet/minecraft/class_7419;)Lnet/minecraft/class_5250;- named - nbt- Lnet/minecraft/text/Text;nbt(Ljava/lang/String;ZLjava/util/Optional;Lnet/minecraft/text/NbtDataSource;)Lnet/minecraft/text/MutableText;
 
- 
score- Mappings:
- Namespace - Name - Mixin selector - official - b- Lsw;b(Ljava/lang/String;Ljava/lang/String;)Ltj;- intermediary - method_43466- Lnet/minecraft/class_2561;method_43466(Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/class_5250;- named - score- Lnet/minecraft/text/Text;score(Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/text/MutableText;
 
- 
selector- Mappings:
- Namespace - Name - Mixin selector - official - a- Lsw;a(Ljava/lang/String;Ljava/util/Optional;)Ltj;- intermediary - method_43467- Lnet/minecraft/class_2561;method_43467(Ljava/lang/String;Ljava/util/Optional;)Lnet/minecraft/class_5250;- named - selector- Lnet/minecraft/text/Text;selector(Ljava/lang/String;Ljava/util/Optional;)Lnet/minecraft/text/MutableText;
 
 
-