Class TextUtils

java.lang.Object
com.portingdeadmods.researchd.utils.TextUtils

public final class TextUtils extends Object
  • 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 context
      component - The text component to draw
      x - X position
      y - Y position
      maxWidth - Maximum width before wrapping
      color - Text color
      dropShadow - 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 context
      component - The text component to draw
      x - X position
      y - Y position
      maxWidth - Maximum width before wrapping
      lineSpacing - Additional spacing between lines
      color - Text color
      dropShadow - 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 component
      maxWidth - 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 component
      maxWidth - Maximum width before wrapping
      lineSpacing - Additional spacing between lines
      Returns:
      The height the text would occupy
    • camelToSnake

      public static String camelToSnake(String str)
    • camelToSnake

      public static String camelToSnake(String str, Predicate<Character> allowed)
    • isLetterDigitOrUnderscore

      public static boolean isLetterDigitOrUnderscore(char c)
    • isValidResourceLocation

      public static boolean isValidResourceLocation(String s)
    • trimSpecialCharacterAndConvertToSnake

      public static String trimSpecialCharacterAndConvertToSnake(String input)
    • toSnakeCase

      public static String toSnakeCase(String input, it.unimi.dsi.fastutil.chars.CharPredicate validChar)
    • isValidNamespace

      public static boolean isValidNamespace(String str)
    • isValidIntOrEmpty

      public static boolean isValidIntOrEmpty(String str)
    • isValidInt

      public static boolean isValidInt(String str)
    • isValidFloat

      public static boolean isValidFloat(String str)
    • isValidIntInRange

      public static boolean isValidIntInRange(String str, int min, int max)