Package net.minecraft.client.gui
Class GuiGraphics
java.lang.Object
net.minecraft.client.gui.GuiGraphics
- All Implemented Interfaces:
IGuiGraphicsExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
A utility class for managing a stack of screen rectangles for scissoring. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MultiBufferSource.BufferSource
private static final int
static final float
static final float
private final Minecraft
private final PoseStack
private final GuiGraphics.ScissorStack
private final ItemStackRenderState
private final GuiSpriteManager
private ItemStack
Fields inherited from interface net.neoforged.neoforge.client.extensions.IGuiGraphicsExtension
DEFAULT_BACKGROUND_COLOR, DEFAULT_BORDER_COLOR_END, DEFAULT_BORDER_COLOR_START, INVALID, RESET_CHAR, TEXT_COLOR_CODES, UNDO_CHAR, VALID
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
GuiGraphics
(Minecraft pMinecraft, PoseStack pPose, MultiBufferSource.BufferSource pBufferSource) GuiGraphics
(Minecraft pMinecraft, MultiBufferSource.BufferSource pBufferSource) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
applyScissor
(ScreenRectangle pRectangle) Applies scissoring based on the provided screen rectangle.void
blit
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight) void
blit
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight, int pColor) void
blit
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight) void
blit
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight, int pColor) private void
blitNineSlicedSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, GuiSpriteScaling.NineSlice pNineSlice, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) private void
blitNineSliceInnerSegment
(Function<ResourceLocation, RenderType> pRenderTypeGetter, GuiSpriteScaling.NineSlice pNineSlice, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pUPosition, int pVPosition, int pSpriteWidth, int pSpriteHeight, int pNineSliceWidth, int pNineSliceHeight, int pBlitOffset) void
blitSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight) void
blitSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pBlitOffset) private void
blitSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pUWidth, int pVHeight, int pBlitOffset) void
blitSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight) void
blitSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight, int pBlitOffset) void
blitSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pUWidth, int pVHeight) private void
blitTiledSprite
(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pUPosition, int pVPosition, int pSpriteWidth, int pSpriteHeight, int pNineSliceWidth, int pNineSliceHeight, int pBlitOffset) boolean
containsPointInScissor
(int pX, int pY) void
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.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.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.void
drawSpecial
(Consumer<MultiBufferSource> pDrawer) int
drawString
(Font p_283343_, String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_) int
drawString
(Font pFont, String pText, int pX, int pY, int pColor) Draws a string at the specified coordinates using the given font, text, and color.int
drawString
(Font pFont, String pText, int pX, int pY, int pColor, boolean pDropShadow) Draws a string at the specified coordinates using the given font, text, color, and drop shadow.int
drawString
(Font pFont, Component pText, int pX, int pY, int pColor) Draws a component's visual order text at the specified coordinates using the given font, text component, and color.int
drawString
(Font pFont, Component pText, int pX, int pY, int pColor, boolean pDropShadow) 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 pFont, FormattedCharSequence pText, int pX, int pY, int pColor) Draws a formatted character sequence at the specified coordinates using the given font, text, and color.int
drawString
(Font pFont, FormattedCharSequence pText, int pX, int pY, int pColor, boolean pDropShadow) Draws a formatted character sequence at the specified coordinates using the given font, text, color, and drop shadow.int
drawStringWithBackdrop
(Font pFont, Component pText, int pX, int pY, int pXOffset, int pColor) 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.void
drawWordWrap
(Font pFont, FormattedText pText, int pX, int pY, int pLineWidth, int pColor, boolean pDropShadow) void
enableScissor
(int pMinX, int pMinY, int pMaxX, int pMaxY) Enables scissoring with the specified screen coordinates.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.void
fill
(int pMinX, int pMinY, int pMaxX, int pMaxY, int pZ, int pColor) Fills a rectangle with the specified color and z-level using the given coordinates as the boundaries.void
fill
(RenderType pRenderType, int pMinX, int pMinY, int pMaxX, int pMaxY, int pColor) Fills a rectangle with the specified color using the given render type and coordinates as the boundaries.void
fill
(RenderType pRenderType, int pMinX, int pMinY, int pMaxX, int pMaxY, int pZ, int pColor) Fills a rectangle with the specified color and z-level using the given render type and coordinates as the boundaries.void
fillGradient
(int pX1, int pY1, int pX2, int pY2, int pColorFrom, int pColorTo) Fills a rectangle with a gradient color from colorFrom to colorTo using the given coordinates as the boundaries.void
fillGradient
(int pX1, int pY1, int pX2, int pY2, int pZ, int pColorFrom, int pColorTo) 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 pConsumer, int pX1, int pY1, int pX2, int pY2, int pZ, int pColorFrom, int pColorTo) The core `fillGradient` method.void
fillGradient
(RenderType pRenderType, int pX1, int pY1, int pX2, int pY2, int pColorFrom, int pColorTo, int pZ) 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 pRenderType, int pX1, int pY1, int pX2, int pY2, int pZ) void
flush()
int
int
guiWidth()
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.void
hLine
(RenderType pRenderType, 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 using the specified render type.private void
innerBlit
(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, float pMinU, float pMaxU, float pMinV, float pMaxV, int pColor) pose()
void
renderComponentHoverEffect
(Font pFont, Style pStyle, int pMouseX, int pMouseY) Renders a hover effect for a text component at the specified mouse coordinates.void
renderComponentTooltip
(Font pFont, List<? extends FormattedText> pTooltipLines, int pMouseX, int pMouseY, ItemStack stack) Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.void
renderComponentTooltip
(Font pFont, List<? extends FormattedText> pTooltipLines, int pMouseX, int pMouseY, ItemStack stack, ResourceLocation backgroundTexture) Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.void
renderComponentTooltip
(Font pFont, List<Component> pTooltipLines, int pMouseX, int pMouseY) Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.void
renderComponentTooltip
(Font pFont, List<Component> pTooltipLines, int pMouseX, int pMouseY, ResourceLocation pSprite) void
renderComponentTooltipFromElements
(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) void
renderComponentTooltipFromElements
(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack, ResourceLocation backgroundTexture) void
renderFakeItem
(ItemStack pStack, int pX, int pY) Renders a fake item stack at the specified coordinates.void
renderFakeItem
(ItemStack pStack, int pX, int pY, int pSeed) 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.private void
renderItem
(LivingEntity pEntity, 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.private void
renderItem
(LivingEntity pEntity, Level pLevel, ItemStack pStack, int pX, int pY, int pSeed, int pGuiOffset) 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 pStack, int pX, int pY) Renders an item stack at the specified coordinates.void
renderItem
(ItemStack pStack, int pX, int pY, int pSeed) Renders an item stack at the specified coordinates with a random seed.void
renderItem
(ItemStack pStack, int pX, int pY, int pSeed, int pGuiOffset) Renders an item stack at the specified coordinates with a random seed and a custom value.private void
renderItemBar
(ItemStack pStack, int pX, int pY) private void
renderItemCooldown
(ItemStack pStack, int pX, int pY) private void
renderItemCount
(Font pFont, ItemStack pStack, int pX, int pY, String pText) void
renderItemDecorations
(Font pFont, ItemStack pStack, int pX, int pY) Renders additional decorations for an item stack at the specified coordinates.void
renderItemDecorations
(Font pFont, ItemStack pStack, int pX, int pY, String pText) Renders additional decorations for an item stack at the specified coordinates with optional custom text.void
renderOutline
(int pX, int pY, int pWidth, int pHeight, int pColor) Renders an outline rectangle on the screen with the specified color.void
renderTooltip
(Font pFont, List<? extends FormattedCharSequence> pTooltipLines, int pMouseX, int pMouseY) Renders a tooltip with multiple lines of formatted text at the specified mouse coordinates.void
renderTooltip
(Font pFont, List<? extends FormattedCharSequence> pTooltipLines, int pMouseX, int pMouseY, ResourceLocation pSprite) void
renderTooltip
(Font pFont, List<Component> pTooltipLines, Optional<TooltipComponent> pVisualTooltipComponent, int pMouseX, int pMouseY) Renders a tooltip with customizable components at the specified mouse coordinates.void
renderTooltip
(Font pFont, List<Component> pTooltipLines, Optional<TooltipComponent> pVisualTooltipComponent, int pMouseX, int pMouseY, ResourceLocation pSprite) void
renderTooltip
(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) void
renderTooltip
(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY, ResourceLocation backgroundTexture) void
renderTooltip
(Font pFont, List<FormattedCharSequence> pTooltipLines, ClientTooltipPositioner pTooltipPositioner, int pMouseX, int pMouseY) Renders a tooltip with multiple lines of formatted text using a custom tooltip positioner at the specified mouse coordinates.void
renderTooltip
(Font pFont, Component pText, int pMouseX, int pMouseY) Renders a tooltip with a single line of text at the specified mouse coordinates.void
renderTooltip
(Font pFont, Component pText, int pMouseX, int pMouseY, ResourceLocation pSprite) void
renderTooltip
(Font pFont, ItemStack pStack, int pMouseX, int pMouseY) Renders a tooltip for an item stack at the specified mouse coordinates.private void
renderTooltipInternal
(Font pFont, List<ClientTooltipComponent> pTooltipLines, int pMouseX, int pMouseY, ClientTooltipPositioner pTooltipPositioner, ResourceLocation pSprite) 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.void
vLine
(RenderType pRenderType, 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 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, drawScrollingString, getColorFromFormattingCharacter
-
Field Details
-
MAX_GUI_Z
public static final float MAX_GUI_Z- See Also:
-
MIN_GUI_Z
public static final float MIN_GUI_Z- See Also:
-
EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE- See Also:
-
minecraft
-
pose
-
bufferSource
-
scissorStack
-
sprites
-
scratchItemStackRenderState
-
tooltipStack
-
-
Constructor Details
-
GuiGraphics
private GuiGraphics(Minecraft pMinecraft, PoseStack pPose, MultiBufferSource.BufferSource pBufferSource) -
GuiGraphics
-
-
Method Details
-
guiWidth
public int guiWidth() -
guiHeight
public int guiHeight() -
pose
-
flush
public void flush() -
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.
-
hLine
Draws a horizontal line from minX to maxX at the specified y-coordinate with the given color using the specified render type.- Parameters:
pRenderType
- the render type to use.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.
-
vLine
Draws a vertical line from minY to maxY at the specified x-coordinate with the given color using the specified render type.- Parameters:
pRenderType
- the render type to use.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(int pMinX, int pMinY, int pMaxX, int pMaxY, int pZ, int pColor) Fills a rectangle with the specified color and z-level 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.pZ
- the z-level of the rectangle.pColor
- the color to fill the rectangle with.
-
fill
Fills a rectangle with the specified color using the given render type and coordinates as the boundaries.- Parameters:
pRenderType
- the render type to use.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(RenderType pRenderType, int pMinX, int pMinY, int pMaxX, int pMaxY, int pZ, int pColor) Fills a rectangle with the specified color and z-level using the given render type and coordinates as the boundaries.- Parameters:
pRenderType
- the render type to use.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.pZ
- the z-level of the rectangle.pColor
- the color to fill the rectangle with.
-
fillGradient
public void fillGradient(int pX1, int pY1, int pX2, int pY2, int pColorFrom, int pColorTo) Fills a rectangle with a gradient color from colorFrom to colorTo using the given coordinates as the boundaries.- Parameters:
pX1
- the x-coordinate of the first corner of the rectangle.pY1
- the y-coordinate of the first corner of the rectangle.pX2
- the x-coordinate of the second corner of the rectangle.pY2
- the y-coordinate of the second corner of the rectangle.pColorFrom
- the starting color of the gradient.pColorTo
- the ending color of the gradient.
-
fillGradient
public void fillGradient(int pX1, int pY1, int pX2, int pY2, int pZ, int pColorFrom, int pColorTo) Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given coordinates as the boundaries.- Parameters:
pX1
- the x-coordinate of the first corner of the rectangle.pY1
- the y-coordinate of the first corner of the rectangle.pX2
- the x-coordinate of the second corner of the rectangle.pY2
- the y-coordinate of the second corner of the rectangle.pZ
- the z-level of the rectangle.pColorFrom
- the starting color of the gradient.pColorTo
- the ending color of the gradient.
-
fillGradient
public void fillGradient(RenderType pRenderType, int pX1, int pY1, int pX2, int pY2, int pColorFrom, int pColorTo, int pZ) 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:
pRenderType
- the render type to use.pX1
- the x-coordinate of the first corner of the rectangle.pY1
- the y-coordinate of the first corner of the rectangle.pX2
- the x-coordinate of the second corner of the rectangle.pY2
- the y-coordinate of the second corner of the rectangle.pColorFrom
- the starting color of the gradient.pColorTo
- the ending color of the gradient.pZ
- the z-level of the rectangle.
-
fillGradient
private void fillGradient(VertexConsumer pConsumer, int pX1, int pY1, int pX2, int pY2, int pZ, int pColorFrom, int pColorTo) 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:
pConsumer
- the VertexConsumer object for drawing the vertices on screen.pX1
- the x-coordinate of the first corner of the rectangle.pY1
- the y-coordinate of the first corner of the rectangle.pX2
- the x-coordinate of the second corner of the rectangle.pY2
- the y-coordinate of the second corner of the rectangle.pZ
- the z-level of the rectangle.pColorFrom
- the starting color of the gradient.pColorTo
- the ending color of the gradient.
-
fillRenderType
-
drawCenteredString
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
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
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
Draws a string at the specified coordinates using the given font, text, and color. Returns the width of the drawn string.- Parameters:
pFont
- the font to use for rendering.pText
- the text to draw.pX
- the x-coordinate of the string.pY
- the y-coordinate of the string.pColor
- the color of the string.- Returns:
- the width of the drawn string.
-
drawString
public int drawString(Font pFont, @Nullable String pText, int pX, int pY, int pColor, boolean pDropShadow) Draws a string at the specified coordinates using the given font, text, color, and drop shadow. Returns the width of the drawn string.- Parameters:
pFont
- the font to use for rendering.pText
- the text to draw.pX
- the x-coordinate of the string.pY
- the y-coordinate of the string.pColor
- the color of the string.pDropShadow
- whether to apply a drop shadow to the string.- Returns:
- the width of the drawn string.
-
drawString
-
drawString
Draws a formatted character sequence at the specified coordinates using the given font, text, and color. Returns the width of the drawn string.- Parameters:
pFont
- the font to use for rendering.pText
- the formatted character sequence to draw.pX
- the x-coordinate of the string.pY
- the y-coordinate of the string.pColor
- the color of the string- Returns:
- the width of the drawn string.
-
drawString
public int drawString(Font pFont, FormattedCharSequence pText, int pX, int pY, int pColor, boolean pDropShadow) 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:
pFont
- the font to use for rendering.pText
- the formatted character sequence to draw.pX
- the x-coordinate of the string.pY
- the y-coordinate of the string.pColor
- the color of the string.pDropShadow
- 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
Draws a component's visual order text 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 string.pY
- the y-coordinate of the string.pColor
- the color of the string.- Returns:
- the width of the drawn string.
-
drawString
Draws a component's visual order text at the specified coordinates using the given font, text component, color, and drop shadow.- Parameters:
pFont
- the font to use for rendering.pText
- the text component to draw.pX
- the x-coordinate of the string.pY
- the y-coordinate of the string.pColor
- the color of the string.pDropShadow
- whether to apply a drop shadow to the string.- Returns:
- the width of the drawn string.
-
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
-
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(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight) -
blitSprite
public void blitSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight, int pBlitOffset) -
blitSprite
public void blitSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pUWidth, int pVHeight) -
blitSprite
public void blitSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight) -
blitSprite
public void blitSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pBlitOffset) -
blitSprite
private void blitSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pUWidth, int pVHeight, int pBlitOffset) -
blitNineSlicedSprite
private void blitNineSlicedSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, GuiSpriteScaling.NineSlice pNineSlice, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) -
blitNineSliceInnerSegment
private void blitNineSliceInnerSegment(Function<ResourceLocation, RenderType> pRenderTypeGetter, GuiSpriteScaling.NineSlice pNineSlice, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pUPosition, int pVPosition, int pSpriteWidth, int pSpriteHeight, int pNineSliceWidth, int pNineSliceHeight, int pBlitOffset) -
blitTiledSprite
private void blitTiledSprite(Function<ResourceLocation, RenderType> pRenderTypeGetter, TextureAtlasSprite pSprite, int pX, int pY, int pWidth, int pHeight, int pUPosition, int pVPosition, int pSpriteWidth, int pSpriteHeight, int pNineSliceWidth, int pNineSliceHeight, int pBlitOffset) -
blit
public void blit(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight, int pColor) -
blit
public void blit(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight) -
blit
public void blit(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight) -
blit
public void blit(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight, int pColor) -
innerBlit
private void innerBlit(Function<ResourceLocation, RenderType> pRenderTypeGetter, ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, float pMinU, float pMaxU, float pMinV, float pMaxV, int pColor) -
renderItem
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
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.
-
renderItem
Renders an item stack at the specified coordinates with a random seed and a custom value.- 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.pGuiOffset
- the GUI offset.
-
renderFakeItem
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
-
renderItem
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.
-
renderItem
private void renderItem(@Nullable LivingEntity pEntity, @Nullable Level pLevel, ItemStack pStack, int pX, int pY, int pSeed, int pGuiOffset) 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:
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.pGuiOffset
- the GUI offset value.
-
renderItemDecorations
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.
-
renderTooltip
Renders a tooltip for an item stack at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pStack
- the item stack to display the tooltip for.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderTooltip
-
renderTooltip
public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY, @Nullable ResourceLocation backgroundTexture) -
renderTooltip
public void renderTooltip(Font pFont, List<Component> pTooltipLines, Optional<TooltipComponent> pVisualTooltipComponent, int pMouseX, int pMouseY) Renders a tooltip with customizable components at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pTooltipLines
- the lines of the tooltip.pVisualTooltipComponent
- the visual tooltip component. Can be empty.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderTooltip
public void renderTooltip(Font pFont, List<Component> pTooltipLines, Optional<TooltipComponent> pVisualTooltipComponent, int pMouseX, int pMouseY, @Nullable ResourceLocation pSprite) -
renderTooltip
Renders a tooltip with a single line of text at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pText
- the text to display in the tooltip.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderTooltip
public void renderTooltip(Font pFont, Component pText, int pMouseX, int pMouseY, @Nullable ResourceLocation pSprite) -
renderComponentTooltip
public void renderComponentTooltip(Font pFont, List<Component> pTooltipLines, int pMouseX, int pMouseY) Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pTooltipLines
- the lines of the tooltip as components.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderComponentTooltip
public void renderComponentTooltip(Font pFont, List<Component> pTooltipLines, int pMouseX, int pMouseY, @Nullable ResourceLocation pSprite) -
renderComponentTooltip
public void renderComponentTooltip(Font pFont, List<? extends FormattedText> pTooltipLines, int pMouseX, int pMouseY, ItemStack stack) Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pTooltipLines
- the lines of the tooltip as components.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderComponentTooltip
public void renderComponentTooltip(Font pFont, List<? extends FormattedText> pTooltipLines, int pMouseX, int pMouseY, ItemStack stack, @Nullable ResourceLocation backgroundTexture) Renders a tooltip with multiple lines of component-based text at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pTooltipLines
- the lines of the tooltip as components.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderComponentTooltipFromElements
public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) -
renderComponentTooltipFromElements
public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack, @Nullable ResourceLocation backgroundTexture) -
renderTooltip
public void renderTooltip(Font pFont, List<? extends FormattedCharSequence> pTooltipLines, int pMouseX, int pMouseY) Renders a tooltip with multiple lines of formatted text at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pTooltipLines
- the lines of the tooltip as formatted character sequences.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderTooltip
public void renderTooltip(Font pFont, List<? extends FormattedCharSequence> pTooltipLines, int pMouseX, int pMouseY, @Nullable ResourceLocation pSprite) -
renderTooltip
public void renderTooltip(Font pFont, List<FormattedCharSequence> pTooltipLines, ClientTooltipPositioner pTooltipPositioner, int pMouseX, int pMouseY) Renders a tooltip with multiple lines of formatted text using a custom tooltip positioner at the specified mouse coordinates.- Parameters:
pFont
- the font used for rendering text.pTooltipLines
- the lines of the tooltip as formatted character sequences.pTooltipPositioner
- the positioner to determine the tooltip's position.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.
-
renderTooltipInternal
private void renderTooltipInternal(Font pFont, List<ClientTooltipComponent> pTooltipLines, int pMouseX, int pMouseY, ClientTooltipPositioner pTooltipPositioner, @Nullable ResourceLocation pSprite) -
renderItemBar
-
renderItemCount
-
renderItemCooldown
-
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.
-
drawSpecial
-