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
private boolean
static final float
static final float
private final Minecraft
private final PoseStack
private final GuiGraphics.ScissorStack
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
(int pX, int pY, int pBlitOffset, int pWidth, int pHeight, TextureAtlasSprite pSprite) Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates.void
blit
(int pX, int pY, int pBlitOffset, int pWidth, int pHeight, TextureAtlasSprite pSprite, float pRed, float pGreen, float pBlue, float pAlpha) Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates with a color tint.void
blit
(ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight) 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 pAtlasLocation, int pX, int pY, int pBlitOffset, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight) 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 pAtlasLocation, int pX, int pY, int pWidth, int pHeight, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight) 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 pAtlasLocation, int pX, int pY, int pUOffset, int pVOffset, int pUWidth, int pVHeight) Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates.(package private) void
blit
(ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, int pBlitOffset, int pUWidth, int pVHeight, float pUOffset, float pVOffset, int pTextureWidth, int pTextureHeight) Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates.private void
blitNineSlicedSprite
(TextureAtlasSprite pSprite, GuiSpriteScaling.NineSlice pNineSlice, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) private void
blitSprite
(TextureAtlasSprite pSprite, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) private void
blitSprite
(TextureAtlasSprite pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pBlitOffset, int pUWidth, int pVHeight) void
blitSprite
(ResourceLocation pSprite, int pX, int pY, int pWidth, int pHeight) void
blitSprite
(ResourceLocation pSprite, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) void
blitSprite
(ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pUWidth, int pVHeight) void
blitSprite
(ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pBlitOffset, int pUWidth, int pVHeight) private void
blitTiledSprite
(TextureAtlasSprite pSprite, int pX, int pY, int pBlitOffset, int pWidth, int pHeight, int pUPosition, int pVPosition, int pSpriteWidth, int pSpriteHeight, int pNineSliceWidth, int pNineSliceHeight) 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
drawManaged
(Runnable pRunnable) Deprecated.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
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()
private void
Deprecated.private void
Deprecated.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.(package private) void
innerBlit
(ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, int pBlitOffset, float pMinU, float pMaxU, float pMinV, float pMaxV) Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates without color tinting.(package private) void
innerBlit
(ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, int pBlitOffset, float pMinU, float pMaxU, float pMinV, float pMaxV, float pRed, float pGreen, float pBlue, float pAlpha) Performs the inner blit operation for rendering a texture with the specified coordinates, texture coordinates, and color tint.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<Component> pTooltipLines, int pMouseX, int pMouseY) 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 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.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<Component> pTooltipLines, Optional<TooltipComponent> pVisualTooltipComponent, int pMouseX, int pMouseY) 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 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, 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> pComponents, int pMouseX, int pMouseY, ClientTooltipPositioner pTooltipPositioner) Renders an internal tooltip with customizable tooltip components at the specified mouse coordinates using a tooltip positioner.void
setColor
(float pRed, float pGreen, float pBlue, float pAlpha) Sets the current rendering color.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, blitWithBorder, blitWithBorder, 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
-
managed
private boolean managed -
tooltipStack
-
-
Constructor Details
-
GuiGraphics
private GuiGraphics(Minecraft pMinecraft, PoseStack pPose, MultiBufferSource.BufferSource pBufferSource) -
GuiGraphics
-
-
Method Details
-
drawManaged
Deprecated.Executes a runnable while managing the render state. The render state is flushed before and after executing the runnable.- Parameters:
pRunnable
- the runnable to execute.
-
flushIfUnmanaged
Deprecated. -
flushIfManaged
Deprecated. -
guiWidth
public int guiWidth() -
guiHeight
public int guiHeight() -
pose
-
bufferSource
-
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) -
setColor
public void setColor(float pRed, float pGreen, float pBlue, float pAlpha) Sets the current rendering color.- Parameters:
pRed
- the red component of the color.pGreen
- the green component of the color.pBlue
- the blue component of the color.pAlpha
- the alpha component of the color.
-
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.
-
drawStringWithBackdrop
-
blit
public void blit(int pX, int pY, int pBlitOffset, int pWidth, int pHeight, TextureAtlasSprite pSprite) Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates.- Parameters:
pX
- the x-coordinate of the blit position.pY
- the y-coordinate of the blit position.pBlitOffset
- the z-level offset for rendering order.pWidth
- the width of the blitted portion.pHeight
- the height of the blitted portion.pSprite
- the texture atlas sprite to blit.
-
blit
public void blit(int pX, int pY, int pBlitOffset, int pWidth, int pHeight, TextureAtlasSprite pSprite, float pRed, float pGreen, float pBlue, float pAlpha) Blits a portion of the specified texture atlas sprite onto the screen at the given coordinates with a color tint.- Parameters:
pX
- the x-coordinate of the blit position.pY
- the y-coordinate of the blit position.pBlitOffset
- the z-level offset for rendering order.pWidth
- the width of the blitted portion.pHeight
- the height of the blitted portion.pSprite
- the texture atlas sprite to blit.pRed
- the red component of the color tint.pGreen
- the green component of the color tint.pBlue
- the blue component of the color tint.pAlpha
- the alpha component of the color tint.
-
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
-
blitSprite
public void blitSprite(ResourceLocation pSprite, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) -
blitSprite
public void blitSprite(ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pUWidth, int pVHeight) -
blitSprite
public void blitSprite(ResourceLocation pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pBlitOffset, int pUWidth, int pVHeight) -
blitSprite
private void blitSprite(TextureAtlasSprite pSprite, int pTextureWidth, int pTextureHeight, int pUPosition, int pVPosition, int pX, int pY, int pBlitOffset, int pUWidth, int pVHeight) -
blitSprite
private void blitSprite(TextureAtlasSprite pSprite, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) -
blit
public void blit(ResourceLocation pAtlasLocation, int pX, int pY, int pUOffset, int pVOffset, int pUWidth, int pVHeight) Blits a portion of the texture specified by the atlas location onto the screen at the given coordinates.- Parameters:
pAtlasLocation
- the location of the texture atlas.pX
- the x-coordinate of the blit position.pY
- the y-coordinate of the blit position.pUOffset
- the horizontal texture coordinate offset.pVOffset
- the vertical texture coordinate offset.pUWidth
- the width of the blitted portion in texture coordinates.pVHeight
- the height of the blitted portion in texture coordinates.
-
blit
public void blit(ResourceLocation pAtlasLocation, int pX, int pY, int pBlitOffset, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight) 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:
pAtlasLocation
- the location of the texture atlas.pX
- the x-coordinate of the blit position.pY
- the y-coordinate of the blit position.pBlitOffset
- the z-level offset for rendering order.pUOffset
- the horizontal texture coordinate offset.pVOffset
- the vertical texture coordinate offset.pUWidth
- the width of the blitted portion in texture coordinates.pVHeight
- the height of the blitted portion in texture coordinates.pTextureWidth
- the width of the texture.pTextureHeight
- the height of the texture.
-
blit
public void blit(ResourceLocation pAtlasLocation, int pX, int pY, int pWidth, int pHeight, float pUOffset, float pVOffset, int pUWidth, int pVHeight, int pTextureWidth, int pTextureHeight) Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates.- Parameters:
pAtlasLocation
- the location of the texture atlas.pX
- the x-coordinate of the top-left corner of the blit position.pY
- the y-coordinate of the top-left corner of the blit position.pWidth
- the width of the blitted portion.pHeight
- the height of the blitted portion.pUOffset
- the horizontal texture coordinate offset.pVOffset
- the vertical texture coordinate offset.pUWidth
- the width of the blitted portion in texture coordinates.pVHeight
- the height of the blitted portion in texture coordinates.pTextureWidth
- the width of the texture.pTextureHeight
- the height of the texture.
-
blit
public void blit(ResourceLocation pAtlasLocation, int pX, int pY, float pUOffset, float pVOffset, int pWidth, int pHeight, int pTextureWidth, int pTextureHeight) Blits a portion of the texture specified by the atlas location onto the screen at the given position and dimensions with texture coordinates.- Parameters:
pAtlasLocation
- the location of the texture atlas.pX
- the x-coordinate of the top-left corner of the blit position.pY
- the y-coordinate of the top-left corner of the blit position.pUOffset
- the horizontal texture coordinate offset.pVOffset
- the vertical texture coordinate offset.pWidth
- the width of the blitted portion.pHeight
- the height of the blitted portion.pTextureWidth
- the width of the texture.pTextureHeight
- the height of the texture.
-
blit
void blit(ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, int pBlitOffset, int pUWidth, int pVHeight, float pUOffset, float pVOffset, int pTextureWidth, int pTextureHeight) Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates.- Parameters:
pAtlasLocation
- the location of the texture atlas.pX1
- the x-coordinate of the first corner of the blit position .pX2
- the x-coordinate of the second corner of the blit position.pY1
- the y-coordinate of the first corner of the blit position .pY2
- the y-coordinate of the second corner of the blit position.pBlitOffset
- the z-level offset for rendering order.pUWidth
- the width of the blitted portion in texture coordinates.pVHeight
- the height of the blitted portion in texture coordinates.pUOffset
- the horizontal texture coordinate offset.pVOffset
- the vertical texture coordinate offset.pTextureWidth
- the width of the texture.pTextureHeight
- the height of the texture.
-
innerBlit
void innerBlit(ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, int pBlitOffset, float pMinU, float pMaxU, float pMinV, float pMaxV) Performs the inner blit operation for rendering a texture with the specified coordinates and texture coordinates without color tinting.- Parameters:
pAtlasLocation
- the location of the texture atlas.pX1
- the x-coordinate of the first corner of the blit position .pX2
- the x-coordinate of the second corner of the blit position.pY1
- the y-coordinate of the first corner of the blit position .pY2
- the y-coordinate of the second corner of the blit position.pBlitOffset
- the z-level offset for rendering order.pMinU
- the minimum horizontal texture coordinate.pMaxU
- the maximum horizontal texture coordinate.pMinV
- the minimum vertical texture coordinate.pMaxV
- the maximum vertical texture coordinate.
-
innerBlit
void innerBlit(ResourceLocation pAtlasLocation, int pX1, int pX2, int pY1, int pY2, int pBlitOffset, float pMinU, float pMaxU, float pMinV, float pMaxV, float pRed, float pGreen, float pBlue, float pAlpha) Performs the inner blit operation for rendering a texture with the specified coordinates, texture coordinates, and color tint.- Parameters:
pAtlasLocation
- the location of the texture atlas.pX1
- the x-coordinate of the first corner of the blit position .pX2
- the x-coordinate of the second corner of the blit position.pY1
- the y-coordinate of the first corner of the blit position .pY2
- the y-coordinate of the second corner of the blit position.pBlitOffset
- the z-level offset for rendering order.pMinU
- the minimum horizontal texture coordinate.pMaxU
- the maximum horizontal texture coordinate.pMinV
- the minimum vertical texture coordinate.pMaxV
- the maximum vertical texture coordinate.pRed
- the red component of the color tint.pGreen
- the green component of the color tint.pBlue
- the blue component of the color tint.pAlpha
- the alpha component of the color tint.
-
blitNineSlicedSprite
private void blitNineSlicedSprite(TextureAtlasSprite pSprite, GuiSpriteScaling.NineSlice pNineSlice, int pX, int pY, int pBlitOffset, int pWidth, int pHeight) -
blitTiledSprite
private void blitTiledSprite(TextureAtlasSprite pSprite, int pX, int pY, int pBlitOffset, int pWidth, int pHeight, int pUPosition, int pVPosition, int pSpriteWidth, int pSpriteHeight, int pNineSliceWidth, int pNineSliceHeight) -
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 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
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.
-
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<? 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.
-
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 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<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> pComponents, int pMouseX, int pMouseY, ClientTooltipPositioner pTooltipPositioner) Renders an internal tooltip with customizable tooltip components at the specified mouse coordinates using a tooltip positioner.- Parameters:
pFont
- the font used for rendering text.pComponents
- the tooltip components to render.pMouseX
- the x-coordinate of the mouse position.pMouseY
- the y-coordinate of the mouse position.pTooltipPositioner
- the positioner to determine the tooltip's position.
-
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.
-