public class TextHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static net.minecraft.util.text.IFormattableTextComponent |
AND_DELIMITER |
static java.util.List<java.lang.String> |
DENY_CHARS |
static java.util.regex.Pattern |
DENY_PATTERN |
static int |
NAME_MAX_LENGTH |
static net.minecraft.util.text.IFormattableTextComponent |
OR_DELIMITER |
Constructor and Description |
---|
TextHelper() |
Modifier and Type | Method and Description |
---|---|
static net.minecraft.util.text.IFormattableTextComponent |
attemptAppend(net.minecraft.util.text.IFormattableTextComponent textComponent,
java.lang.String segment,
net.minecraft.util.text.Color lastColour)
Attempts to append the segment to the
TextComponent with the given (nullable) colour |
static net.minecraft.util.text.IFormattableTextComponent |
color(net.minecraft.util.text.TextFormatting colour,
java.lang.String str) |
static net.minecraft.util.text.ITextComponent |
colour(java.lang.String text)
Parses the string to a
ITextComponent with the correctly formatted colour codes and hex codes |
static net.minecraft.util.text.ITextComponent |
combine(java.lang.Object... components) |
static java.lang.String |
format(java.lang.String line) |
static net.minecraft.util.text.ITextComponent |
format(java.lang.String in,
java.lang.Object... args) |
static net.minecraft.util.text.TextFormatting |
getByCode(char p_211165_0_)
Converts the legacy character to the
TextFormatting type |
static net.minecraft.util.text.IFormattableTextComponent |
join(java.util.List<net.minecraft.util.text.ITextComponent> texts,
net.minecraft.util.text.ITextComponent delimiter) |
static net.minecraft.util.text.IFormattableTextComponent |
joinStrings(java.util.List<java.lang.String> texts,
net.minecraft.util.text.IFormattableTextComponent delimiter) |
static java.util.Optional<net.minecraft.util.text.Color> |
parseColour(java.lang.String colourCode)
Attempts to parse the colour code firstly as a hex, then as a legacy
|
static net.minecraft.util.text.IFormattableTextComponent |
space(int spaces) |
static net.minecraft.util.text.IFormattableTextComponent |
textWithShowTextHover(net.minecraft.util.text.IFormattableTextComponent text,
net.minecraft.util.text.IFormattableTextComponent hover) |
static net.minecraft.util.text.IFormattableTextComponent |
textWithShowTextHover(net.minecraft.util.text.IFormattableTextComponent str,
java.lang.String hover) |
static net.minecraft.util.text.IFormattableTextComponent |
textWithShowTextHover(java.lang.String str,
net.minecraft.util.text.IFormattableTextComponent hover) |
static net.minecraft.util.text.IFormattableTextComponent |
textWithShowTextHover(java.lang.String str,
java.lang.String hover) |
static net.minecraft.util.text.TranslationTextComponent |
translate(java.lang.String text) |
static net.minecraft.util.text.IFormattableTextComponent |
translate(java.lang.String text,
java.lang.Object... args) |
static net.minecraft.util.text.IFormattableTextComponent |
translate(net.minecraft.util.text.TextFormatting colour,
java.lang.String text) |
static net.minecraft.util.text.IFormattableTextComponent |
translate(net.minecraft.util.text.TextFormatting colour,
java.lang.String text,
java.lang.Object... args)
Shortcut method for translating text and putting it in a coloured TextComponentTranslation.
|
public static final java.util.List<java.lang.String> DENY_CHARS
public static final java.util.regex.Pattern DENY_PATTERN
public static final int NAME_MAX_LENGTH
public static final net.minecraft.util.text.IFormattableTextComponent OR_DELIMITER
public static final net.minecraft.util.text.IFormattableTextComponent AND_DELIMITER
public static net.minecraft.util.text.ITextComponent colour(java.lang.String text)
ITextComponent
with the correctly formatted colour codes and hex codestext
- The unformatted textpublic static net.minecraft.util.text.IFormattableTextComponent attemptAppend(net.minecraft.util.text.IFormattableTextComponent textComponent, java.lang.String segment, net.minecraft.util.text.Color lastColour)
TextComponent
with the given (nullable) colourtextComponent
- The text componentsegment
- The segmentlastColour
- The colourpublic static java.util.Optional<net.minecraft.util.text.Color> parseColour(java.lang.String colourCode)
colourCode
- The colour codepublic static net.minecraft.util.text.TextFormatting getByCode(char p_211165_0_)
TextFormatting
typep_211165_0_
- The characterpublic static net.minecraft.util.text.ITextComponent format(java.lang.String in, java.lang.Object... args)
public static net.minecraft.util.text.ITextComponent combine(java.lang.Object... components)
public static java.lang.String format(java.lang.String line)
public static net.minecraft.util.text.IFormattableTextComponent translate(net.minecraft.util.text.TextFormatting colour, java.lang.String text, java.lang.Object... args)
public static net.minecraft.util.text.IFormattableTextComponent translate(java.lang.String text, java.lang.Object... args)
public static net.minecraft.util.text.IFormattableTextComponent translate(net.minecraft.util.text.TextFormatting colour, java.lang.String text)
public static net.minecraft.util.text.TranslationTextComponent translate(java.lang.String text)
public static net.minecraft.util.text.IFormattableTextComponent color(net.minecraft.util.text.TextFormatting colour, java.lang.String str)
public static net.minecraft.util.text.IFormattableTextComponent textWithShowTextHover(java.lang.String str, java.lang.String hover)
public static net.minecraft.util.text.IFormattableTextComponent textWithShowTextHover(java.lang.String str, net.minecraft.util.text.IFormattableTextComponent hover)
public static net.minecraft.util.text.IFormattableTextComponent textWithShowTextHover(net.minecraft.util.text.IFormattableTextComponent str, java.lang.String hover)
public static net.minecraft.util.text.IFormattableTextComponent textWithShowTextHover(net.minecraft.util.text.IFormattableTextComponent text, net.minecraft.util.text.IFormattableTextComponent hover)
public static net.minecraft.util.text.IFormattableTextComponent join(java.util.List<net.minecraft.util.text.ITextComponent> texts, net.minecraft.util.text.ITextComponent delimiter)
public static net.minecraft.util.text.IFormattableTextComponent joinStrings(java.util.List<java.lang.String> texts, net.minecraft.util.text.IFormattableTextComponent delimiter)
public static net.minecraft.util.text.IFormattableTextComponent space(int spaces)