Class GuiGraphics

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

public class GuiGraphics extends Object implements IGuiGraphicsExtension
  • Field Details

  • Constructor Details

  • Method Details

    • guiWidth

      public int guiWidth()
    • guiHeight

      public int guiHeight()
    • nextStratum

      public void nextStratum()
    • blurBeforeThisStratum

      public void blurBeforeThisStratum()
    • pose

      public Matrix3x2fStack pose()
    • 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.
    • 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.
    • 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)
    • 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(RenderPipeline pipeline, int minX, int minY, int maxX, int maxY, int color)
    • fillGradient

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

      public void fill(RenderPipeline pipeline, TextureSetup textureSetup, int minX, int minY, int maxX, int maxY)
    • submitColoredRectangle

      private void submitColoredRectangle(RenderPipeline pipeline, TextureSetup textureSetup, int minX, int minY, int maxX, int maxY, int colorFrom, @Nullable Integer colorTo)
    • textHighlight

      public void textHighlight(int minX, int minY, int maxX, int maxY)
    • 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 void drawString(Font font, @Nullable String text, int x, int y, int color)
    • drawString

      public void drawString(Font font, @Nullable String text, int x, int y, int color, boolean drawShadow)
    • drawString

      public void drawString(Font font, FormattedCharSequence text, int x, int y, int color)
    • drawString

      public void drawString(Font font, FormattedCharSequence text, int x, int y, int color, boolean drawShadow)
    • drawString

      public void drawString(Font font, Component text, int x, int y, int color)
    • drawString

      public void drawString(Font font, Component text, int x, int y, int color, boolean drawShadow)
    • 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.
    • drawWordWrap

      public void drawWordWrap(Font font, FormattedText text, int x, int y, int lineWidth, int color, boolean dropShadow)
    • drawStringWithBackdrop

      public void drawStringWithBackdrop(Font font, Component text, int x, int y, int width, int color)
    • 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(RenderPipeline pipeline, ResourceLocation sprite, int x, int y, int width, int height)
    • blitSprite

      public void blitSprite(RenderPipeline pipeline, ResourceLocation sprite, int x, int y, int width, int height, float fade)
    • blitSprite

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

      public void blitSprite(RenderPipeline pipeline, ResourceLocation sprite, int textureWidth, int textureHeight, int u, int v, int x, int y, int width, int height)
    • blitSprite

      public void blitSprite(RenderPipeline pipeline, ResourceLocation sprite, int textureWidth, int textureHeight, int u, int v, int x, int y, int width, int height, int color)
    • blitSprite

      public void blitSprite(RenderPipeline pipeline, TextureAtlasSprite sprite, int x, int width, int y, int height)
    • blitSprite

      public void blitSprite(RenderPipeline pipeline, TextureAtlasSprite sprite, int x, int y, int width, int height, int color)
    • blitSprite

      private void blitSprite(RenderPipeline pipeline, TextureAtlasSprite sprite, int textureWidth, int textureHeight, int u, int v, int x, int y, int width, int height, int color)
    • blitNineSlicedSprite

      private void blitNineSlicedSprite(RenderPipeline pipeline, TextureAtlasSprite sprite, GuiSpriteScaling.NineSlice nineSlice, int x, int y, int width, int height, int color)
    • blitNineSliceInnerSegment

      private void blitNineSliceInnerSegment(RenderPipeline pipeline, GuiSpriteScaling.NineSlice nineSlice, TextureAtlasSprite sprite, int borderMinX, int borderMinY, int borderMaxX, int borderMaxY, int u, int v, int spriteWidth, int spriteHeight, int textureWidth, int textureHeight, int color)
    • blitTiledSprite

      private void blitTiledSprite(RenderPipeline pipeline, TextureAtlasSprite sprite, int x, int y, int width, int height, int u, int v, int spriteWidth, int spriteHeight, int textureWidth, int textureHeight, int color)
    • blit

      public void blit(RenderPipeline pipeline, ResourceLocation atlas, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight, int color)
    • blit

      public void blit(RenderPipeline pipeline, ResourceLocation atlas, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight)
    • blit

      public void blit(RenderPipeline pipeline, ResourceLocation atlas, int x, int y, float u, float v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight)
    • blit

      public void blit(RenderPipeline pipeline, ResourceLocation atlas, int x, int y, float u, float v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight, int color)
    • blit

      public void blit(ResourceLocation atlas, int x0, int y0, int x1, int y1, float u0, float u1, float v0, float v1)
    • innerBlit

      private void innerBlit(RenderPipeline pipeline, ResourceLocation atlas, int x0, int x1, int y0, int y1, float u0, float u1, float v0, float v1, int color)
    • submitBlit

      private void submitBlit(RenderPipeline pipeline, GpuTextureView atlasTexture, int x0, int y0, int x1, int y1, float u0, float u1, float v0, float v1, int color)
    • 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.
    • 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.
    • 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.
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Component text, int x, int y)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(List<FormattedCharSequence> lines, int x, int y)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, ItemStack stack, int x, int y)
    • setTooltipForNextFrame

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

      public void setTooltipForNextFrame(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY, @Nullable ResourceLocation backgroundTexture)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, List<Component> lines, Optional<TooltipComponent> tooltipImage, int x, int y)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, List<Component> lines, Optional<TooltipComponent> tooltipImage, int x, int y, @Nullable ResourceLocation background)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, Component text, int x, int y)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, Component text, int x, int y, @Nullable ResourceLocation background)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font font, List<Component> lines, int x, int y)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font font, List<Component> lines, int x, int y, @Nullable ResourceLocation background)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font font, List<? extends FormattedText> lines, int x, int y, ItemStack stack)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font font, List<? extends FormattedText> lines, int x, int y, ItemStack stack, @Nullable ResourceLocation backgroundTexture)
    • setComponentTooltipFromElementsForNextFrame

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

      public void setComponentTooltipFromElementsForNextFrame(Font font, List<com.mojang.datafixers.util.Either<FormattedText,TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack, @Nullable ResourceLocation backgroundTexture)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, List<? extends FormattedCharSequence> lines, int x, int y)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, List<? extends FormattedCharSequence> lines, int x, int y, @Nullable ResourceLocation background)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font font, List<FormattedCharSequence> lines, ClientTooltipPositioner positioner, int x, int y, boolean focused)
    • setTooltipForNextFrameInternal

      private void setTooltipForNextFrameInternal(Font font, List<ClientTooltipComponent> components, int x, int y, ClientTooltipPositioner positioner, @Nullable ResourceLocation background, boolean focused)
    • renderTooltip

      public void renderTooltip(Font font, List<ClientTooltipComponent> components, int x, int y, ClientTooltipPositioner positioner, @Nullable ResourceLocation background)
    • renderTooltip

      public void renderTooltip(Font font, List<ClientTooltipComponent> components, int x, int y, ClientTooltipPositioner positioner, @Nullable ResourceLocation background, ItemStack tooltipStack)
    • renderDeferredTooltip

      public void renderDeferredTooltip()
    • renderItemBar

      private void renderItemBar(ItemStack stack, int x, int y)
    • renderItemCount

      private void renderItemCount(Font font, ItemStack stack, int x, int y, @Nullable String text)
    • renderItemCooldown

      private void renderItemCooldown(ItemStack stack, int x, int y)
    • 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.
    • submitMapRenderState

      public void submitMapRenderState(MapRenderState renderState)
    • submitEntityRenderState

      public void submitEntityRenderState(EntityRenderState renderState, float scale, Vector3f translation, Quaternionf rotation, @Nullable Quaternionf overrideCameraAngle, int x0, int y0, int x1, int y1)
    • submitSkinRenderState

      public void submitSkinRenderState(PlayerModel playerModel, ResourceLocation texture, float scale, float rotationX, float rotationY, float pivotY, int x0, int y0, int x1, int y1)
    • submitBookModelRenderState

      public void submitBookModelRenderState(BookModel bookModel, ResourceLocation texture, float scale, float open, float flip, int x0, int y0, int x1, int y1)
    • submitBannerPatternRenderState

      public void submitBannerPatternRenderState(ModelPart flag, DyeColor baseColor, BannerPatternLayers resultBannerPatterns, int x0, int y0, int x1, int y1)
    • submitSignRenderState

      public void submitSignRenderState(Model signModel, float scale, WoodType woodType, int x0, int y0, int x1, int y1)
    • submitProfilerChartRenderState

      public void submitProfilerChartRenderState(List<ResultField> chartData, int x0, int y0, int x1, int y1)
    • submitGuiElementRenderState

      public void submitGuiElementRenderState(GuiElementRenderState renderState)
      Neo: Submit a custom GuiElementRenderState for rendering
    • submitPictureInPictureRenderState

      public void submitPictureInPictureRenderState(PictureInPictureRenderState renderState)
      Neo: Submit a custom PictureInPictureRenderState for rendering
      See Also:
    • peekScissorStack

      @Nullable public ScreenRectangle peekScissorStack()
      Neo: Returns the top-most scissor rectangle, if present, for use with custom GuiElementRenderStates and PictureInPictureRenderStates