Class TextUtils
java.lang.Object
meteordevelopment.meteorclient.utils.misc.text.TextUtils
Some utilities for
Component-
Method Summary
Modifier and TypeMethodDescriptionstatic it.unimi.dsi.fastutil.objects.Object2IntMap<Color> getColoredCharacterCount(List<ColoredText> coloredTexts) Takes aListofColoredTextand returns aHashMap, where the keys are all the existingColors in the aforementioned list, and the corresponding keys are the number of characters that have that color.static ColorgetMostPopularColor(net.minecraft.network.chat.Component text) Returns theColorthat is most prevalent through the givenComponentstatic net.minecraft.network.chat.MutableComponentparseOrderedText(net.minecraft.util.FormattedCharSequence orderedText) Parses a givenFormattedCharSequenceinto itsComponentequivalent.static List<ColoredText> toColoredTextList(net.minecraft.network.chat.Component text)
-
Method Details
-
toColoredTextList
-
parseOrderedText
public static net.minecraft.network.chat.MutableComponent parseOrderedText(net.minecraft.util.FormattedCharSequence orderedText) Parses a givenFormattedCharSequenceinto itsComponentequivalent.- Parameters:
orderedText- theFormattedCharSequenceto parse.- Returns:
- The
Componentequivalent of theFormattedCharSequenceparameter.
-
getMostPopularColor
Returns theColorthat is most prevalent through the givenComponent- Parameters:
text- theComponentto scan through- Returns:
- You know what it returns. Read the docs! Also, returns white if the internal
Object2IntMap.Entryis null
-
getColoredCharacterCount
public static it.unimi.dsi.fastutil.objects.Object2IntMap<Color> getColoredCharacterCount(List<ColoredText> coloredTexts) Takes aListofColoredTextand returns aHashMap, where the keys are all the existingColors in the aforementioned list, and the corresponding keys are the number of characters that have that color.- Parameters:
coloredTexts- The list ofColoredTextto obtain the color count of. Best paired with the output fromtoColoredTextList(Component)- Returns:
- a
Mapwhose 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 fromtoColoredTextList(Component)), and the corresponding values beingIntegers representing the number of occurrences of text that bear that color. The order of the keys are in no particular order
-