Class ComponentUtils
java.lang.Object
net.minecraft.network.chat.ComponentUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MutableComponentcopyOnClickText(String text) static <T extends Comparable<T>>
ComponentformatAndSortList(Collection<T> values, Function<T, Component> formatter) static ComponentformatList(Collection<? extends Component> values, Component separator) static <T> ComponentformatList(Collection<? extends T> values, Function<T, Component> formatter) static <T> MutableComponentformatList(Collection<? extends T> values, Optional<? extends Component> separator, Function<T, Component> formatter) static <T> MutableComponentformatList(Collection<? extends T> values, Component separator, Function<T, Component> formatter) static ComponentformatList(Collection<String> values) static ComponentfromMessage(com.mojang.brigadier.Message message) static booleanisTranslationResolvable(@Nullable Component component) static ComponentmergeStyles(Component component, Style style) static MutableComponentmergeStyles(MutableComponent component, Style style) Merge the component's styles with the given Style.private static StyleresolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity entity, int recursionDepth) static Optional<MutableComponent> updateForEntity(@Nullable CommandSourceStack source, Optional<Component> component, @Nullable Entity entity, int recursionDepth) static MutableComponentupdateForEntity(@Nullable CommandSourceStack source, Component component, @Nullable Entity entity, int recursionDepth) static MutableComponentwrapInSquareBrackets(Component inner) Wraps the text with square brackets.
-
Field Details
-
DEFAULT_SEPARATOR_TEXT
- See Also:
-
DEFAULT_SEPARATOR
-
DEFAULT_NO_STYLE_SEPARATOR
-
-
Constructor Details
-
ComponentUtils
public ComponentUtils()
-
-
Method Details
-
mergeStyles
@CheckReturnValue public static MutableComponent mergeStyles(MutableComponent component, Style style) Merge the component's styles with the given Style. -
mergeStyles
-
updateForEntity
public static Optional<MutableComponent> updateForEntity(@Nullable CommandSourceStack source, Optional<Component> component, @Nullable Entity entity, int recursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
updateForEntity
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component component, @Nullable Entity entity, int recursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
resolveStyle
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity entity, int recursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
formatList
-
formatAndSortList
public static <T extends Comparable<T>> Component formatAndSortList(Collection<T> values, Function<T, Component> formatter) -
formatList
public static <T> Component formatList(Collection<? extends T> values, Function<T, Component> formatter) -
formatList
public static <T> MutableComponent formatList(Collection<? extends T> values, Optional<? extends Component> separator, Function<T, Component> formatter) -
formatList
-
formatList
public static <T> MutableComponent formatList(Collection<? extends T> values, Component separator, Function<T, Component> formatter) -
wrapInSquareBrackets
Wraps the text with square brackets. -
fromMessage
-
isTranslationResolvable
-
copyOnClickText
-