Class TextHelper

java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.TextHelper

public class TextHelper extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.network.chat.Component
     
    static final List<String>
     
    static final Pattern
     
    static final int
     
    static final net.minecraft.network.chat.Component
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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 the Component with the given (nullable) colour
    static net.minecraft.network.chat.MutableComponent
    color(net.minecraft.ChatFormatting colour, String str)
     
    static net.minecraft.network.chat.Component
    colour(String text)
    Parses the string to a Component with the correctly formatted colour codes and hex codes
    static net.minecraft.network.chat.Component
    combine(Object... components)
     
    static String
    format(String line)
     
    static net.minecraft.network.chat.Component
    format(String in, Object... args)
     
    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 the ChatFormatting type
    static 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 legacy
    static net.minecraft.network.chat.MutableComponent
    space(int spaces)
     
    static net.minecraft.network.chat.MutableComponent
     
    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
    translate(String text, Object... args)
     
    static net.minecraft.network.chat.MutableComponent
    translate(net.minecraft.ChatFormatting colour, String text)
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DENY_CHARS

      public static final List<String> DENY_CHARS
    • DENY_PATTERN

      public static final Pattern 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

      public static String toRoman(int number)
    • colour

      public static net.minecraft.network.chat.Component colour(String text)
      Parses the string to a Component 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 the Component with the given (nullable) colour
      Parameters:
      component - The text component
      segment - The segment
      lastColour - The colour
    • parseColour

      public static Optional<net.minecraft.network.chat.TextColor> parseColour(String colourCode)
      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 the ChatFormatting type
      Parameters:
      p_211165_0_ - The character
      Returns:
      The relative text formatting
    • format

      public static net.minecraft.network.chat.Component format(String in, Object... args)
    • combine

      public static net.minecraft.network.chat.Component combine(Object... components)
    • format

      public static String format(String line)
    • futureTranslate

      public static Supplier<net.minecraft.network.chat.Component> futureTranslate(net.minecraft.ChatFormatting colour, String text, Object... args)
    • 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

      public static net.minecraft.network.chat.MutableComponent translate(String text, Object... args)
    • translate

      public static net.minecraft.network.chat.MutableComponent translate(net.minecraft.ChatFormatting colour, String text)
    • translate

      public static net.minecraft.network.chat.MutableComponent translate(String text)
    • color

      public static net.minecraft.network.chat.MutableComponent color(net.minecraft.ChatFormatting colour, String str)
    • textWithShowTextHover

      public static net.minecraft.network.chat.MutableComponent textWithShowTextHover(String str, String hover)
    • 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

      public static net.minecraft.network.chat.MutableComponent joinStrings(List<String> texts, net.minecraft.network.chat.Component delimiter)
    • space

      public static net.minecraft.network.chat.MutableComponent space(int spaces)