Class TextHelper
java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.TextHelper
-
Field Summary
Modifier and TypeFieldDescriptionstatic final net.minecraft.network.chat.Component
static final Pattern
static final int
static final net.minecraft.network.chat.Component
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.MutableComponent
attemptAppend
(net.minecraft.network.chat.MutableComponent component, String segment, net.minecraft.network.chat.TextColor lastColour) Attempts to append the segment to theComponent
with the given (nullable) colourstatic net.minecraft.network.chat.MutableComponent
static net.minecraft.network.chat.Component
Parses the string to aComponent
with the correctly formatted colour codes and hex codesstatic net.minecraft.network.chat.Component
static String
static net.minecraft.network.chat.Component
static Supplier<net.minecraft.network.chat.Component>
futureTranslate
(net.minecraft.ChatFormatting colour, String text, Object... args) static net.minecraft.ChatFormatting
getByCode
(char p_211165_0_) Converts the legacy character to theChatFormatting
typestatic net.minecraft.network.chat.MutableComponent
join
(List<net.minecraft.network.chat.Component> texts, net.minecraft.network.chat.Component delimiter) static net.minecraft.network.chat.MutableComponent
joinStrings
(List<String> texts, net.minecraft.network.chat.Component delimiter) static Optional<net.minecraft.network.chat.TextColor>
parseColour
(String colourCode) Attempts to parse the colour code firstly as a hex, then as a legacystatic net.minecraft.network.chat.MutableComponent
space
(int spaces) static net.minecraft.network.chat.MutableComponent
textWithShowTextHover
(String str, String hover) static net.minecraft.network.chat.MutableComponent
textWithShowTextHover
(String str, net.minecraft.network.chat.Component hover) static net.minecraft.network.chat.MutableComponent
textWithShowTextHover
(net.minecraft.network.chat.Component str, String hover) static net.minecraft.network.chat.MutableComponent
textWithShowTextHover
(net.minecraft.network.chat.Component text, net.minecraft.network.chat.Component hover) static String
toRoman
(int number) static net.minecraft.network.chat.MutableComponent
static net.minecraft.network.chat.MutableComponent
static net.minecraft.network.chat.MutableComponent
static net.minecraft.network.chat.Component
Shortcut method for translating text and putting it in a coloured ComponentTranslation.
-
Field Details
-
DENY_CHARS
-
DENY_PATTERN
-
NAME_MAX_LENGTH
public static final int NAME_MAX_LENGTH- See Also:
-
OR_DELIMITER
public static final net.minecraft.network.chat.Component OR_DELIMITER -
AND_DELIMITER
public static final net.minecraft.network.chat.Component AND_DELIMITER
-
-
Constructor Details
-
TextHelper
public TextHelper()
-
-
Method Details
-
toRoman
-
colour
Parses the string to aComponent
with the correctly formatted colour codes and hex codes- Parameters:
text
- The unformatted text- Returns:
- The newly formatted text
-
attemptAppend
public static net.minecraft.network.chat.MutableComponent attemptAppend(net.minecraft.network.chat.MutableComponent component, String segment, net.minecraft.network.chat.TextColor lastColour) Attempts to append the segment to theComponent
with the given (nullable) colour- Parameters:
component
- The text componentsegment
- The segmentlastColour
- The colour
-
parseColour
Attempts to parse the colour code firstly as a hex, then as a legacy- Parameters:
colourCode
- The colour code- Returns:
- The potential equivalent colour
-
getByCode
public static net.minecraft.ChatFormatting getByCode(char p_211165_0_) Converts the legacy character to theChatFormatting
type- Parameters:
p_211165_0_
- The character- Returns:
- The relative text formatting
-
format
-
combine
-
format
-
futureTranslate
-
translate
public static net.minecraft.network.chat.Component translate(net.minecraft.ChatFormatting colour, String text, Object... args) Shortcut method for translating text and putting it in a coloured ComponentTranslation. -
translate
-
translate
public static net.minecraft.network.chat.MutableComponent translate(net.minecraft.ChatFormatting colour, String text) -
translate
-
color
public static net.minecraft.network.chat.MutableComponent color(net.minecraft.ChatFormatting colour, String str) -
textWithShowTextHover
-
textWithShowTextHover
public static net.minecraft.network.chat.MutableComponent textWithShowTextHover(String str, net.minecraft.network.chat.Component hover) -
textWithShowTextHover
public static net.minecraft.network.chat.MutableComponent textWithShowTextHover(net.minecraft.network.chat.Component str, String hover) -
textWithShowTextHover
public static net.minecraft.network.chat.MutableComponent textWithShowTextHover(net.minecraft.network.chat.Component text, net.minecraft.network.chat.Component hover) -
join
public static net.minecraft.network.chat.MutableComponent join(List<net.minecraft.network.chat.Component> texts, net.minecraft.network.chat.Component delimiter) -
joinStrings
-
space
public static net.minecraft.network.chat.MutableComponent space(int spaces)
-