Package net.minecraft.network.chat
Class ComponentUtils
java.lang.Object
net.minecraft.network.chat.ComponentUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MutableComponent
copyOnClickText
(String text) static <T extends Comparable<T>>
ComponentformatAndSortList
(Collection<T> elements, Function<T, Component> componentExtractor) static Component
formatList
(Collection<? extends Component> elements, Component separator) static <T> Component
formatList
(Collection<? extends T> elements, Function<T, Component> componentExtractor) static <T> MutableComponent
formatList
(Collection<? extends T> elements, Optional<? extends Component> optionalSeparator, Function<T, Component> componentExtractor) static <T> MutableComponent
formatList
(Collection<? extends T> elements, Component separator, Function<T, Component> componentExtractor) static Component
formatList
(Collection<String> elements) static Component
fromMessage
(com.mojang.brigadier.Message message) static boolean
isTranslationResolvable
(Component component) static MutableComponent
mergeStyles
(MutableComponent component, Style p_style) Merge the component's styles with the given Style.private static Style
resolveStyle
(CommandSourceStack commandSourceStack, Style style, Entity entity, int recursionDepth) static Optional
<MutableComponent> updateForEntity
(CommandSourceStack commandSourceStack, Optional<Component> optionalComponent, Entity entity, int recursionDepth) static MutableComponent
updateForEntity
(CommandSourceStack commandSourceStack, Component p_component, Entity entity, int recursionDepth) static MutableComponent
wrapInSquareBrackets
(Component toWrap) 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
Merge the component's styles with the given Style. -
updateForEntity
public static Optional<MutableComponent> updateForEntity(@Nullable CommandSourceStack commandSourceStack, Optional<Component> optionalComponent, @Nullable Entity entity, int recursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
updateForEntity
public static MutableComponent updateForEntity(@Nullable CommandSourceStack commandSourceStack, Component p_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 commandSourceStack, 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> elements, Function<T, Component> componentExtractor) -
formatList
public static <T> Component formatList(Collection<? extends T> elements, Function<T, Component> componentExtractor) -
formatList
public static <T> MutableComponent formatList(Collection<? extends T> elements, Optional<? extends Component> optionalSeparator, Function<T, Component> componentExtractor) -
formatList
-
formatList
public static <T> MutableComponent formatList(Collection<? extends T> elements, Component separator, Function<T, Component> componentExtractor) -
wrapInSquareBrackets
Wraps the text with square brackets. -
fromMessage
-
isTranslationResolvable
-
copyOnClickText
-