Class GuiGraphics

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

public class GuiGraphics extends Object implements IGuiGraphicsExtension
  • Field Details

    • EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE

      private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE
      See Also:
    • minecraft

      private final Minecraft minecraft
    • pose

      private final org.joml.Matrix3x2fStack pose
    • scissorStack

      private final GuiGraphics.ScissorStack scissorStack
    • sprites

      private final GuiSpriteManager sprites
    • guiRenderState

      private final GuiRenderState guiRenderState
    • deferredTooltip

      @Nullable private Runnable deferredTooltip
    • tooltipStack

      private ItemStack tooltipStack
  • Constructor Details

  • Method Details

    • guiWidth

      public int guiWidth()
    • guiHeight

      public int guiHeight()
    • nextStratum

      public void nextStratum()
    • blurBeforeThisStratum

      public void blurBeforeThisStratum()
    • pose

      public org.joml.Matrix3x2fStack pose()
    • hLine

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

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

      public void enableScissor(int pMinX, int pMinY, int pMaxX, int pMaxY)
      Enables scissoring with the specified screen coordinates.
      Parameters:
      pMinX - the minimum x-coordinate of the scissor region.
      pMinY - the minimum y-coordinate of the scissor region.
      pMaxX - the maximum x-coordinate of the scissor region.
      pMaxY - the maximum y-coordinate of the scissor region.
    • disableScissor

      public void disableScissor()
    • containsPointInScissor

      public boolean containsPointInScissor(int pX, int pY)
    • fill

      public void fill(int pMinX, int pMinY, int pMaxX, int pMaxY, int pColor)
      Fills a rectangle with the specified color using the given coordinates as the boundaries.
      Parameters:
      pMinX - the minimum x-coordinate of the rectangle.
      pMinY - the minimum y-coordinate of the rectangle.
      pMaxX - the maximum x-coordinate of the rectangle.
      pMaxY - the maximum y-coordinate of the rectangle.
      pColor - the color to fill the rectangle with.
    • fill

      public void fill(RenderPipeline pPipeline, int pMinX, int pMinY, int pMaxX, int pMaxY, int pColor)
    • fillGradient

      public void fillGradient(int pMinX, int pMinY, int pMaxX, int pMaxY, int pColorFrom, int pColorTo)
      Fills a rectangle with a gradient color from colorFrom to colorTo using the given coordinates as the boundaries.
      Parameters:
      pMinX - the x-coordinate of the first corner of the rectangle.
      pMinY - the y-coordinate of the first corner of the rectangle.
      pMaxX - the x-coordinate of the second corner of the rectangle.
      pMaxY - the y-coordinate of the second corner of the rectangle.
      pColorFrom - the starting color of the gradient.
      pColorTo - the ending color of the gradient.
    • fill

      public void fill(RenderPipeline pPipeline, TextureSetup pTextureSetup, int pMinX, int pMinY, int pMaxX, int pMaxY)
    • submitColoredRectangle

      private void submitColoredRectangle(RenderPipeline pPipeline, TextureSetup pTextureSetup, int pMinX, int pMinY, int pMaxX, int pMaxY, int pColorFrom, @Nullable Integer pColorTo)
    • textHighlight

      public void textHighlight(int p_428831_, int p_428851_, int p_428846_, int p_428835_)
    • drawCenteredString

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

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

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

      public void drawString(Font pFont, @Nullable String pText, int pX, int pY, int pColor)
    • drawString

      public void drawString(Font pFont, @Nullable String pText, int pX, int pY, int pColor, boolean pDrawShadow)
    • drawString

      public void drawString(Font pFont, FormattedCharSequence pText, int pX, int pY, int pColor)
    • drawString

      public void drawString(Font pFont, FormattedCharSequence pText, int pX, int pY, int pColor, boolean pDrawShadow)
    • drawString

      public void drawString(Font pFont, Component pText, int pX, int pY, int pColor)
    • drawString

      public void drawString(Font pFont, Component pText, int pX, int pY, int pColor, boolean pDrawShadow)
    • drawWordWrap

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

      public void drawWordWrap(Font pFont, FormattedText pText, int pX, int pY, int pLineWidth, int pColor, boolean pDropShadow)
    • drawStringWithBackdrop

      public void drawStringWithBackdrop(Font pFont, Component pText, int pX, int pY, int pWidth, int pColor)
    • renderOutline

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

      public void blitSprite(RenderPipeline pPipeline, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight)
    • blitSprite

      public void blitSprite(RenderPipeline pPipeline, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight, float pFade)
    • blitSprite

      public void blitSprite(RenderPipeline pPipeline, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight, int pColor)
    • blitSprite

      public void blitSprite(RenderPipeline pPipeline, ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pU, int pV, int pX, int pY, int pWidth, int pHeight)
    • blitSprite

      public void blitSprite(RenderPipeline pPipeline, ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pU, int pV, int pX, int pY, int pWidth, int pHeight, int pColor)
    • blitSprite

      public void blitSprite(RenderPipeline pPipeline, TextureAtlasSprite pSprite, int pX, int pWidth, int pY, int pHeight)
    • blitSprite

      public void blitSprite(RenderPipeline pPipeline, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pColor)
    • blitSprite

      private void blitSprite(RenderPipeline pPipeline, TextureAtlasSprite pSprite, int pTextureWidth, int pTextureHeight, int pU, int pV, int pX, int pY, int pWidth, int pHeight, int pColor)
    • blitNineSlicedSprite

      private void blitNineSlicedSprite(RenderPipeline pPipeline, TextureAtlasSprite pSprite, GuiSpriteScaling.NineSlice pNineSlice, int pX, int pY, int pWidth, int pHeight, int pColor)
    • blitNineSliceInnerSegment

      private void blitNineSliceInnerSegment(RenderPipeline pPipeline, GuiSpriteScaling.NineSlice pNineSlice, TextureAtlasSprite pSprite, int pBorderMinX, int pBorderMinY, int pBorderMaxX, int pBorderMaxY, int pU, int pV, int pSpriteWidth, int pSpriteHeight, int pTextureWidth, int pTextureHeight, int pColor)
    • blitTiledSprite

      private void blitTiledSprite(RenderPipeline pPipeline, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pU, int pV, int pSpriteWidth, int pSpriteHeight, int pTextureWidth, int pTextureHeight, int pColor)
    • blit

      public void blit(RenderPipeline pPipeline, ResourceLocation pAtlas, int pX, int pY, float pU, float pV, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight, int pColor)
    • blit

      public void blit(RenderPipeline pPipeline, ResourceLocation pAtlas, int pX, int pY, float pU, float pV, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight)
    • blit

      public void blit(RenderPipeline pPipeline, ResourceLocation pAtlas, int pX, int pY, float pU, float pV, int pWidth, int pHeight, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight)
    • blit

      public void blit(RenderPipeline pPipeline, ResourceLocation pAtlas, int pX, int pY, float pU, float pV, int pWidth, int pHeight, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight, int pColor)
    • blit

      public void blit(ResourceLocation pAtlas, int pX0, int pY0, int pX1, int pY1, float pU0, float pU1, float pV0, float pV1)
    • innerBlit

      private void innerBlit(RenderPipeline pPipeline, ResourceLocation pAtlas, int pX0, int pX1, int pY0, int pY1, float pU0, float pU1, float pV0, float pV1, int pColor)
    • submitBlit

      private void submitBlit(RenderPipeline pPipeline, GpuTextureView pAtlasTexture, int pX0, int pY0, int pX1, int pY1, float pU0, float pU1, float pV0, float pV1, int pColor)
    • renderItem

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

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

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

      public void renderFakeItem(ItemStack pStack, int pX, int pY, int pSeed)
    • renderItem

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

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

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

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

      public void setTooltipForNextFrame(Component pText, int pX, int pY)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(List<FormattedCharSequence> pLines, int pX, int pY)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font pFont, ItemStack pStack, int pX, int pY)
    • 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 pFont, List<Component> pLines, Optional<TooltipComponent> pTooltipImage, int pX, int pY)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font pFont, List<Component> pLines, Optional<TooltipComponent> pTooltipImage, int pX, int pY, @Nullable ResourceLocation pBackground)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font pFont, Component pText, int pX, int pY)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font pFont, Component pText, int pX, int pY, @Nullable ResourceLocation pBackground)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font pFont, List<Component> pLines, int pX, int pY)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font pFont, List<Component> pLines, int pX, int pY, @Nullable ResourceLocation pBackground)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font pFont, List<? extends FormattedText> pLines, int pX, int pY, ItemStack stack)
    • setComponentTooltipForNextFrame

      public void setComponentTooltipForNextFrame(Font pFont, List<? extends FormattedText> pLines, int pX, int pY, 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 pFont, List<? extends FormattedCharSequence> pLines, int pX, int pY)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font pFont, List<? extends FormattedCharSequence> pLines, int pX, int pY, @Nullable ResourceLocation pBackground)
    • setTooltipForNextFrame

      public void setTooltipForNextFrame(Font pFont, List<FormattedCharSequence> pLines, ClientTooltipPositioner pPositioner, int pX, int pY, boolean pFocused)
    • setTooltipForNextFrameInternal

      private void setTooltipForNextFrameInternal(Font pFont, List<ClientTooltipComponent> pComponents, int pX, int pY, ClientTooltipPositioner pPositioner, @Nullable ResourceLocation pBackground, boolean pFocused)
    • renderTooltip

      public void renderTooltip(Font pFont, List<ClientTooltipComponent> pComponents, int pX, int pY, ClientTooltipPositioner pPositioner, @Nullable ResourceLocation pBackground)
    • renderTooltip

      public void renderTooltip(Font pFont, List<ClientTooltipComponent> pComponents, int pX, int pY, ClientTooltipPositioner pPositioner, @Nullable ResourceLocation pBackground, ItemStack tooltipStack)
    • renderDeferredTooltip

      public void renderDeferredTooltip()
    • renderItemBar

      private void renderItemBar(ItemStack pStack, int pX, int pY)
    • renderItemCount

      private void renderItemCount(Font pFont, ItemStack pStack, int pX, int pY, @Nullable String pText)
    • renderItemCooldown

      private void renderItemCooldown(ItemStack pStack, int pX, int pY)
    • renderComponentHoverEffect

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

      public void submitMapRenderState(MapRenderState pRenderState)
    • submitEntityRenderState

      public void submitEntityRenderState(EntityRenderState p_415907_, float p_415695_, org.joml.Vector3f p_415772_, org.joml.Quaternionf p_416089_, @Nullable org.joml.Quaternionf p_416355_, int p_416675_, int p_416412_, int p_415766_, int p_416432_)
    • submitSkinRenderState

      public void submitSkinRenderState(PlayerModel pPlayerModel, ResourceLocation pTexture, float pScale, float pRotationX, float pRotationY, float pPivotY, int pX0, int pY0, int pX1, int pY1)
    • submitBookModelRenderState

      public void submitBookModelRenderState(BookModel pBookModel, ResourceLocation pTexture, float pScale, float pOpen, float pFlip, int pX0, int pY0, int pX1, int pY1)
    • submitBannerPatternRenderState

      public void submitBannerPatternRenderState(ModelPart pFlag, DyeColor pBaseColor, BannerPatternLayers pResultBannerPatterns, int pX0, int pY0, int pX1, int pY1)
    • submitSignRenderState

      public void submitSignRenderState(Model pSignModel, float pScale, WoodType pWoodType, int pX0, int pY0, int pX1, int pY1)
    • submitProfilerChartRenderState

      public void submitProfilerChartRenderState(List<ResultField> pChartData, int pX0, int pY0, int pX1, int pY1)
    • 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