Class GuiGraphics

java.lang.Object
net.minecraft.client.gui.GuiGraphics
All Implemented Interfaces:
IGuiGraphicsExtension

public class GuiGraphics extends Object implements IGuiGraphicsExtension
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static class 
    A utility class for managing a stack of screen rectangles for scissoring.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private static final int
     
    private boolean
     
    static final float
     
    static final float
     
    private final Minecraft
     
    private final PoseStack
     
     
    private final GuiSpriteManager
     
    private ItemStack
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    Applies scissoring based on the provided screen rectangle.
    void
    blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite)
    Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates.
    void
    blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite, float red, float green, float blue, float alpha)
    Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates with a color tint.
    void
    blit(ResourceLocation atlasLocation, int x, int y, float uOffset, float vOffset, int width, int height, int textureWidth, int textureHeight)
    Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates.
    void
    blit(ResourceLocation atlasLocation, int x, int y, int blitOffset, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight)
    Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates with a blit offset and texture coordinates.
    void
    blit(ResourceLocation atlasLocation, int x, int y, int width, int height, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight)
    Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates.
    void
    blit(ResourceLocation atlasLocation, int x, int y, int uOffset, int vOffset, int uWidth, int vHeight)
    Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates.
    (package private) void
    blit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, int uWidth, int vHeight, float uOffset, float vOffset, int textureWidth, int textureHeight)
    Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates.
    private void
    blitNineSlicedSprite(TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice nineSlice, int x, int y, int blitOffset, int width, int height)
     
    private void
    blitSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height)
     
    private void
    blitSprite(TextureAtlasSprite sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight)
     
    void
    blitSprite(ResourceLocation sprite, int x, int y, int width, int height)
     
    void
    blitSprite(ResourceLocation sprite, int x, int y, int blitOffset, int width, int height)
     
    void
    blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int uWidth, int vHeight)
     
    void
    blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight)
     
    private void
    blitTiledSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height, int uPosition, int vPosition, int spriteWidth, int spriteHeight, int nineSliceWidth, int nineSliceHeight)
     
     
    boolean
    containsPointInScissor(int x, int y)
     
    void
     
    void
    drawCenteredString(Font font, String text, int x, int y, int color)
    Draws a centered string at the specified coordinates using the given font, text, and color.
    void
    drawCenteredString(Font font, Component text, int x, int y, int color)
    Draws a centered string at the specified coordinates using the given font, text component, and color.
    void
    drawCenteredString(Font font, FormattedCharSequence text, int x, int y, int color)
    Draws a centered string at the specified coordinates using the given font, formatted character sequence, and color.
    void
    Deprecated.
    int
    drawString(Font p_283343_, String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_)
     
    int
    drawString(Font font, String text, int x, int y, int color)
    Draws a string at the specified coordinates using the given font, text, and color.
    int
    drawString(Font font, String text, int x, int y, int color, boolean dropShadow)
    Draws a string at the specified coordinates using the given font, text, color, and drop shadow.
    int
    drawString(Font font, Component text, int x, int y, int color)
    Draws a component's visual order text at the specified coordinates using the given font, text component, and color.
    int
    drawString(Font font, Component text, int x, int y, int color, boolean dropShadow)
    Draws a component's visual order text at the specified coordinates using the given font, text component, color, and drop shadow.
    int
    drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_)
     
    int
    drawString(Font font, FormattedCharSequence text, int x, int y, int color)
    Draws a formatted character sequence at the specified coordinates using the given font, text, and color.
    int
    drawString(Font font, FormattedCharSequence text, int x, int y, int color, boolean dropShadow)
    Draws a formatted character sequence at the specified coordinates using the given font, text, color, and drop shadow.
    int
    drawStringWithBackdrop(Font font, Component text, int x, int y, int xOffset, int color)
     
    void
    drawWordWrap(Font font, FormattedText text, int x, int y, int lineWidth, int color)
    Draws a formatted text with word wrapping at the specified coordinates using the given font, text, line width, and color.
    void
    enableScissor(int minX, int minY, int maxX, int maxY)
    Enables scissoring with the specified screen coordinates.
    void
    fill(int minX, int minY, int maxX, int maxY, int color)
    Fills a rectangle with the specified color using the given coordinates as the boundaries.
    void
    fill(int minX, int minY, int maxX, int maxY, int z, int color)
    Fills a rectangle with the specified color and z-level using the given coordinates as the boundaries.
    void
    fill(RenderType renderType, int minX, int minY, int maxX, int maxY, int color)
    Fills a rectangle with the specified color using the given render type and coordinates as the boundaries.
    void
    fill(RenderType renderType, int minX, int minY, int maxX, int maxY, int z, int color)
    Fills a rectangle with the specified color and z-level using the given render type and coordinates as the boundaries.
    void
    fillGradient(int x1, int y1, int x2, int y2, int colorFrom, int colorTo)
    Fills a rectangle with a gradient color from colorFrom to colorTo using the given coordinates as the boundaries.
    void
    fillGradient(int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo)
    Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given coordinates as the boundaries.
    private void
    fillGradient(VertexConsumer consumer, int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo)
    The core `fillGradient` method.
    void
    fillGradient(RenderType renderType, int x1, int y1, int x2, int y2, int colorFrom, int colorTo, int z)
    Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render type and coordinates as the boundaries.
    void
    fillRenderType(RenderType renderType, int x1, int y1, int x2, int y2, int z)
     
    void
     
    private void
    Deprecated.
    private void
    Deprecated.
    int
     
    int
     
    void
    hLine(int minX, int maxX, int y, int color)
    Draws a horizontal line from minX to maxX at the specified y-coordinate with the given color.
    void
    hLine(RenderType renderType, int minX, int maxX, int y, int color)
    Draws a horizontal line from minX to maxX at the specified y-coordinate with the given color using the specified render type.
    (package private) void
    innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV)
    Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates without color tinting.
    (package private) void
    innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV, float red, float green, float blue, float alpha)
    Performs the inner blit operation for rendering a texture with the specified coordinates, texture coordinates, and color tint.
     
    void
    renderComponentHoverEffect(Font font, Style style, int mouseX, int mouseY)
    Renders a hover effect for a text component at the specified mouse coordinates.
    void
    renderComponentTooltip(Font p_font, List<? extends FormattedText> tooltipLines, int p_mouseX, int p_mouseY, ItemStack stack)
    Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.
    void
    renderComponentTooltip(Font font, List<Component> tooltipLines, int mouseX, int mouseY)
    Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.
    void
    renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText,TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack)
     
    void
    renderFakeItem(ItemStack stack, int x, int y)
    Renders a fake item stack at the specified coordinates.
    void
    renderFakeItem(ItemStack stack, int x, int y, int seed)
     
    void
    renderItem(LivingEntity entity, ItemStack stack, int x, int y, int seed)
    Renders an item stack for a living entity at the specified coordinates with a random seed.
    private void
    renderItem(LivingEntity entity, Level level, ItemStack stack, int x, int y, int seed)
    Renders an item stack for a living entity in a specific level at the specified coordinates with a random seed.
    private void
    renderItem(LivingEntity entity, Level level, ItemStack stack, int x, int y, int seed, int guiOffset)
    Renders an item stack for a living entity in a specific level at the specified coordinates with a random seed and a custom GUI offset.
    void
    renderItem(ItemStack stack, int x, int y)
    Renders an item stack at the specified coordinates.
    void
    renderItem(ItemStack stack, int x, int y, int seed)
    Renders an item stack at the specified coordinates with a random seed.
    void
    renderItem(ItemStack stack, int x, int y, int seed, int guiOffset)
    Renders an item stack at the specified coordinates with a random seed and a custom value.
    void
    renderItemDecorations(Font font, ItemStack stack, int x, int y)
    Renders additional decorations for an item stack at the specified coordinates.
    void
    renderItemDecorations(Font font, ItemStack stack, int x, int y, String text)
    Renders additional decorations for an item stack at the specified coordinates with optional custom text.
    void
    renderOutline(int x, int y, int width, int height, int color)
    Renders an outline rectangle on the screen with the specified color.
    void
    renderTooltip(Font font, List<? extends FormattedCharSequence> tooltipLines, int mouseX, int mouseY)
    Renders a tooltip with multiple lines of formatted text at the specified mouse coordinates.
    void
    renderTooltip(Font font, List<Component> tooltipLines, Optional<TooltipComponent> visualTooltipComponent, int mouseX, int mouseY)
    Renders a tooltip with customizable components at the specified mouse coordinates.
    void
    renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY)
     
    void
    renderTooltip(Font font, List<FormattedCharSequence> tooltipLines, ClientTooltipPositioner tooltipPositioner, int mouseX, int mouseY)
    Renders a tooltip with multiple lines of formatted text using a custom tooltip positioner at the specified mouse coordinates.
    void
    renderTooltip(Font font, Component text, int mouseX, int mouseY)
    Renders a tooltip with a single line of text at the specified mouse coordinates.
    void
    renderTooltip(Font font, ItemStack stack, int mouseX, int mouseY)
    Renders a tooltip for an item stack at the specified mouse coordinates.
    private void
    renderTooltipInternal(Font font, List<ClientTooltipComponent> components, int mouseX, int mouseY, ClientTooltipPositioner tooltipPositioner)
    Renders an internal tooltip with customizable tooltip components at the specified mouse coordinates using a tooltip positioner.
    void
    setColor(float red, float green, float blue, float alpha)
    Sets the current rendering color.
    void
    vLine(int x, int minY, int maxY, int color)
    Draws a vertical line from minY to maxY at the specified x-coordinate with the given color.
    void
    vLine(RenderType renderType, int x, int minY, int maxY, int color)
    Draws a vertical line from minY to maxY at the specified x-coordinate with the given color using the specified render type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.neoforge.client.extensions.IGuiGraphicsExtension

    blitInscribed, blitInscribed, blitWithBorder, blitWithBorder, drawScrollingString, getColorFromFormattingCharacter
  • Field Details

  • Constructor Details

  • Method Details

    • drawManaged

      @Deprecated public void drawManaged(Runnable runnable)
      Deprecated.
      Executes a runnable while managing the render state. The render state is flushed before and after executing the runnable.
      Parameters:
      runnable - the runnable to execute.
    • flushIfUnmanaged

      @Deprecated private void flushIfUnmanaged()
      Deprecated.
    • flushIfManaged

      @Deprecated private void flushIfManaged()
      Deprecated.
    • guiWidth

      public int guiWidth()
    • guiHeight

      public int guiHeight()
    • pose

      public PoseStack pose()
    • bufferSource

      public MultiBufferSource.BufferSource bufferSource()
    • flush

      public void flush()
    • hLine

      public void hLine(int minX, int maxX, int y, int color)
      Draws a horizontal line from minX to maxX at the specified y-coordinate with the given color.
      Parameters:
      minX - the x-coordinate of the start point.
      maxX - the x-coordinate of the end point.
      y - the y-coordinate of the line.
      color - the color of the line.
    • hLine

      public void hLine(RenderType renderType, int minX, int maxX, int y, int color)
      Draws a horizontal line from minX to maxX at the specified y-coordinate with the given color using the specified render type.
      Parameters:
      renderType - the render type to use.
      minX - the x-coordinate of the start point.
      maxX - the x-coordinate of the end point.
      y - the y-coordinate of the line.
      color - the color of the line.
    • vLine

      public void vLine(int x, int minY, int maxY, int color)
      Draws a vertical line from minY to maxY at the specified x-coordinate with the given color.
      Parameters:
      x - the x-coordinate of the line.
      minY - the y-coordinate of the start point.
      maxY - the y-coordinate of the end point.
      color - the color of the line.
    • vLine

      public void vLine(RenderType renderType, int x, int minY, int maxY, int color)
      Draws a vertical line from minY to maxY at the specified x-coordinate with the given color using the specified render type.
      Parameters:
      renderType - the render type to use.
      x - the x-coordinate of the line.
      minY - the y-coordinate of the start point.
      maxY - the y-coordinate of the end point.
      color - the color of the line.
    • enableScissor

      public void enableScissor(int minX, int minY, int maxX, int maxY)
      Enables scissoring with the specified screen coordinates.
      Parameters:
      minX - the minimum x-coordinate of the scissor region.
      minY - the minimum y-coordinate of the scissor region.
      maxX - the maximum x-coordinate of the scissor region.
      maxY - the maximum y-coordinate of the scissor region.
    • disableScissor

      public void disableScissor()
    • containsPointInScissor

      public boolean containsPointInScissor(int x, int y)
    • applyScissor

      private void applyScissor(@Nullable ScreenRectangle rectangle)
      Applies scissoring based on the provided screen rectangle.
      Parameters:
      rectangle - the screen rectangle to apply scissoring with. Can be null to disable scissoring.
    • setColor

      public void setColor(float red, float green, float blue, float alpha)
      Sets the current rendering color.
      Parameters:
      red - the red component of the color.
      green - the green component of the color.
      blue - the blue component of the color.
      alpha - the alpha component of the color.
    • fill

      public void fill(int minX, int minY, int maxX, int maxY, int color)
      Fills a rectangle with the specified color using the given coordinates as the boundaries.
      Parameters:
      minX - the minimum x-coordinate of the rectangle.
      minY - the minimum y-coordinate of the rectangle.
      maxX - the maximum x-coordinate of the rectangle.
      maxY - the maximum y-coordinate of the rectangle.
      color - the color to fill the rectangle with.
    • fill

      public void fill(int minX, int minY, int maxX, int maxY, int z, int color)
      Fills a rectangle with the specified color and z-level using the given coordinates as the boundaries.
      Parameters:
      minX - the minimum x-coordinate of the rectangle.
      minY - the minimum y-coordinate of the rectangle.
      maxX - the maximum x-coordinate of the rectangle.
      maxY - the maximum y-coordinate of the rectangle.
      z - the z-level of the rectangle.
      color - the color to fill the rectangle with.
    • fill

      public void fill(RenderType renderType, int minX, int minY, int maxX, int maxY, int color)
      Fills a rectangle with the specified color using the given render type and coordinates as the boundaries.
      Parameters:
      renderType - the render type to use.
      minX - the minimum x-coordinate of the rectangle.
      minY - the minimum y-coordinate of the rectangle.
      maxX - the maximum x-coordinate of the rectangle.
      maxY - the maximum y-coordinate of the rectangle.
      color - the color to fill the rectangle with.
    • fill

      public void fill(RenderType renderType, int minX, int minY, int maxX, int maxY, int z, int color)
      Fills a rectangle with the specified color and z-level using the given render type and coordinates as the boundaries.
      Parameters:
      renderType - the render type to use.
      minX - the minimum x-coordinate of the rectangle.
      minY - the minimum y-coordinate of the rectangle.
      maxX - the maximum x-coordinate of the rectangle.
      maxY - the maximum y-coordinate of the rectangle.
      z - the z-level of the rectangle.
      color - the color to fill the rectangle with.
    • fillGradient

      public void fillGradient(int x1, int y1, int x2, int y2, int colorFrom, int colorTo)
      Fills a rectangle with a gradient color from colorFrom to colorTo using the given coordinates as the boundaries.
      Parameters:
      x1 - the x-coordinate of the first corner of the rectangle.
      y1 - the y-coordinate of the first corner of the rectangle.
      x2 - the x-coordinate of the second corner of the rectangle.
      y2 - the y-coordinate of the second corner of the rectangle.
      colorFrom - the starting color of the gradient.
      colorTo - the ending color of the gradient.
    • fillGradient

      public void fillGradient(int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo)
      Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given coordinates as the boundaries.
      Parameters:
      x1 - the x-coordinate of the first corner of the rectangle.
      y1 - the y-coordinate of the first corner of the rectangle.
      x2 - the x-coordinate of the second corner of the rectangle.
      y2 - the y-coordinate of the second corner of the rectangle.
      z - the z-level of the rectangle.
      colorFrom - the starting color of the gradient.
      colorTo - the ending color of the gradient.
    • fillGradient

      public void fillGradient(RenderType renderType, int x1, int y1, int x2, int y2, int colorFrom, int colorTo, int z)
      Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render type and coordinates as the boundaries.
      Parameters:
      renderType - the render type to use.
      x1 - the x-coordinate of the first corner of the rectangle.
      y1 - the y-coordinate of the first corner of the rectangle.
      x2 - the x-coordinate of the second corner of the rectangle.
      y2 - the y-coordinate of the second corner of the rectangle.
      colorFrom - the starting color of the gradient.
      colorTo - the ending color of the gradient.
      z - the z-level of the rectangle.
    • fillGradient

      private void fillGradient(VertexConsumer consumer, int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo)
      The core `fillGradient` method.

      Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render type and coordinates as the boundaries.

      Parameters:
      consumer - the VertexConsumer object for drawing the vertices on screen.
      x1 - the x-coordinate of the first corner of the rectangle.
      y1 - the y-coordinate of the first corner of the rectangle.
      x2 - the x-coordinate of the second corner of the rectangle.
      y2 - the y-coordinate of the second corner of the rectangle.
      z - the z-level of the rectangle.
      colorFrom - the starting color of the gradient.
      colorTo - the ending color of the gradient.
    • fillRenderType

      public void fillRenderType(RenderType renderType, int x1, int y1, int x2, int y2, int z)
    • drawCenteredString

      public void drawCenteredString(Font font, String text, int x, int y, int color)
      Draws a centered string at the specified coordinates using the given font, text, and color.
      Parameters:
      font - the font to use for rendering.
      text - the text to draw.
      x - the x-coordinate of the center of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
    • drawCenteredString

      public void drawCenteredString(Font font, Component text, int x, int y, int color)
      Draws a centered string at the specified coordinates using the given font, text component, and color.
      Parameters:
      font - the font to use for rendering.
      text - the text component to draw.
      x - the x-coordinate of the center of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
    • drawCenteredString

      public void drawCenteredString(Font font, FormattedCharSequence text, int x, int y, int color)
      Draws a centered string at the specified coordinates using the given font, formatted character sequence, and color.
      Parameters:
      font - the font to use for rendering.
      text - the formatted character sequence to draw.
      x - the x-coordinate of the center of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
    • drawString

      public int drawString(Font font, @Nullable String text, int x, int y, int color)
      Draws a string at the specified coordinates using the given font, text, and color. Returns the width of the drawn string.

      Parameters:
      font - the font to use for rendering.
      text - the text to draw.
      x - the x-coordinate of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
      Returns:
      the width of the drawn string.
    • drawString

      public int drawString(Font font, @Nullable String text, int x, int y, int color, boolean dropShadow)
      Draws a string at the specified coordinates using the given font, text, color, and drop shadow. Returns the width of the drawn string.

      Parameters:
      font - the font to use for rendering.
      text - the text to draw.
      x - the x-coordinate of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
      dropShadow - whether to apply a drop shadow to the string.
      Returns:
      the width of the drawn string.
    • drawString

      public int drawString(Font p_283343_, @Nullable String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_)
    • drawString

      public int drawString(Font font, FormattedCharSequence text, int x, int y, int color)
      Draws a formatted character sequence at the specified coordinates using the given font, text, and color. Returns the width of the drawn string.

      Parameters:
      font - the font to use for rendering.
      text - the formatted character sequence to draw.
      x - the x-coordinate of the string.
      y - the y-coordinate of the string.
      color - the color of the string
      Returns:
      the width of the drawn string.
    • drawString

      public int drawString(Font font, FormattedCharSequence text, int x, int y, int color, boolean dropShadow)
      Draws a formatted character sequence at the specified coordinates using the given font, text, color, and drop shadow. Returns the width of the drawn string.

      Parameters:
      font - the font to use for rendering.
      text - the formatted character sequence to draw.
      x - the x-coordinate of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
      dropShadow - whether to apply a drop shadow to the string.
      Returns:
      returns the width of the drawn string.
    • drawString

      public int drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_)
    • drawString

      public int drawString(Font font, Component text, int x, int y, int color)
      Draws a component's visual order text at the specified coordinates using the given font, text component, and color.

      Parameters:
      font - the font to use for rendering.
      text - the text component to draw.
      x - the x-coordinate of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
      Returns:
      the width of the drawn string.
    • drawString

      public int drawString(Font font, Component text, int x, int y, int color, boolean dropShadow)
      Draws a component's visual order text at the specified coordinates using the given font, text component, color, and drop shadow.

      Parameters:
      font - the font to use for rendering.
      text - the text component to draw.
      x - the x-coordinate of the string.
      y - the y-coordinate of the string.
      color - the color of the string.
      dropShadow - whether to apply a drop shadow to the string.
      Returns:
      the width of the drawn string.
    • drawWordWrap

      public void drawWordWrap(Font font, FormattedText text, int x, int y, int lineWidth, int color)
      Draws a formatted text with word wrapping at the specified coordinates using the given font, text, line width, and color.
      Parameters:
      font - the font to use for rendering.
      text - the formatted text to draw.
      x - the x-coordinate of the starting position.
      y - the y-coordinate of the starting position.
      lineWidth - the maximum width of each line before wrapping.
      color - the color of the text.
    • drawStringWithBackdrop

      public int drawStringWithBackdrop(Font font, Component text, int x, int y, int xOffset, int color)
    • blit

      public void blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite)
      Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates.
      Parameters:
      x - the x-coordinate of the blit position.
      y - the y-coordinate of the blit position.
      blitOffset - the z-level offset for rendering order.
      width - the width of the blitted portion.
      height - the height of the blitted portion.
      sprite - the texture atlas sprite to blit.
    • blit

      public void blit(int x, int y, int blitOffset, int width, int height, TextureAtlasSprite sprite, float red, float green, float blue, float alpha)
      Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates with a color tint.
      Parameters:
      x - the x-coordinate of the blit position.
      y - the y-coordinate of the blit position.
      blitOffset - the z-level offset for rendering order.
      width - the width of the blitted portion.
      height - the height of the blitted portion.
      sprite - the texture atlas sprite to blit.
      red - the red component of the color tint.
      green - the green component of the color tint.
      blue - the blue component of the color tint.
      alpha - the alpha component of the color tint.
    • renderOutline

      public void renderOutline(int x, int y, int width, int height, int color)
      Renders an outline rectangle on the screen with the specified color.
      Parameters:
      x - the x-coordinate of the top-left corner of the rectangle.
      y - the y-coordinate of the top-left corner of the rectangle.
      width - the width of the blitted portion.
      height - the height of the rectangle.
      color - the color of the outline.
    • blitSprite

      public void blitSprite(ResourceLocation sprite, int x, int y, int width, int height)
    • blitSprite

      public void blitSprite(ResourceLocation sprite, int x, int y, int blitOffset, int width, int height)
    • blitSprite

      public void blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int uWidth, int vHeight)
    • blitSprite

      public void blitSprite(ResourceLocation sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight)
    • blitSprite

      private void blitSprite(TextureAtlasSprite sprite, int textureWidth, int textureHeight, int uPosition, int vPosition, int x, int y, int blitOffset, int uWidth, int vHeight)
    • blitSprite

      private void blitSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height)
    • blit

      public void blit(ResourceLocation atlasLocation, int x, int y, int uOffset, int vOffset, int uWidth, int vHeight)
      Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x - the x-coordinate of the blit position.
      y - the y-coordinate of the blit position.
      uOffset - the horizontal texture coordinate offset.
      vOffset - the vertical texture coordinate offset.
      uWidth - the width of the blitted portion in texture coordinates.
      vHeight - the height of the blitted portion in texture coordinates.
    • blit

      public void blit(ResourceLocation atlasLocation, int x, int y, int blitOffset, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight)
      Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates with a blit offset and texture coordinates.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x - the x-coordinate of the blit position.
      y - the y-coordinate of the blit position.
      blitOffset - the z-level offset for rendering order.
      uOffset - the horizontal texture coordinate offset.
      vOffset - the vertical texture coordinate offset.
      uWidth - the width of the blitted portion in texture coordinates.
      vHeight - the height of the blitted portion in texture coordinates.
      textureWidth - the width of the texture.
      textureHeight - the height of the texture.
    • blit

      public void blit(ResourceLocation atlasLocation, int x, int y, int width, int height, float uOffset, float vOffset, int uWidth, int vHeight, int textureWidth, int textureHeight)
      Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x - the x-coordinate of the top-left corner of the blit position.
      y - the y-coordinate of the top-left corner of the blit position.
      width - the width of the blitted portion.
      height - the height of the blitted portion.
      uOffset - the horizontal texture coordinate offset.
      vOffset - the vertical texture coordinate offset.
      uWidth - the width of the blitted portion in texture coordinates.
      vHeight - the height of the blitted portion in texture coordinates.
      textureWidth - the width of the texture.
      textureHeight - the height of the texture.
    • blit

      public void blit(ResourceLocation atlasLocation, int x, int y, float uOffset, float vOffset, int width, int height, int textureWidth, int textureHeight)
      Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x - the x-coordinate of the top-left corner of the blit position.
      y - the y-coordinate of the top-left corner of the blit position.
      uOffset - the horizontal texture coordinate offset.
      vOffset - the vertical texture coordinate offset.
      width - the width of the blitted portion.
      height - the height of the blitted portion.
      textureWidth - the width of the texture.
      textureHeight - the height of the texture.
    • blit

      void blit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, int uWidth, int vHeight, float uOffset, float vOffset, int textureWidth, int textureHeight)
      Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x1 - the x-coordinate of the first corner of the blit position.
      x2 - the x-coordinate of the second corner of the blit position .
      y1 - the y-coordinate of the first corner of the blit position.
      y2 - the y-coordinate of the second corner of the blit position .
      blitOffset - the z-level offset for rendering order.
      uWidth - the width of the blitted portion in texture coordinates.
      vHeight - the height of the blitted portion in texture coordinates.
      uOffset - the horizontal texture coordinate offset.
      vOffset - the vertical texture coordinate offset.
      textureWidth - the width of the texture.
      textureHeight - the height of the texture.
    • innerBlit

      void innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV)
      Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates without color tinting.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x1 - the x-coordinate of the first corner of the blit position.
      x2 - the x-coordinate of the second corner of the blit position .
      y1 - the y-coordinate of the first corner of the blit position.
      y2 - the y-coordinate of the second corner of the blit position .
      blitOffset - the z-level offset for rendering order.
      minU - the minimum horizontal texture coordinate.
      maxU - the maximum horizontal texture coordinate.
      minV - the minimum vertical texture coordinate.
      maxV - the maximum vertical texture coordinate.
    • innerBlit

      void innerBlit(ResourceLocation atlasLocation, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV, float red, float green, float blue, float alpha)
      Performs the inner blit operation for rendering a texture with the specified coordinates, texture coordinates, and color tint.
      Parameters:
      atlasLocation - the location of the texture atlas.
      x1 - the x-coordinate of the first corner of the blit position.
      x2 - the x-coordinate of the second corner of the blit position .
      y1 - the y-coordinate of the first corner of the blit position.
      y2 - the y-coordinate of the second corner of the blit position .
      blitOffset - the z-level offset for rendering order.
      minU - the minimum horizontal texture coordinate.
      maxU - the maximum horizontal texture coordinate.
      minV - the minimum vertical texture coordinate.
      maxV - the maximum vertical texture coordinate.
      red - the red component of the color tint.
      green - the green component of the color tint.
      blue - the blue component of the color tint.
      alpha - the alpha component of the color tint.
    • blitNineSlicedSprite

      private void blitNineSlicedSprite(TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice nineSlice, int x, int y, int blitOffset, int width, int height)
    • blitTiledSprite

      private void blitTiledSprite(TextureAtlasSprite sprite, int x, int y, int blitOffset, int width, int height, int uPosition, int vPosition, int spriteWidth, int spriteHeight, int nineSliceWidth, int nineSliceHeight)
    • renderItem

      public void renderItem(ItemStack stack, int x, int y)
      Renders an item stack at the specified coordinates.
      Parameters:
      stack - the item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
    • renderItem

      public void renderItem(ItemStack stack, int x, int y, int seed)
      Renders an item stack at the specified coordinates with a random seed.
      Parameters:
      stack - the item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
      seed - the random seed.
    • renderItem

      public void renderItem(ItemStack stack, int x, int y, int seed, int guiOffset)
      Renders an item stack at the specified coordinates with a random seed and a custom value.
      Parameters:
      stack - the item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
      seed - the random seed.
      guiOffset - the GUI offset.
    • renderFakeItem

      public void renderFakeItem(ItemStack stack, int x, int y)
      Renders a fake item stack at the specified coordinates.
      Parameters:
      stack - the fake item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
    • renderFakeItem

      public void renderFakeItem(ItemStack stack, int x, int y, int seed)
    • renderItem

      public void renderItem(LivingEntity entity, ItemStack stack, int x, int y, int seed)
      Renders an item stack for a living entity at the specified coordinates with a random seed.
      Parameters:
      entity - the living entity.
      stack - the item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
      seed - the random seed.
    • renderItem

      private void renderItem(@Nullable LivingEntity entity, @Nullable Level level, ItemStack stack, int x, int y, int seed)
      Renders an item stack for a living entity in a specific level at the specified coordinates with a random seed.
      Parameters:
      entity - the living entity. Can be null.
      level - the level in which the rendering occurs. Can be null.
      stack - the item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
      seed - the random seed.
    • renderItem

      private void renderItem(@Nullable LivingEntity entity, @Nullable Level level, ItemStack stack, int x, int y, int seed, int guiOffset)
      Renders an item stack for a living entity in a specific level at the specified coordinates with a random seed and a custom GUI offset.
      Parameters:
      entity - the living entity. Can be null.
      level - the level in which the rendering occurs. Can be null.
      stack - the item stack to render.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
      seed - the random seed.
      guiOffset - the GUI offset value.
    • renderItemDecorations

      public void renderItemDecorations(Font font, ItemStack stack, int x, int y)
      Renders additional decorations for an item stack at the specified coordinates.
      Parameters:
      font - the font used for rendering text.
      stack - the item stack to decorate.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
    • renderItemDecorations

      public void renderItemDecorations(Font font, ItemStack stack, int x, int y, @Nullable String text)
      Renders additional decorations for an item stack at the specified coordinates with optional custom text.
      Parameters:
      font - the font used for rendering text.
      stack - the item stack to decorate.
      x - the x-coordinate of the rendering position.
      y - the y-coordinate of the rendering position.
      text - the custom text to display. Can be null.
    • renderTooltip

      public void renderTooltip(Font font, ItemStack stack, int mouseX, int mouseY)
      Renders a tooltip for an item stack at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      stack - the item stack to display the tooltip for.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
    • renderTooltip

      public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY)
    • renderTooltip

      public void renderTooltip(Font font, List<Component> tooltipLines, Optional<TooltipComponent> visualTooltipComponent, int mouseX, int mouseY)
      Renders a tooltip with customizable components at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      tooltipLines - the lines of the tooltip.
      visualTooltipComponent - the visual tooltip component. Can be empty.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
    • renderTooltip

      public void renderTooltip(Font font, Component text, int mouseX, int mouseY)
      Renders a tooltip with a single line of text at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      text - the text to display in the tooltip.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
    • renderComponentTooltip

      public void renderComponentTooltip(Font font, List<Component> tooltipLines, int mouseX, int mouseY)
      Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      tooltipLines - the lines of the tooltip as components.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
    • renderComponentTooltip

      public void renderComponentTooltip(Font p_font, List<? extends FormattedText> tooltipLines, int p_mouseX, int p_mouseY, ItemStack stack)
      Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.
      Parameters:
      tooltipLines - the lines of the tooltip as components.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
      font - the font used for rendering text.
    • renderComponentTooltipFromElements

      public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText,TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack)
    • renderTooltip

      public void renderTooltip(Font font, List<? extends FormattedCharSequence> tooltipLines, int mouseX, int mouseY)
      Renders a tooltip with multiple lines of formatted text at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      tooltipLines - the lines of the tooltip as formatted character sequences.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
    • renderTooltip

      public void renderTooltip(Font font, List<FormattedCharSequence> tooltipLines, ClientTooltipPositioner tooltipPositioner, int mouseX, int mouseY)
      Renders a tooltip with multiple lines of formatted text using a custom tooltip positioner at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      tooltipLines - the lines of the tooltip as formatted character sequences.
      tooltipPositioner - the positioner to determine the tooltip's position.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
    • renderTooltipInternal

      private void renderTooltipInternal(Font font, List<ClientTooltipComponent> components, int mouseX, int mouseY, ClientTooltipPositioner tooltipPositioner)
      Renders an internal tooltip with customizable tooltip components at the specified mouse coordinates using a tooltip positioner.
      Parameters:
      font - the font used for rendering text.
      components - the tooltip components to render.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.
      tooltipPositioner - the positioner to determine the tooltip's position.
    • renderComponentHoverEffect

      public void renderComponentHoverEffect(Font font, @Nullable Style style, int mouseX, int mouseY)
      Renders a hover effect for a text component at the specified mouse coordinates.
      Parameters:
      font - the font used for rendering text.
      style - the style of the text component. Can be null.
      mouseX - the x-coordinate of the mouse position.
      mouseY - the y-coordinate of the mouse position.