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 MutableComponentcopyOnClickText(String pText) static <T extends Comparable<T>>
ComponentformatAndSortList(Collection<T> pElements, Function<T, Component> pComponentExtractor) static ComponentformatList(Collection<? extends Component> pElements, Component pSeparator) static <T> ComponentformatList(Collection<? extends T> pElements, Function<T, Component> pComponentExtractor) static <T> MutableComponentformatList(Collection<? extends T> pElements, Optional<? extends Component> pOptionalSeparator, Function<T, Component> pComponentExtractor) static <T> MutableComponentformatList(Collection<? extends T> pElements, Component pSeparator, Function<T, Component> pComponentExtractor) static ComponentformatList(Collection<String> pElements) static ComponentfromMessage(com.mojang.brigadier.Message pMessage) static booleanisTranslationResolvable(Component pComponent) static MutableComponentmergeStyles(MutableComponent pComponent, Style pStyle) Merge the component's styles with the given Style.private static StyleresolveStyle(CommandSourceStack pCommandSourceStack, Style pStyle, Entity pEntity, int pRecursionDepth) static Optional<MutableComponent> updateForEntity(CommandSourceStack pCommandSourceStack, Optional<Component> pOptionalComponent, Entity pEntity, int pRecursionDepth) static MutableComponentupdateForEntity(CommandSourceStack pCommandSourceStack, Component pComponent, Entity pEntity, int pRecursionDepth) static MutableComponentwrapInSquareBrackets(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
-