Package net.minecraft.client.font
Class TextRenderer
java.lang.Object
net.minecraft.client.font.TextRenderer
Manages the rendering of text.
The current instance used by the client can be obtained by
MinecraftClient.getInstance().textRenderer
.
- See Also:
- Mappings:
Namespace Name named net/minecraft/client/font/TextRenderer
intermediary net/minecraft/class_327
official fhf
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate class
static enum
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
final int
The font height of the text that is rendered by the text renderer.private final Function
<Identifier, FontStorage> private static final Vector3f
private final TextHandler
final Random
(package private) final boolean
private static final float
-
Constructor Summary
ConstructorDescriptionTextRenderer
(Function<Identifier, FontStorage> fontStorageAccessor, boolean validateAdvance) -
Method Summary
Modifier and TypeMethodDescriptionint
draw
(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) int
draw
(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean rightToLeft) int
draw
(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) int
draw
(Text text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) (package private) void
drawGlyph
(GlyphRenderer glyphRenderer, boolean bold, boolean italic, float weight, float x, float y, Matrix4f matrix, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int light) private int
drawInternal
(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean mirror) private int
drawInternal
(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, TextRenderer.TextLayerType layerType, int backgroundColor, int light) private float
drawLayer
(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, TextRenderer.TextLayerType layerType, int underlineColor, int light) private float
drawLayer
(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, TextRenderer.TextLayerType layerType, int underlineColor, int light) void
drawWithOutline
(OrderedText text, float x, float y, int color, int outlineColor, Matrix4f matrix, VertexConsumerProvider vertexConsumers, int light) (package private) FontStorage
int
Gets the width of some text when rendered.int
getWidth
(OrderedText text) Gets the width of some text when rendered.int
getWidth
(StringVisitable text) Gets the width of some text when rendered.int
getWrappedLinesHeight
(String text, int maxWidth) Gets the height of the text when it has been wrapped.int
getWrappedLinesHeight
(StringVisitable text, int maxWidth) Returns the height of the text, after it has been wrapped, in pixels.boolean
Checks if the currently set language uses right to left writing.trimToWidth
(String text, int maxWidth) Trims a string to be at mostmaxWidth
wide.trimToWidth
(String text, int maxWidth, boolean backwards) Trims a string to be at mostmaxWidth
wide.trimToWidth
(StringVisitable text, int width) Trims a string to be at mostmaxWidth
wide.private static int
tweakTransparency
(int argb) wrapLines
(StringVisitable text, int width) Wraps text when the rendered width of text exceeds thewidth
.
-
Field Details
-
Z_INDEX
private static final float Z_INDEX- See Also:
- Mappings:
Namespace Name Mixin selector named Z_INDEX
Lnet/minecraft/client/font/TextRenderer;Z_INDEX:F
intermediary field_32166
Lnet/minecraft/class_327;field_32166:F
official d
Lfhf;d:F
-
FORWARD_SHIFT
- Mappings:
Namespace Name Mixin selector named FORWARD_SHIFT
Lnet/minecraft/client/font/TextRenderer;FORWARD_SHIFT:Lorg/joml/Vector3f;
intermediary field_24237
Lnet/minecraft/class_327;field_24237:Lorg/joml/Vector3f;
official e
Lfhf;e:Lorg/joml/Vector3f;
-
ARABIC_SHAPING_LETTERS_SHAPE
public static final int ARABIC_SHAPING_LETTERS_SHAPE- See Also:
- Mappings:
Namespace Name Mixin selector named ARABIC_SHAPING_LETTERS_SHAPE
Lnet/minecraft/client/font/TextRenderer;ARABIC_SHAPING_LETTERS_SHAPE:I
intermediary field_35427
Lnet/minecraft/class_327;field_35427:I
official a
Lfhf;a:I
-
fontHeight
public final int fontHeightThe font height of the text that is rendered by the text renderer.- See Also:
- Mappings:
Namespace Name Mixin selector named fontHeight
Lnet/minecraft/client/font/TextRenderer;fontHeight:I
intermediary field_2000
Lnet/minecraft/class_327;field_2000:I
official b
Lfhf;b:I
-
random
- Mappings:
Namespace Name Mixin selector named random
Lnet/minecraft/client/font/TextRenderer;random:Lnet/minecraft/util/math/random/Random;
intermediary field_2001
Lnet/minecraft/class_327;field_2001:Lnet/minecraft/class_5819;
official c
Lfhf;c:Layo;
-
fontStorageAccessor
- Mappings:
Namespace Name Mixin selector named fontStorageAccessor
Lnet/minecraft/client/font/TextRenderer;fontStorageAccessor:Ljava/util/function/Function;
intermediary field_1997
Lnet/minecraft/class_327;field_1997:Ljava/util/function/Function;
official f
Lfhf;f:Ljava/util/function/Function;
-
validateAdvance
final boolean validateAdvance- Mappings:
Namespace Name Mixin selector named validateAdvance
Lnet/minecraft/client/font/TextRenderer;validateAdvance:Z
intermediary field_39925
Lnet/minecraft/class_327;field_39925:Z
official g
Lfhf;g:Z
-
handler
- Mappings:
Namespace Name Mixin selector named handler
Lnet/minecraft/client/font/TextRenderer;handler:Lnet/minecraft/client/font/TextHandler;
intermediary field_24238
Lnet/minecraft/class_327;field_24238:Lnet/minecraft/class_5225;
official h
Lfhf;h:Lfgh;
-
-
Constructor Details
-
TextRenderer
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/client/font/TextRenderer;<init>(Ljava/util/function/Function;Z)V
intermediary <init>
Lnet/minecraft/class_327;<init>(Ljava/util/function/Function;Z)V
official <init>
Lfhf;<init>(Ljava/util/function/Function;Z)V
-
-
Method Details
-
getFontStorage
- Mappings:
Namespace Name Mixin selector named getFontStorage
Lnet/minecraft/client/font/TextRenderer;getFontStorage(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/font/FontStorage;
intermediary method_27526
Lnet/minecraft/class_327;method_27526(Lnet/minecraft/class_2960;)Lnet/minecraft/class_377;
official a
Lfhf;a(Lakk;)Lfkl;
-
mirror
- Mappings:
Namespace Name Mixin selector named mirror
Lnet/minecraft/client/font/TextRenderer;mirror(Ljava/lang/String;)Ljava/lang/String;
intermediary method_1721
Lnet/minecraft/class_327;method_1721(Ljava/lang/String;)Ljava/lang/String;
official a
Lfhf;a(Ljava/lang/String;)Ljava/lang/String;
-
draw
public int draw(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) - Parameters:
color
- the text color in the 0xAARRGGBB format- Mappings:
Namespace Name Mixin selector named draw
Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I
intermediary method_27521
Lnet/minecraft/class_327;method_27521(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;II)I
official a
Lfhf;a(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;II)I
-
draw
public int draw(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean rightToLeft) - Parameters:
color
- the text color in the 0xAARRGGBB format- Mappings:
Namespace Name Mixin selector named draw
Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I
intermediary method_27522
Lnet/minecraft/class_327;method_27522(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;IIZ)I
official a
Lfhf;a(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;IIZ)I
-
draw
public int draw(Text text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) - Parameters:
color
- the text color in the 0xAARRGGBB format- Mappings:
Namespace Name Mixin selector named draw
Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/Text;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I
intermediary method_30882
Lnet/minecraft/class_327;method_30882(Lnet/minecraft/class_2561;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;II)I
official a
Lfhf;a(Lwu;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;II)I
-
draw
public int draw(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) - Parameters:
color
- the text color in the 0xAARRGGBB format- Mappings:
Namespace Name Mixin selector named draw
Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/OrderedText;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I
intermediary method_22942
Lnet/minecraft/class_327;method_22942(Lnet/minecraft/class_5481;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;II)I
official a
Lfhf;a(Laxs;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;II)I
-
drawWithOutline
public void drawWithOutline(OrderedText text, float x, float y, int color, int outlineColor, Matrix4f matrix, VertexConsumerProvider vertexConsumers, int light) - Parameters:
color
- the text color in 0xAARRGGBBoutlineColor
- the outline color in 0xAARRGGBB- Mappings:
Namespace Name Mixin selector named drawWithOutline
Lnet/minecraft/client/font/TextRenderer;drawWithOutline(Lnet/minecraft/text/OrderedText;FFIILorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;I)V
intermediary method_37296
Lnet/minecraft/class_327;method_37296(Lnet/minecraft/class_5481;FFIILorg/joml/Matrix4f;Lnet/minecraft/class_4597;I)V
official a
Lfhf;a(Laxs;FFIILorg/joml/Matrix4f;Lgef;I)V
-
tweakTransparency
private static int tweakTransparency(int argb) - Mappings:
Namespace Name Mixin selector named tweakTransparency
Lnet/minecraft/client/font/TextRenderer;tweakTransparency(I)I
intermediary method_27515
Lnet/minecraft/class_327;method_27515(I)I
official a
Lfhf;a(I)I
-
drawInternal
private int drawInternal(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean mirror) - Mappings:
Namespace Name Mixin selector named drawInternal
Lnet/minecraft/client/font/TextRenderer;drawInternal(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I
intermediary method_27529
Lnet/minecraft/class_327;method_27529(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;IIZ)I
official b
Lfhf;b(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;IIZ)I
-
drawInternal
private int drawInternal(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, TextRenderer.TextLayerType layerType, int backgroundColor, int light) - Mappings:
Namespace Name Mixin selector named drawInternal
Lnet/minecraft/client/font/TextRenderer;drawInternal(Lnet/minecraft/text/OrderedText;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I
intermediary method_1723
Lnet/minecraft/class_327;method_1723(Lnet/minecraft/class_5481;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;II)I
official b
Lfhf;b(Laxs;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;II)I
-
drawLayer
private float drawLayer(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, TextRenderer.TextLayerType layerType, int underlineColor, int light) - Mappings:
Namespace Name Mixin selector named drawLayer
Lnet/minecraft/client/font/TextRenderer;drawLayer(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)F
intermediary method_1724
Lnet/minecraft/class_327;method_1724(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;II)F
official b
Lfhf;b(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;II)F
-
drawLayer
private float drawLayer(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, TextRenderer.TextLayerType layerType, int underlineColor, int light) - Mappings:
Namespace Name Mixin selector named drawLayer
Lnet/minecraft/client/font/TextRenderer;drawLayer(Lnet/minecraft/text/OrderedText;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)F
intermediary method_27530
Lnet/minecraft/class_327;method_27530(Lnet/minecraft/class_5481;FFIZLorg/joml/Matrix4f;Lnet/minecraft/class_4597;Lnet/minecraft/class_327$class_6415;II)F
official c
Lfhf;c(Laxs;FFIZLorg/joml/Matrix4f;Lgef;Lfhf$a;II)F
-
drawGlyph
void drawGlyph(GlyphRenderer glyphRenderer, boolean bold, boolean italic, float weight, float x, float y, Matrix4f matrix, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int light) - Mappings:
Namespace Name Mixin selector named drawGlyph
Lnet/minecraft/client/font/TextRenderer;drawGlyph(Lnet/minecraft/client/font/GlyphRenderer;ZZFFFLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumer;FFFFI)V
intermediary method_1710
Lnet/minecraft/class_327;method_1710(Lnet/minecraft/class_382;ZZFFFLorg/joml/Matrix4f;Lnet/minecraft/class_4588;FFFFI)V
official a
Lfhf;a(Lfkp;ZZFFFLorg/joml/Matrix4f;Lfas;FFFFI)V
-
getWidth
Gets the width of some text when rendered.- Parameters:
text
- the text- Mappings:
Namespace Name Mixin selector named getWidth
Lnet/minecraft/client/font/TextRenderer;getWidth(Ljava/lang/String;)I
intermediary method_1727
Lnet/minecraft/class_327;method_1727(Ljava/lang/String;)I
official b
Lfhf;b(Ljava/lang/String;)I
-
getWidth
Gets the width of some text when rendered.- Parameters:
text
- the text- Mappings:
Namespace Name Mixin selector named getWidth
Lnet/minecraft/client/font/TextRenderer;getWidth(Lnet/minecraft/text/StringVisitable;)I
intermediary method_27525
Lnet/minecraft/class_327;method_27525(Lnet/minecraft/class_5348;)I
official a
Lfhf;a(Lwz;)I
-
getWidth
Gets the width of some text when rendered.- Mappings:
Namespace Name Mixin selector named getWidth
Lnet/minecraft/client/font/TextRenderer;getWidth(Lnet/minecraft/text/OrderedText;)I
intermediary method_30880
Lnet/minecraft/class_327;method_30880(Lnet/minecraft/class_5481;)I
official a
Lfhf;a(Laxs;)I
-
trimToWidth
Trims a string to be at mostmaxWidth
wide.- Returns:
- the trimmed string
- Mappings:
Namespace Name Mixin selector named trimToWidth
Lnet/minecraft/client/font/TextRenderer;trimToWidth(Ljava/lang/String;IZ)Ljava/lang/String;
intermediary method_27524
Lnet/minecraft/class_327;method_27524(Ljava/lang/String;IZ)Ljava/lang/String;
official a
Lfhf;a(Ljava/lang/String;IZ)Ljava/lang/String;
-
trimToWidth
Trims a string to be at mostmaxWidth
wide.- Returns:
- the trimmed string
- See Also:
- Mappings:
Namespace Name Mixin selector named trimToWidth
Lnet/minecraft/client/font/TextRenderer;trimToWidth(Ljava/lang/String;I)Ljava/lang/String;
intermediary method_27523
Lnet/minecraft/class_327;method_27523(Ljava/lang/String;I)Ljava/lang/String;
official a
Lfhf;a(Ljava/lang/String;I)Ljava/lang/String;
-
trimToWidth
Trims a string to be at mostmaxWidth
wide.- Returns:
- the text
- See Also:
- Mappings:
Namespace Name Mixin selector named trimToWidth
Lnet/minecraft/client/font/TextRenderer;trimToWidth(Lnet/minecraft/text/StringVisitable;I)Lnet/minecraft/text/StringVisitable;
intermediary method_1714
Lnet/minecraft/class_327;method_1714(Lnet/minecraft/class_5348;I)Lnet/minecraft/class_5348;
official a
Lfhf;a(Lwz;I)Lwz;
-
getWrappedLinesHeight
Gets the height of the text when it has been wrapped.- Returns:
- the height of the wrapped text
- See Also:
- Mappings:
Namespace Name Mixin selector named getWrappedLinesHeight
Lnet/minecraft/client/font/TextRenderer;getWrappedLinesHeight(Ljava/lang/String;I)I
intermediary method_1713
Lnet/minecraft/class_327;method_1713(Ljava/lang/String;I)I
official b
Lfhf;b(Ljava/lang/String;I)I
-
getWrappedLinesHeight
Returns the height of the text, after it has been wrapped, in pixels.- Returns:
- the height of the text, after it has been wrapped, in pixels
- See Also:
- Mappings:
Namespace Name Mixin selector named getWrappedLinesHeight
Lnet/minecraft/client/font/TextRenderer;getWrappedLinesHeight(Lnet/minecraft/text/StringVisitable;I)I
intermediary method_44378
Lnet/minecraft/class_327;method_44378(Lnet/minecraft/class_5348;I)I
official b
Lfhf;b(Lwz;I)I
-
wrapLines
Wraps text when the rendered width of text exceeds thewidth
.- Returns:
- a list of ordered text which has been wrapped
- Mappings:
Namespace Name Mixin selector named wrapLines
Lnet/minecraft/client/font/TextRenderer;wrapLines(Lnet/minecraft/text/StringVisitable;I)Ljava/util/List;
intermediary method_1728
Lnet/minecraft/class_327;method_1728(Lnet/minecraft/class_5348;I)Ljava/util/List;
official c
Lfhf;c(Lwz;I)Ljava/util/List;
-
isRightToLeft
public boolean isRightToLeft()Checks if the currently set language uses right to left writing.- Mappings:
Namespace Name Mixin selector named isRightToLeft
Lnet/minecraft/client/font/TextRenderer;isRightToLeft()Z
intermediary method_1726
Lnet/minecraft/class_327;method_1726()Z
official a
Lfhf;a()Z
-
getTextHandler
- Mappings:
Namespace Name Mixin selector named getTextHandler
Lnet/minecraft/client/font/TextRenderer;getTextHandler()Lnet/minecraft/client/font/TextHandler;
intermediary method_27527
Lnet/minecraft/class_327;method_27527()Lnet/minecraft/class_5225;
official b
Lfhf;b()Lfgh;
-