Class ComponentHelper

java.lang.Object
net.ixdarklord.coolcatcore.api.utils.ComponentHelper

public final class ComponentHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.network.chat.Component
    limitComponent(net.minecraft.network.chat.Component component, int maxWidth)
     
    static List<net.minecraft.network.chat.Component>
    splitComponent(net.minecraft.network.chat.Component component, int maxWidth)
     
    static net.minecraft.network.chat.Component
    toComponent(net.minecraft.network.chat.FormattedText formattedText)
    Converts an instance of FormattedText to a Component.
    static net.minecraft.network.chat.Component
    toComponent(net.minecraft.util.FormattedCharSequence formattedCharSequence)
    Converts an instance of FormattedCharSequence to a Component.
    static String
    toString(net.minecraft.network.chat.FormattedText formattedText)
    Converts an instance of FormattedText to a string which includes formatting codes supplied via configured Styles.
    static String
    toString(net.minecraft.util.FormattedCharSequence formattedCharSequence)
    Converts an instance of FormattedCharSequence to a string which includes formatting codes supplied via configured Styles.

    Methods inherited from class java.lang.Object

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

    • ComponentHelper

      public ComponentHelper()
  • Method Details

    • toComponent

      public static net.minecraft.network.chat.Component toComponent(net.minecraft.network.chat.FormattedText formattedText)
      Converts an instance of FormattedText to a Component.
      Parameters:
      formattedText - the text to convert
      Returns:
      the new component
    • toComponent

      public static net.minecraft.network.chat.Component toComponent(net.minecraft.util.FormattedCharSequence formattedCharSequence)
      Converts an instance of FormattedCharSequence to a Component.
      Parameters:
      formattedCharSequence - the text to convert
      Returns:
      the new component
    • toString

      public static String toString(net.minecraft.network.chat.FormattedText formattedText)
      Converts an instance of FormattedText to a string which includes formatting codes supplied via configured Styles.

      This is mostly useful when working with instances where vanilla still renders raw strings, which inherently support the old chat formatting system, such as in DebugScreenOverlay.

      Parameters:
      formattedText - the text to convert
      Returns:
      the string
    • toString

      public static String toString(net.minecraft.util.FormattedCharSequence formattedCharSequence)
      Converts an instance of FormattedCharSequence to a string which includes formatting codes supplied via configured Styles.

      This is mostly useful when working with instances where vanilla still renders raw strings, which inherently support the old chat formatting system, such as in DebugScreenOverlay.

      Parameters:
      formattedCharSequence - the text to convert
      Returns:
      the string
    • limitComponent

      public static net.minecraft.network.chat.Component limitComponent(net.minecraft.network.chat.Component component, int maxWidth)
    • splitComponent

      public static List<net.minecraft.network.chat.Component> splitComponent(net.minecraft.network.chat.Component component, int maxWidth)