Package net.minecraft.client.font
Class TextHandler
java.lang.Object
net.minecraft.client.font.TextHandler
@Environment(CLIENT) public class TextHandler extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTextHandler.LineBreakingVisitor(package private) static classTextHandler.LineWrappingCollectorstatic interfaceTextHandler.LineWrappingConsumerA consumer of the line-breaking information.(package private) static classTextHandler.StyledString(package private) classTextHandler.WidthLimitingVisitorstatic interfaceTextHandler.WidthRetrieverA retriever of character width. -
Field Summary
Fields Modifier and Type Field Description private TextHandler.WidthRetrieverwidthRetriever -
Constructor Summary
Constructors Constructor Description TextHandler(TextHandler.WidthRetriever widthRetriever) -
Method Summary
Modifier and Type Method Description StylegetStyleAt(OrderedText text, int x)Gets the style at thexposition in a text.StylegetStyleAt(StringVisitable text, int x)Gets the style at thexposition in a text.intgetTrimmedLength(String text, int maxWidth, Style style)Returns the length of a string when it is trimmed to be at mostmaxWidthwide.floatgetWidth(String text)Returns the width of a string.floatgetWidth(OrderedText text)floatgetWidth(StringVisitable text)Returns the width of a text.voidmethod_29971(StringVisitable stringVisitable, int int2, Style style, BiConsumer<StringVisitable,Boolean> biConsumer)static intmoveCursorByWords(String text, int offset, int cursor, boolean consumeSpaceOrBreak)StringtrimToWidth(String text, int maxWidth, Style style)Trim a string to be at mostmaxWidthwide.StringVisitabletrimToWidth(StringVisitable text, int width, Style style)StringtrimToWidthBackwards(String text, int maxWidth, Style style)Trim a string from right to left to be at mostmaxWidthwide.List<StringVisitable>wrapLines(String text, int maxWidth, Style style)voidwrapLines(String text, int maxWidth, Style style, boolean retainTrailingWordSplit, TextHandler.LineWrappingConsumer consumer)List<StringVisitable>wrapLines(StringVisitable stringVisitable, int maxWidth, Style style)
-
Field Details
-
widthRetriever
-
-
Constructor Details
-
TextHandler
-
-
Method Details
-
getWidth
Returns the width of a string. -
getWidth
Returns the width of a text. -
getWidth
-
getTrimmedLength
Returns the length of a string when it is trimmed to be at mostmaxWidthwide.- Parameters:
text- the string to trimmaxWidth- the max width of the trimmed stringstyle- the style of the trimmed string
-
trimToWidth
Trim a string to be at mostmaxWidthwide.- Parameters:
text- the string to trimmaxWidth- the max width of the trimmed stringstyle- the style of the trimmed string- Returns:
- the trimmed string
-
trimToWidthBackwards
Trim a string from right to left to be at mostmaxWidthwide.- Parameters:
text- the string to trimmaxWidth- the max width of the trimmed stringstyle- the style of the trimmed string- Returns:
- the trimmed string
-
getStyleAt
Gets the style at thexposition in a text.- Parameters:
x- the position in the text- Returns:
- a style
-
getStyleAt
Gets the style at thexposition in a text.- Parameters:
x- the position in the text- Returns:
- a style
-
trimToWidth
-
moveCursorByWords
public static int moveCursorByWords(String text, int offset, int cursor, boolean consumeSpaceOrBreak) -
wrapLines
public void wrapLines(String text, int maxWidth, Style style, boolean retainTrailingWordSplit, TextHandler.LineWrappingConsumer consumer) -
wrapLines
-
wrapLines
-
method_29971
public void method_29971(StringVisitable stringVisitable, int int2, Style style, BiConsumer<StringVisitable,Boolean> biConsumer)
-