接口 Text
-
- 所有超级接口:
com.mojang.brigadier.Message,StringVisitable
- 所有已知子接口:
MutableText
- 所有已知实现类:
BaseText,KeybindText,LiteralText,NbtText,NbtText.BlockNbtText,NbtText.EntityNbtText,NbtText.StorageNbtText,ScoreText,SelectorText,TranslatableText
public interface Text extends com.mojang.brigadier.Message, StringVisitable
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, callvisitmethods.This interface does not expose mutation operations. For mutation, refer to
MutableText.- 另请参阅:
MutableText- Mappings:
Namespace Name official onintermediary net/minecraft/class_2561named net/minecraft/text/Text
-
-
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static classText.SerializerA JSON serializer forText.-
从接口继承的嵌套类/接口 net.minecraft.text.StringVisitable
StringVisitable.StyledVisitor<T>, StringVisitable.Visitor<T>
-
-
字段概要
-
从接口继承的字段 net.minecraft.text.StringVisitable
EMPTY, TERMINATE_VISIT
-
-
方法概要
所有方法 静态方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 OrderedTextasOrderedText()StringasString()Returns the string representation of this text itself, excluding siblings.default StringasTruncatedString(int length)Returns the full string representation of this text, truncated beyond the suppliedlength.MutableTextcopy()Copies the text itself, excluding the styles or siblings.List<Text>getSiblings()Returns the siblings of this text.default StringgetString()StylegetStyle()Returns the style of this text.default List<Text>method_36136(Style style)static Textof(@Nullable String string)Creates a literal text with the given string as content.MutableTextshallowCopy()Copies the text itself, the style, and the siblings.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.default <T> Optional<T>visitSelf(StringVisitable.StyledVisitor<T> visitor, Style style)Visits the text itself.default <T> Optional<T>visitSelf(StringVisitable.Visitor<T> visitor)Visits the text itself.
-
-
-
方法详细资料
-
getStyle
Style getStyle()
Returns the style of this text.- Mappings:
Namespace Name Mixin selector official cLon;c()Lox;intermediary method_10866Lnet/minecraft/class_2561;method_10866()Lnet/minecraft/class_2583;named getStyleLnet/minecraft/text/Text;getStyle()Lnet/minecraft/text/Style;
-
asString
String asString()
Returns the string representation of this text itself, excluding siblings.- Mappings:
Namespace Name Mixin selector official aLon;a()Ljava/lang/String;intermediary method_10851Lnet/minecraft/class_2561;method_10851()Ljava/lang/String;named asStringLnet/minecraft/text/Text;asString()Ljava/lang/String;
-
getString
default String getString()
- 指定者:
getString在接口中com.mojang.brigadier.Message- 指定者:
getString在接口中StringVisitable- Mappings:
Namespace Name Mixin selector official getStringLoq;getString()Ljava/lang/String;intermediary getStringLnet/minecraft/class_5348;getString()Ljava/lang/String;named getStringLnet/minecraft/text/StringVisitable;getString()Ljava/lang/String;
-
asTruncatedString
default String asTruncatedString(int length)
Returns the full string representation of this text, truncated beyond the suppliedlength.- 参数:
length- the max length allowed for the string representation of the text- Mappings:
Namespace Name Mixin selector official aLon;a(I)Ljava/lang/String;intermediary method_10858Lnet/minecraft/class_2561;method_10858(I)Ljava/lang/String;named asTruncatedStringLnet/minecraft/text/Text;asTruncatedString(I)Ljava/lang/String;
-
getSiblings
List<Text> getSiblings()
Returns the siblings of this text.- Mappings:
Namespace Name Mixin selector official bLon;b()Ljava/util/List;intermediary method_10855Lnet/minecraft/class_2561;method_10855()Ljava/util/List;named getSiblingsLnet/minecraft/text/Text;getSiblings()Ljava/util/List;
-
copy
MutableText copy()
Copies the text itself, excluding the styles or siblings.- Mappings:
Namespace Name Mixin selector official gLon;g()Lot;intermediary method_27662Lnet/minecraft/class_2561;method_27662()Lnet/minecraft/class_5250;named copyLnet/minecraft/text/Text;copy()Lnet/minecraft/text/MutableText;
-
shallowCopy
MutableText shallowCopy()
Copies the text itself, the style, and the siblings.A shallow copy is made for the siblings.
- Mappings:
Namespace Name Mixin selector official eLon;e()Lot;intermediary method_27661Lnet/minecraft/class_2561;method_27661()Lnet/minecraft/class_5250;named shallowCopyLnet/minecraft/text/Text;shallowCopy()Lnet/minecraft/text/MutableText;
-
asOrderedText
OrderedText asOrderedText()
- Mappings:
Namespace Name Mixin selector official fLon;f()Lagj;intermediary method_30937Lnet/minecraft/class_2561;method_30937()Lnet/minecraft/class_5481;named asOrderedTextLnet/minecraft/text/Text;asOrderedText()Lnet/minecraft/text/OrderedText;
-
visit
default <T> Optional<T> visit(StringVisitable.StyledVisitor<T> styledVisitor, Style style)
Supplies this visitable's literal content and contextual style to the visitor.- 指定者:
visit在接口中StringVisitable- 参数:
styledVisitor- the visitorstyle- the contextual style- 返回:
Optional.empty()if the visit finished, or a terminating result from thevisitor- Mappings:
Namespace Name Mixin selector official aLoq;a(Loq$b;Lox;)Ljava/util/Optional;intermediary method_27658Lnet/minecraft/class_5348;method_27658(Lnet/minecraft/class_5348$class_5246;Lnet/minecraft/class_2583;)Ljava/util/Optional;named visitLnet/minecraft/text/StringVisitable;visit(Lnet/minecraft/text/StringVisitable$StyledVisitor;Lnet/minecraft/text/Style;)Ljava/util/Optional;
-
visit
default <T> Optional<T> visit(StringVisitable.Visitor<T> visitor)
Supplies this visitable's literal content to the visitor.- 指定者:
visit在接口中StringVisitable- 参数:
visitor- the visitor- 返回:
Optional.empty()if the visit finished, or a terminating result from thevisitor- Mappings:
Namespace Name Mixin selector official aLoq;a(Loq$a;)Ljava/util/Optional;intermediary method_27657Lnet/minecraft/class_5348;method_27657(Lnet/minecraft/class_5348$class_5245;)Ljava/util/Optional;named visitLnet/minecraft/text/StringVisitable;visit(Lnet/minecraft/text/StringVisitable$Visitor;)Ljava/util/Optional;
-
visitSelf
default <T> Optional<T> visitSelf(StringVisitable.StyledVisitor<T> visitor, Style style)
Visits the text itself.- 参数:
visitor- the visitorstyle- the current style- 返回:
- the visitor's return value
- 另请参阅:
visit(StyledVisitor, Style)- Mappings:
Namespace Name Mixin selector official bLon;b(Loq$b;Lox;)Ljava/util/Optional;intermediary method_27660Lnet/minecraft/class_2561;method_27660(Lnet/minecraft/class_5348$class_5246;Lnet/minecraft/class_2583;)Ljava/util/Optional;named visitSelfLnet/minecraft/text/Text;visitSelf(Lnet/minecraft/text/StringVisitable$StyledVisitor;Lnet/minecraft/text/Style;)Ljava/util/Optional;
-
visitSelf
default <T> Optional<T> visitSelf(StringVisitable.Visitor<T> visitor)
Visits the text itself.- 参数:
visitor- the visitor- 返回:
- the visitor's return value
- 另请参阅:
visit(Visitor)- Mappings:
Namespace Name Mixin selector official bLon;b(Loq$a;)Ljava/util/Optional;intermediary method_27659Lnet/minecraft/class_2561;method_27659(Lnet/minecraft/class_5348$class_5245;)Ljava/util/Optional;named visitSelfLnet/minecraft/text/Text;visitSelf(Lnet/minecraft/text/StringVisitable$Visitor;)Ljava/util/Optional;
-
method_36136
default List<Text> method_36136(Style style)
- Mappings:
Namespace Name Mixin selector official bLon;b(Lox;)Ljava/util/List;intermediary method_36136Lnet/minecraft/class_2561;method_36136(Lnet/minecraft/class_2583;)Ljava/util/List;named method_36136Lnet/minecraft/text/Text;method_36136(Lnet/minecraft/text/Style;)Ljava/util/List;
-
of
static Text of(@Nullable @Nullable String string)
Creates a literal text with the given string as content.- Mappings:
Namespace Name Mixin selector official aLon;a(Ljava/lang/String;)Lon;intermediary method_30163Lnet/minecraft/class_2561;method_30163(Ljava/lang/String;)Lnet/minecraft/class_2561;named ofLnet/minecraft/text/Text;of(Ljava/lang/String;)Lnet/minecraft/text/Text;
-
-