Class TooltipLineWrapper

java.lang.Object
johnsmith.enchantmentcore.api.util.TooltipLineWrapper

public final class TooltipLineWrapper extends Object
Utility class for word-wrapping plain or uniformly styled Components into multiple lines based on character count limits and optional indentation depth.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<net.minecraft.network.chat.Component>
    wrap(net.minecraft.network.chat.Component description, int lineLength)
    Wraps a text Component to the specified maximum line length with no indentation.
    static List<net.minecraft.network.chat.Component>
    wrap(net.minecraft.network.chat.Component description, int lineLength, int nestingDepth)
    Wraps a text Component to the specified maximum line length, prepending nestingDepth levels of two-space indentation to each resulting line.

    Methods inherited from class Object

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

    • wrap

      public static List<net.minecraft.network.chat.Component> wrap(net.minecraft.network.chat.Component description, int lineLength)
      Wraps a text Component to the specified maximum line length with no indentation.
      Parameters:
      description - The source text Component to wrap.
      lineLength - The maximum number of characters permitted per line before wrapping.
      Returns:
      A list of wrapped line Components preserving the root component's Style.
    • wrap

      public static List<net.minecraft.network.chat.Component> wrap(net.minecraft.network.chat.Component description, int lineLength, int nestingDepth)
      Wraps a text Component to the specified maximum line length, prepending nestingDepth levels of two-space indentation to each resulting line.
      Parameters:
      description - The source text Component to wrap.
      lineLength - The maximum number of characters permitted per line (excluding indentation).
      nestingDepth - The number of two-space indentation levels prepended to each line.
      Returns:
      A list of wrapped, indented line Components preserving the root component's Style.