Class TextUtils
java.lang.Object
com.portingdeadmods.researchd.utils.TextUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcamelToSnake(String str) static StringcamelToSnake(String str, Predicate<Character> allowed) static intdrawWrappedText(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.network.chat.Component component, int x, int y, int maxWidth, int color, boolean dropShadow) Draws text wrapped to fit within a maximum width.static intdrawWrappedText(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.network.chat.Component component, int x, int y, int maxWidth, int lineSpacing, int color, boolean dropShadow) Draws text wrapped to fit within a maximum width with default line height.static intgetWrappedTextHeight(net.minecraft.network.chat.Component component, int maxWidth) Calculates the height that wrapped text would occupy without rendering it.static intgetWrappedTextHeight(net.minecraft.network.chat.Component component, int maxWidth, int lineSpacing) Calculates the height that wrapped text would occupy without rendering it.static booleanisLetterDigitOrUnderscore(char c) static booleanisValidFloat(String str) static booleanisValidInt(String str) static booleanisValidIntInRange(String str, int min, int max) static booleanisValidIntOrEmpty(String str) static booleanisValidNamespace(String str) static booleanstatic StringtoSnakeCase(String input, it.unimi.dsi.fastutil.chars.CharPredicate validChar) static String
-
Constructor Details
-
TextUtils
public TextUtils()
-
-
Method Details
-
drawWrappedText
public static int drawWrappedText(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.network.chat.Component component, int x, int y, int maxWidth, int color, boolean dropShadow) Draws text wrapped to fit within a maximum width.- Parameters:
guiGraphics- The GuiGraphics contextcomponent- The text component to drawx- X positiony- Y positionmaxWidth- Maximum width before wrappingcolor- Text colordropShadow- Whether to draw with drop shadow- Returns:
- The total height of the rendered text
-
drawWrappedText
public static int drawWrappedText(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.network.chat.Component component, int x, int y, int maxWidth, int lineSpacing, int color, boolean dropShadow) Draws text wrapped to fit within a maximum width with default line height.- Parameters:
guiGraphics- The GuiGraphics contextcomponent- The text component to drawx- X positiony- Y positionmaxWidth- Maximum width before wrappinglineSpacing- Additional spacing between linescolor- Text colordropShadow- Whether to draw with drop shadow- Returns:
- The total height of the rendered text
-
getWrappedTextHeight
public static int getWrappedTextHeight(net.minecraft.network.chat.Component component, int maxWidth) Calculates the height that wrapped text would occupy without rendering it.- Parameters:
component- The text componentmaxWidth- Maximum width before wrapping- Returns:
- The height the text would occupy
-
getWrappedTextHeight
public static int getWrappedTextHeight(net.minecraft.network.chat.Component component, int maxWidth, int lineSpacing) Calculates the height that wrapped text would occupy without rendering it.- Parameters:
component- The text componentmaxWidth- Maximum width before wrappinglineSpacing- Additional spacing between lines- Returns:
- The height the text would occupy
-
camelToSnake
-
camelToSnake
-
isLetterDigitOrUnderscore
public static boolean isLetterDigitOrUnderscore(char c) -
isValidResourceLocation
-
trimSpecialCharacterAndConvertToSnake
-
toSnakeCase
-
isValidNamespace
-
isValidIntOrEmpty
-
isValidInt
-
isValidFloat
-
isValidIntInRange
-