Class TextUtil

java.lang.Object
my.celium.org.util.TextUtil

public final class TextUtil extends Object
Small helpers around Component. Mycel does not rebuild the text system - these just remove qualifier noise.

The palette below is the shared Mycel look and uses only colors from the MyCelium wiki's dark theme (chat is always drawn on a dark backdrop): the page tokens (--accent, --text, --muted) plus the dark code-highlight tokens (.tok-*). No legacy § colors. Legacy helpers (green(String), red(String), gray(String), gold(String)) keep their signatures and render through the matching tone.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Wiki blue (.tok-k) - mod names, config keys.
    static final int
    Wiki --text - body text.
    static final int
    White - names and titles that should stand out from body text.
    static final int
    Wiki red (--accent) - errors.
    static final int
    Wiki comment grey (.tok-c) - brackets, bullets, dividers.
    static final int
    Wiki purple (.tok-n) - values, commands.
    static final int
    Wiki --muted - secondary text.
    static final int
    Wiki red (--accent) - brand, headers.
    static final int
    Wiki green (.tok-s) - success.
    static final int
    Wiki orange (.tok-a) - warnings / gold.
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.network.chat.MutableComponent
    accent(String text)
     
    static net.minecraft.network.chat.MutableComponent
    body(String text)
     
    static net.minecraft.network.chat.MutableComponent
    Warning line: orange bang + message.
    static net.minecraft.network.chat.MutableComponent
    colored(net.minecraft.network.chat.Component text, net.minecraft.ChatFormatting formatting)
    Deprecated.
    use the tone helpers (success(String), ...) or coloredHex(Component, int)
    static net.minecraft.network.chat.MutableComponent
    coloredHex(net.minecraft.network.chat.Component text, int rgb)
    Applies a raw RGB color (0xRRGGBB) to a copy of text.
    static net.minecraft.network.chat.MutableComponent
    detail(String text)
    Indented continuation line (descriptions, hints) under an item(Component).
    static net.minecraft.network.chat.MutableComponent
    Faint divider used between sections.
    static net.minecraft.network.chat.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    error(String text)
     
    static net.minecraft.network.chat.MutableComponent
    fail(String text)
    Error line: red cross + message.
    static net.minecraft.network.chat.MutableComponent
    faint(String text)
     
    static net.minecraft.network.chat.MutableComponent
    gold(String text)
     
    static net.minecraft.network.chat.MutableComponent
    gray(String text)
     
    static net.minecraft.network.chat.MutableComponent
    green(String text)
     
    static net.minecraft.network.chat.MutableComponent
    header(String title)
    Header line opening a multi-line reply: tag + bright title.
    static net.minecraft.network.chat.MutableComponent
    header(String title, String detail)
    Header line with a muted suffix, e.g.
    static net.minecraft.network.chat.MutableComponent
    hex(String text, int rgb)
    Hex-colored literal from a raw RGB int (0xRRGGBB).
    static net.minecraft.network.chat.MutableComponent
    hex(String text, String hexCode)
    Hex-colored literal, e.g.
    static net.minecraft.network.chat.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    item(net.minecraft.network.chat.Component content)
    Indented row under a header(String): faint bullet + content, no tag.
    static net.minecraft.network.chat.MutableComponent
    join(String separator, Collection<? extends net.minecraft.network.chat.Component> parts)
    Joins components with a literal separator.
    static net.minecraft.network.chat.MutableComponent
    keyValue(String key, String value)
    key: value pair with accent key and bright value.
    static net.minecraft.network.chat.MutableComponent
    keyValue(String key, net.minecraft.network.chat.Component value)
    key: value pair with a pre-built value component.
    static net.minecraft.network.chat.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    msg(Object... parts)
    A message from parts: strings become body text, components are appended as they are.
    static net.minecraft.network.chat.MutableComponent
    muted(String text)
     
    static net.minecraft.network.chat.MutableComponent
    note(String text)
    Info line: plain message after the tag.
    static net.minecraft.network.chat.MutableComponent
    ok(String text)
    Success line: green check + message.
    static int
    parseHex(String hexCode)
    Parses "#RRGGBB" or "RRGGBB" into 0xRRGGBB.
    static String
    plain(net.minecraft.network.chat.Component component)
    Plain (unformatted) string content.
    static net.minecraft.network.chat.MutableComponent
    Mycel › tag: bold wiki-red brand + faint chevron.
    static net.minecraft.network.chat.MutableComponent
    prefixed(net.minecraft.network.chat.Component message)
    Prepends the Mycel › tag to message.
    static net.minecraft.network.chat.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    red(String text)
     
    static net.minecraft.network.chat.MutableComponent
     
    static int
    tone(net.minecraft.ChatFormatting legacy)
    Wiki tone standing in for a legacy ChatFormatting color, or -1 for decorations (bold, italic, ...) and reset.
    static net.minecraft.network.chat.MutableComponent
    translatable(String key, Object... args)
     
    static ChatVoice
    Message kit tagged with tag, e.g.
    static net.minecraft.network.chat.MutableComponent
    warn(String text)
     

    Methods inherited from class Object

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

    • PRIMARY

      public static final int PRIMARY
      Wiki red (--accent) - brand, headers.
      See Also:
    • ACCENT

      public static final int ACCENT
      Wiki blue (.tok-k) - mod names, config keys.
      See Also:
    • SUCCESS

      public static final int SUCCESS
      Wiki green (.tok-s) - success.
      See Also:
    • ERROR

      public static final int ERROR
      Wiki red (--accent) - errors. Always paired with a cross so it never reads as the brand.
      See Also:
    • WARN

      public static final int WARN
      Wiki orange (.tok-a) - warnings / gold.
      See Also:
    • INFO

      public static final int INFO
      Wiki purple (.tok-n) - values, commands.
      See Also:
    • MUTED

      public static final int MUTED
      Wiki --muted - secondary text.
      See Also:
    • FAINT

      public static final int FAINT
      Wiki comment grey (.tok-c) - brackets, bullets, dividers.
      See Also:
    • BODY

      public static final int BODY
      Wiki --text - body text.
      See Also:
    • BRIGHT

      public static final int BRIGHT
      White - names and titles that should stand out from body text.
      See Also:
  • Method Details

    • literal

      public static net.minecraft.network.chat.MutableComponent literal(String text)
    • translatable

      public static net.minecraft.network.chat.MutableComponent translatable(String key, Object... args)
    • empty

      public static net.minecraft.network.chat.MutableComponent empty()
    • colored

      @Deprecated public static net.minecraft.network.chat.MutableComponent colored(net.minecraft.network.chat.Component text, net.minecraft.ChatFormatting formatting)
      Deprecated.
      use the tone helpers (success(String), ...) or coloredHex(Component, int)
      Applies formatting to a copy of text. Legacy colors are swapped for the nearest wiki tone, so old callers never show § colors; bold, italic and the other decorations pass through unchanged.
    • tone

      public static int tone(net.minecraft.ChatFormatting legacy)
      Wiki tone standing in for a legacy ChatFormatting color, or -1 for decorations (bold, italic, ...) and reset.
    • coloredHex

      public static net.minecraft.network.chat.MutableComponent coloredHex(net.minecraft.network.chat.Component text, int rgb)
      Applies a raw RGB color (0xRRGGBB) to a copy of text.
    • parseHex

      public static int parseHex(String hexCode)
      Parses "#RRGGBB" or "RRGGBB" into 0xRRGGBB.
      Throws:
      IllegalArgumentException - when the text is not a hex color
    • hex

      public static net.minecraft.network.chat.MutableComponent hex(String text, String hexCode)
      Hex-colored literal, e.g. hex("hi", "#EF5350").
    • hex

      public static net.minecraft.network.chat.MutableComponent hex(String text, int rgb)
      Hex-colored literal from a raw RGB int (0xRRGGBB).
    • primary

      public static net.minecraft.network.chat.MutableComponent primary(String text)
    • accent

      public static net.minecraft.network.chat.MutableComponent accent(String text)
    • success

      public static net.minecraft.network.chat.MutableComponent success(String text)
    • error

      public static net.minecraft.network.chat.MutableComponent error(String text)
    • warn

      public static net.minecraft.network.chat.MutableComponent warn(String text)
    • infoText

      public static net.minecraft.network.chat.MutableComponent infoText(String text)
    • muted

      public static net.minecraft.network.chat.MutableComponent muted(String text)
    • faint

      public static net.minecraft.network.chat.MutableComponent faint(String text)
    • body

      public static net.minecraft.network.chat.MutableComponent body(String text)
    • green

      public static net.minecraft.network.chat.MutableComponent green(String text)
    • red

      public static net.minecraft.network.chat.MutableComponent red(String text)
    • gray

      public static net.minecraft.network.chat.MutableComponent gray(String text)
    • gold

      public static net.minecraft.network.chat.MutableComponent gold(String text)
    • voice

      public static ChatVoice voice(String tag)
      Message kit tagged with tag, e.g. voice("Pets").ok(name, " came running.").
    • msg

      public static net.minecraft.network.chat.MutableComponent msg(Object... parts)
      A message from parts: strings become body text, components are appended as they are. msg(name, " came running.")
    • prefix

      public static net.minecraft.network.chat.MutableComponent prefix()
      Mycel › tag: bold wiki-red brand + faint chevron.
    • prefixed

      public static net.minecraft.network.chat.MutableComponent prefixed(net.minecraft.network.chat.Component message)
      Prepends the Mycel › tag to message.
    • ok

      public static net.minecraft.network.chat.MutableComponent ok(String text)
      Success line: green check + message.
    • fail

      public static net.minecraft.network.chat.MutableComponent fail(String text)
      Error line: red cross + message.
    • note

      public static net.minecraft.network.chat.MutableComponent note(String text)
      Info line: plain message after the tag.
    • caution

      public static net.minecraft.network.chat.MutableComponent caution(String text)
      Warning line: orange bang + message.
    • header

      public static net.minecraft.network.chat.MutableComponent header(String title)
      Header line opening a multi-line reply: tag + bright title.
    • header

      public static net.minecraft.network.chat.MutableComponent header(String title, String detail)
      Header line with a muted suffix, e.g. header("Mods", "3").
    • item

      public static net.minecraft.network.chat.MutableComponent item(net.minecraft.network.chat.Component content)
      Indented row under a header(String): faint bullet + content, no tag.
    • detail

      public static net.minecraft.network.chat.MutableComponent detail(String text)
      Indented continuation line (descriptions, hints) under an item(Component).
    • divider

      public static net.minecraft.network.chat.MutableComponent divider()
      Faint divider used between sections.
    • keyValue

      public static net.minecraft.network.chat.MutableComponent keyValue(String key, String value)
      key: value pair with accent key and bright value.
    • keyValue

      public static net.minecraft.network.chat.MutableComponent keyValue(String key, net.minecraft.network.chat.Component value)
      key: value pair with a pre-built value component.
    • join

      public static net.minecraft.network.chat.MutableComponent join(String separator, Collection<? extends net.minecraft.network.chat.Component> parts)
      Joins components with a literal separator.
    • plain

      public static String plain(net.minecraft.network.chat.Component component)
      Plain (unformatted) string content.