Class TextRenderer

java.lang.Object
net.minecraft.client.font.TextRenderer

@Environment(CLIENT)
public class TextRenderer
extends Object
Manages the rendering of text.
Mappings:
Namespace Name
official drf
intermediary net/minecraft/class_327
named net/minecraft/client/font/TextRenderer
  • Field Details

    • FORWARD_SHIFT

      private static final Vec3f FORWARD_SHIFT
      Mappings:
      Namespace Name Mixin selector
      official c Ldrf;c:Lg;
      intermediary field_24237 Lnet/minecraft/class_327;field_24237:Lnet/minecraft/class_1160;
      named FORWARD_SHIFT Lnet/minecraft/client/font/TextRenderer;FORWARD_SHIFT:Lnet/minecraft/util/math/Vec3f;
    • fontHeight

      public final int fontHeight
      The font height of the text that is rendered by the text renderer.
      See Also:
      Constant Field Values
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a:I
      intermediary field_2000 Lnet/minecraft/class_327;field_2000:I
      named fontHeight Lnet/minecraft/client/font/TextRenderer;fontHeight:I
    • random

      public final Random random
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b:Ljava/util/Random;
      intermediary field_2001 Lnet/minecraft/class_327;field_2001:Ljava/util/Random;
      named random Lnet/minecraft/client/font/TextRenderer;random:Ljava/util/Random;
    • fontStorageAccessor

      private final Function<Identifier,​FontStorage> fontStorageAccessor
      Mappings:
      Namespace Name Mixin selector
      official d Ldrf;d:Ljava/util/function/Function;
      intermediary field_1997 Lnet/minecraft/class_327;field_1997:Ljava/util/function/Function;
      named fontStorageAccessor Lnet/minecraft/client/font/TextRenderer;fontStorageAccessor:Ljava/util/function/Function;
    • handler

      private final TextHandler handler
      Mappings:
      Namespace Name Mixin selector
      official e Ldrf;e:Ldqu;
      intermediary field_24238 Lnet/minecraft/class_327;field_24238:Lnet/minecraft/class_5225;
      named handler Lnet/minecraft/client/font/TextRenderer;handler:Lnet/minecraft/client/font/TextHandler;
  • Constructor Details

    • TextRenderer

      public TextRenderer​(Function<Identifier,​FontStorage> fontStorageAccessor)
      Mappings:
      Namespace Name Mixin selector
      official <init> Ldrf;<init>(Ljava/util/function/Function;)V
      intermediary <init> Lnet/minecraft/class_327;<init>(Ljava/util/function/Function;)V
      named <init> Lnet/minecraft/client/font/TextRenderer;<init>(Ljava/util/function/Function;)V
  • Method Details

    • getFontStorage

      private FontStorage getFontStorage​(Identifier id)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lwb;)Ldth;
      intermediary method_27526 Lnet/minecraft/class_327;method_27526(Lnet/minecraft/class_2960;)Lnet/minecraft/class_377;
      named getFontStorage Lnet/minecraft/client/font/TextRenderer;getFontStorage(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/font/FontStorage;
    • drawWithShadow

      public int drawWithShadow​(MatrixStack matrices, String text, float x, float y, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ldlr;Ljava/lang/String;FFI)I
      intermediary method_1720 Lnet/minecraft/class_327;method_1720(Lnet/minecraft/class_4587;Ljava/lang/String;FFI)I
      named drawWithShadow Lnet/minecraft/client/font/TextRenderer;drawWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFI)I
    • drawWithShadow

      public int drawWithShadow​(MatrixStack matrices, String text, float x, float y, int color, boolean rightToLeft)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ldlr;Ljava/lang/String;FFIZ)I
      intermediary method_29342 Lnet/minecraft/class_327;method_29342(Lnet/minecraft/class_4587;Ljava/lang/String;FFIZ)I
      named drawWithShadow Lnet/minecraft/client/font/TextRenderer;drawWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFIZ)I
    • draw

      public int draw​(MatrixStack matrices, String text, float x, float y, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ldlr;Ljava/lang/String;FFI)I
      intermediary method_1729 Lnet/minecraft/class_327;method_1729(Lnet/minecraft/class_4587;Ljava/lang/String;FFI)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFI)I
    • drawWithShadow

      public int drawWithShadow​(MatrixStack matrices, OrderedText text, float x, float y, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ldlr;Lafs;FFI)I
      intermediary method_27517 Lnet/minecraft/class_327;method_27517(Lnet/minecraft/class_4587;Lnet/minecraft/class_5481;FFI)I
      named drawWithShadow Lnet/minecraft/client/font/TextRenderer;drawWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/OrderedText;FFI)I
    • drawWithShadow

      public int drawWithShadow​(MatrixStack matrices, Text text, float x, float y, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ldlr;Loi;FFI)I
      intermediary method_30881 Lnet/minecraft/class_327;method_30881(Lnet/minecraft/class_4587;Lnet/minecraft/class_2561;FFI)I
      named drawWithShadow Lnet/minecraft/client/font/TextRenderer;drawWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/Text;FFI)I
    • draw

      public int draw​(MatrixStack matrices, OrderedText text, float x, float y, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ldlr;Lafs;FFI)I
      intermediary method_27528 Lnet/minecraft/class_327;method_27528(Lnet/minecraft/class_4587;Lnet/minecraft/class_5481;FFI)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/OrderedText;FFI)I
    • draw

      public int draw​(MatrixStack matrices, Text text, float x, float y, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ldlr;Loi;FFI)I
      intermediary method_30883 Lnet/minecraft/class_327;method_30883(Lnet/minecraft/class_4587;Lnet/minecraft/class_2561;FFI)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/Text;FFI)I
    • mirror

      public String mirror​(String text)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ljava/lang/String;)Ljava/lang/String;
      intermediary method_1721 Lnet/minecraft/class_327;method_1721(Ljava/lang/String;)Ljava/lang/String;
      named mirror Lnet/minecraft/client/font/TextRenderer;mirror(Ljava/lang/String;)Ljava/lang/String;
    • draw

      private int draw​(String text, float x, float y, int color, Matrix4f matrix, boolean shadow, boolean mirror)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ljava/lang/String;FFILb;ZZ)I
      intermediary method_27520 Lnet/minecraft/class_327;method_27520(Ljava/lang/String;FFILnet/minecraft/class_1159;ZZ)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFILnet/minecraft/util/math/Matrix4f;ZZ)I
    • draw

      private int draw​(OrderedText text, float x, float y, int color, Matrix4f matrix, boolean shadow)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lafs;FFILb;Z)I
      intermediary method_22941 Lnet/minecraft/class_327;method_22941(Lnet/minecraft/class_5481;FFILnet/minecraft/class_1159;Z)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/OrderedText;FFILnet/minecraft/util/math/Matrix4f;Z)I
    • draw

      public int draw​(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, boolean seeThrough, int backgroundColor, int light)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ljava/lang/String;FFIZLb;Lehq;ZII)I
      intermediary method_27521 Lnet/minecraft/class_327;method_27521(Ljava/lang/String;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZII)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)I
    • draw

      public int draw​(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, boolean seeThrough, int backgroundColor, int light, boolean rightToLeft)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ljava/lang/String;FFIZLb;Lehq;ZIIZ)I
      intermediary method_27522 Lnet/minecraft/class_327;method_27522(Ljava/lang/String;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZIIZ)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZIIZ)I
    • draw

      public int draw​(Text text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, boolean seeThrough, int backgroundColor, int light)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Loi;FFIZLb;Lehq;ZII)I
      intermediary method_30882 Lnet/minecraft/class_327;method_30882(Lnet/minecraft/class_2561;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZII)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/Text;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)I
    • draw

      public int draw​(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, boolean seeThrough, int backgroundColor, int light)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lafs;FFIZLb;Lehq;ZII)I
      intermediary method_22942 Lnet/minecraft/class_327;method_22942(Lnet/minecraft/class_5481;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZII)I
      named draw Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/OrderedText;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)I
    • tweakTransparency

      private static int tweakTransparency​(int argb)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(I)I
      intermediary method_27515 Lnet/minecraft/class_327;method_27515(I)I
      named tweakTransparency Lnet/minecraft/client/font/TextRenderer;tweakTransparency(I)I
    • drawInternal

      private int drawInternal​(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, boolean seeThrough, int backgroundColor, int light, boolean mirror)
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ljava/lang/String;FFIZLb;Lehq;ZIIZ)I
      intermediary method_27529 Lnet/minecraft/class_327;method_27529(Ljava/lang/String;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZIIZ)I
      named drawInternal Lnet/minecraft/client/font/TextRenderer;drawInternal(Ljava/lang/String;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZIIZ)I
    • drawInternal

      private int drawInternal​(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, boolean seeThrough, int backgroundColor, int light)
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Lafs;FFIZLb;Lehq;ZII)I
      intermediary method_1723 Lnet/minecraft/class_327;method_1723(Lnet/minecraft/class_5481;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZII)I
      named drawInternal Lnet/minecraft/client/font/TextRenderer;drawInternal(Lnet/minecraft/text/OrderedText;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)I
    • drawLayer

      private float drawLayer​(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, boolean seeThrough, int underlineColor, int light)
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ljava/lang/String;FFIZLb;Lehq;ZII)F
      intermediary method_1724 Lnet/minecraft/class_327;method_1724(Ljava/lang/String;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZII)F
      named drawLayer Lnet/minecraft/client/font/TextRenderer;drawLayer(Ljava/lang/String;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)F
    • drawLayer

      private float drawLayer​(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, boolean seeThrough, int underlineColor, int light)
      Mappings:
      Namespace Name Mixin selector
      official c Ldrf;c(Lafs;FFIZLb;Lehq;ZII)F
      intermediary method_27530 Lnet/minecraft/class_327;method_27530(Lnet/minecraft/class_5481;FFIZLnet/minecraft/class_1159;Lnet/minecraft/class_4597;ZII)F
      named drawLayer Lnet/minecraft/client/font/TextRenderer;drawLayer(Lnet/minecraft/text/OrderedText;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)F
    • drawGlyph

      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)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ldtk;ZZFFFLb;Ldlv;FFFFI)V
      intermediary method_1710 Lnet/minecraft/class_327;method_1710(Lnet/minecraft/class_382;ZZFFFLnet/minecraft/class_1159;Lnet/minecraft/class_4588;FFFFI)V
      named drawGlyph Lnet/minecraft/client/font/TextRenderer;drawGlyph(Lnet/minecraft/client/font/GlyphRenderer;ZZFFFLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumer;FFFFI)V
    • getWidth

      public int getWidth​(String text)
      Gets the width of some text when rendered.
      Parameters:
      text - the text
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ljava/lang/String;)I
      intermediary method_1727 Lnet/minecraft/class_327;method_1727(Ljava/lang/String;)I
      named getWidth Lnet/minecraft/client/font/TextRenderer;getWidth(Ljava/lang/String;)I
    • getWidth

      public int getWidth​(StringVisitable text)
      Gets the width of some text when rendered.
      Parameters:
      text - the text
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lol;)I
      intermediary method_27525 Lnet/minecraft/class_327;method_27525(Lnet/minecraft/class_5348;)I
      named getWidth Lnet/minecraft/client/font/TextRenderer;getWidth(Lnet/minecraft/text/StringVisitable;)I
    • getWidth

      public int getWidth​(OrderedText text)
      Gets the width of some text when rendered.
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lafs;)I
      intermediary method_30880 Lnet/minecraft/class_327;method_30880(Lnet/minecraft/class_5481;)I
      named getWidth Lnet/minecraft/client/font/TextRenderer;getWidth(Lnet/minecraft/text/OrderedText;)I
    • trimToWidth

      public String trimToWidth​(String text, int maxWidth, boolean backwards)
      Trims a string to be at most maxWidth wide.
      Returns:
      the trimmed string
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ljava/lang/String;IZ)Ljava/lang/String;
      intermediary method_27524 Lnet/minecraft/class_327;method_27524(Ljava/lang/String;IZ)Ljava/lang/String;
      named trimToWidth Lnet/minecraft/client/font/TextRenderer;trimToWidth(Ljava/lang/String;IZ)Ljava/lang/String;
    • trimToWidth

      public String trimToWidth​(String text, int maxWidth)
      Trims a string to be at most maxWidth wide.
      Returns:
      the trimmed string
      See Also:
      TextHandler.trimToWidth(String, int, Style)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Ljava/lang/String;I)Ljava/lang/String;
      intermediary method_27523 Lnet/minecraft/class_327;method_27523(Ljava/lang/String;I)Ljava/lang/String;
      named trimToWidth Lnet/minecraft/client/font/TextRenderer;trimToWidth(Ljava/lang/String;I)Ljava/lang/String;
    • trimToWidth

      public StringVisitable trimToWidth​(StringVisitable text, int width)
      Trims a string to be at most maxWidth wide.
      Returns:
      the text
      See Also:
      TextHandler.trimToWidth(StringVisitable, int, Style)
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lol;I)Lol;
      intermediary method_1714 Lnet/minecraft/class_327;method_1714(Lnet/minecraft/class_5348;I)Lnet/minecraft/class_5348;
      named trimToWidth Lnet/minecraft/client/font/TextRenderer;trimToWidth(Lnet/minecraft/text/StringVisitable;I)Lnet/minecraft/text/StringVisitable;
    • drawTrimmed

      public void drawTrimmed​(StringVisitable text, int x, int y, int maxWidth, int color)
      Parameters:
      color - the text color in the 0xAARRGGBB format
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a(Lol;IIII)V
      intermediary method_1712 Lnet/minecraft/class_327;method_1712(Lnet/minecraft/class_5348;IIII)V
      named drawTrimmed Lnet/minecraft/client/font/TextRenderer;drawTrimmed(Lnet/minecraft/text/StringVisitable;IIII)V
    • getWrappedLinesHeight

      public int getWrappedLinesHeight​(String text, int maxWidth)
      Gets the height of the text when it has been wrapped.
      Returns:
      the height of the wrapped text
      See Also:
      wrapLines(StringVisitable, int)
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Ljava/lang/String;I)I
      intermediary method_1713 Lnet/minecraft/class_327;method_1713(Ljava/lang/String;I)I
      named getWrappedLinesHeight Lnet/minecraft/client/font/TextRenderer;getWrappedLinesHeight(Ljava/lang/String;I)I
    • wrapLines

      public List<OrderedText> wrapLines​(StringVisitable text, int width)
      Wraps text when the rendered width of text exceeds the width.
      Returns:
      a list of ordered text which has been wrapped
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b(Lol;I)Ljava/util/List;
      intermediary method_1728 Lnet/minecraft/class_327;method_1728(Lnet/minecraft/class_5348;I)Ljava/util/List;
      named wrapLines Lnet/minecraft/client/font/TextRenderer;wrapLines(Lnet/minecraft/text/StringVisitable;I)Ljava/util/List;
    • isRightToLeft

      public boolean isRightToLeft()
      Checks if the currently set language uses right to left writing.
      Mappings:
      Namespace Name Mixin selector
      official a Ldrf;a()Z
      intermediary method_1726 Lnet/minecraft/class_327;method_1726()Z
      named isRightToLeft Lnet/minecraft/client/font/TextRenderer;isRightToLeft()Z
    • getTextHandler

      public TextHandler getTextHandler()
      Mappings:
      Namespace Name Mixin selector
      official b Ldrf;b()Ldqu;
      intermediary method_27527 Lnet/minecraft/class_327;method_27527()Lnet/minecraft/class_5225;
      named getTextHandler Lnet/minecraft/client/font/TextRenderer;getTextHandler()Lnet/minecraft/client/font/TextHandler;