Class TooltipLineWrapper
java.lang.Object
johnsmith.enchantmentcore.api.util.TooltipLineWrapper
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 TypeMethodDescriptionstatic List<net.minecraft.network.chat.Component> wrap(net.minecraft.network.chat.Component description, int lineLength) Wraps a textComponentto 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 textComponentto the specified maximum line length, prependingnestingDepthlevels of two-space indentation to each resulting line.
-
Method Details
-
wrap
public static List<net.minecraft.network.chat.Component> wrap(net.minecraft.network.chat.Component description, int lineLength) Wraps a textComponentto the specified maximum line length with no indentation.- Parameters:
description- The source textComponentto wrap.lineLength- The maximum number of characters permitted per line before wrapping.- Returns:
- A list of wrapped line
Components preserving the root component'sStyle.
-
wrap
public static List<net.minecraft.network.chat.Component> wrap(net.minecraft.network.chat.Component description, int lineLength, int nestingDepth) Wraps a textComponentto the specified maximum line length, prependingnestingDepthlevels of two-space indentation to each resulting line.- Parameters:
description- The source textComponentto 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'sStyle.
-