Class ComponentHelper
java.lang.Object
net.ixdarklord.coolcatcore.api.utils.ComponentHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.ComponentlimitComponent(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.ComponenttoComponent(net.minecraft.network.chat.FormattedText formattedText) Converts an instance ofFormattedTextto aComponent.static net.minecraft.network.chat.ComponenttoComponent(net.minecraft.util.FormattedCharSequence formattedCharSequence) Converts an instance ofFormattedCharSequenceto aComponent.static StringtoString(net.minecraft.network.chat.FormattedText formattedText) Converts an instance ofFormattedTextto a string which includes formatting codes supplied via configuredStyles.static StringtoString(net.minecraft.util.FormattedCharSequence formattedCharSequence) Converts an instance ofFormattedCharSequenceto a string which includes formatting codes supplied via configuredStyles.
-
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 ofFormattedTextto aComponent.- 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 ofFormattedCharSequenceto aComponent.- Parameters:
formattedCharSequence- the text to convert- Returns:
- the new component
-
toString
Converts an instance ofFormattedTextto a string which includes formatting codes supplied via configuredStyles.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
Converts an instance ofFormattedCharSequenceto a string which includes formatting codes supplied via configuredStyles.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)
-