Class TextHelper
java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.TextHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.network.chat.Componentstatic final Patternstatic final intstatic final net.minecraft.network.chat.Component -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.MutableComponentattemptAppend(net.minecraft.network.chat.MutableComponent component, String segment, net.minecraft.network.chat.TextColor lastColour) Attempts to append the segment to theComponentwith the given (nullable) colourstatic net.minecraft.network.chat.MutableComponentstatic net.minecraft.network.chat.ComponentParses the string to aComponentwith the correctly formatted colour codes and hex codesstatic net.minecraft.network.chat.Componentstatic Stringstatic net.minecraft.network.chat.Componentstatic Supplier<net.minecraft.network.chat.Component>futureTranslate(net.minecraft.ChatFormatting colour, String text, Object... args) static net.minecraft.ChatFormattinggetByCode(char p_211165_0_) Converts the legacy character to theChatFormattingtypestatic net.minecraft.network.chat.MutableComponentjoin(List<net.minecraft.network.chat.Component> texts, net.minecraft.network.chat.Component delimiter) static net.minecraft.network.chat.MutableComponentjoinStrings(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.MutableComponentspace(int spaces) static net.minecraft.network.chat.MutableComponenttextWithShowTextHover(String str, String hover) static net.minecraft.network.chat.MutableComponenttextWithShowTextHover(String str, net.minecraft.network.chat.Component hover) static net.minecraft.network.chat.MutableComponenttextWithShowTextHover(net.minecraft.network.chat.Component str, String hover) static net.minecraft.network.chat.MutableComponenttextWithShowTextHover(net.minecraft.network.chat.Component text, net.minecraft.network.chat.Component hover) static StringtoRoman(int number) static net.minecraft.network.chat.MutableComponentstatic net.minecraft.network.chat.MutableComponentstatic net.minecraft.network.chat.MutableComponentstatic net.minecraft.network.chat.ComponentShortcut 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 aComponentwith 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 theComponentwith 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 theChatFormattingtype- 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)
-