Class TextUtils

java.lang.Object
meteordevelopment.meteorclient.utils.misc.text.TextUtils

public class TextUtils extends Object
Some utilities for Component
  • Method Details

    • toColoredTextList

      public static List<ColoredText> toColoredTextList(net.minecraft.network.chat.Component text)
    • parseOrderedText

      public static net.minecraft.network.chat.MutableComponent parseOrderedText(net.minecraft.util.FormattedCharSequence orderedText)
      Parses a given FormattedCharSequence into its Component equivalent.
      Parameters:
      orderedText - the FormattedCharSequence to parse.
      Returns:
      The Component equivalent of the FormattedCharSequence parameter.
    • getMostPopularColor

      public static Color getMostPopularColor(net.minecraft.network.chat.Component text)
      Returns the Color that is most prevalent through the given Component
      Parameters:
      text - the Component to scan through
      Returns:
      You know what it returns. Read the docs! Also, returns white if the internal Object2IntMap.Entry is null
    • getColoredCharacterCount

      public static it.unimi.dsi.fastutil.objects.Object2IntMap<Color> getColoredCharacterCount(List<ColoredText> coloredTexts)
      Takes a List of ColoredText and returns a HashMap, where the keys are all the existing Colors in the aforementioned list, and the corresponding keys are the number of characters that have that color.
      Parameters:
      coloredTexts - The list of ColoredText to obtain the color count of. Best paired with the output from toColoredTextList(Component)
      Returns:
      a Map whose keys are colors (and the set of keys being all possible colors used in the list, thus all colors in the text, if the argument for this function is fed from the return from toColoredTextList(Component)), and the corresponding values being Integers representing the number of occurrences of text that bear that color. The order of the keys are in no particular order