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 pText) static <T extends Comparable<T>>
ComponentformatAndSortList
(Collection<T> pElements, Function<T, Component> pComponentExtractor) static Component
formatList
(Collection<? extends Component> pElements, Component pSeparator) static <T> Component
formatList
(Collection<? extends T> pElements, Function<T, Component> pComponentExtractor) static <T> MutableComponent
formatList
(Collection<? extends T> pElements, Optional<? extends Component> pOptionalSeparator, Function<T, Component> pComponentExtractor) static <T> MutableComponent
formatList
(Collection<? extends T> pElements, Component pSeparator, Function<T, Component> pComponentExtractor) static Component
formatList
(Collection<String> pElements) static Component
fromMessage
(com.mojang.brigadier.Message p_130730_) static boolean
isTranslationResolvable
(Component pComponent) static MutableComponent
mergeStyles
(MutableComponent pComponent, Style pStyle) Merge the component's styles with the given Style.private static Style
resolveStyle
(CommandSourceStack pCommandSourceStack, Style pStyle, Entity pEntity, int pRecursionDepth) static Optional
<MutableComponent> updateForEntity
(CommandSourceStack pCommandSourceStack, Optional<Component> pOptionalComponent, Entity pEntity, int pRecursionDepth) static MutableComponent
updateForEntity
(CommandSourceStack pCommandSourceStack, Component pComponent, Entity pEntity, int pRecursionDepth) static MutableComponent
wrapInSquareBrackets
(Component pToWrap) 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 pCommandSourceStack, Optional<Component> pOptionalComponent, @Nullable Entity pEntity, int pRecursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
updateForEntity
public static MutableComponent updateForEntity(@Nullable CommandSourceStack pCommandSourceStack, Component pComponent, @Nullable Entity pEntity, int pRecursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
resolveStyle
private static Style resolveStyle(@Nullable CommandSourceStack pCommandSourceStack, Style pStyle, @Nullable Entity pEntity, int pRecursionDepth) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
formatList
-
formatAndSortList
public static <T extends Comparable<T>> Component formatAndSortList(Collection<T> pElements, Function<T, Component> pComponentExtractor) -
formatList
public static <T> Component formatList(Collection<? extends T> pElements, Function<T, Component> pComponentExtractor) -
formatList
public static <T> MutableComponent formatList(Collection<? extends T> pElements, Optional<? extends Component> pOptionalSeparator, Function<T, Component> pComponentExtractor) -
formatList
-
formatList
public static <T> MutableComponent formatList(Collection<? extends T> pElements, Component pSeparator, Function<T, Component> pComponentExtractor) -
wrapInSquareBrackets
Wraps the text with square brackets. -
fromMessage
-
isTranslationResolvable
-
copyOnClickText
-