public class ScreenDrawing
extends java.lang.Object
ScreenDrawing contains utility methods for drawing contents on a screen.| Modifier and Type | Method and Description |
|---|---|
static int |
colorAtOpacity(int opaque,
float opacity) |
static void |
coloredRect(net.minecraft.client.util.math.MatrixStack matrices,
int left,
int top,
int width,
int height,
int color)
Draws an untextured rectangle of the specified RGB color.
|
static void |
drawBeveledPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y)
Draws a default-sized recessed itemslot panel
|
static void |
drawBeveledPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height)
Draws a default-color recessed itemslot panel of variable size
|
static void |
drawBeveledPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
int topleft,
int panel,
int bottomright)
Draws a generalized-case beveled panel.
|
static void |
drawGuiPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height)
Draws a beveled, round rectangle that is substantially similar to default Minecraft UI panels.
|
static void |
drawGuiPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
int panelColor)
Draws a beveled, round, and colored rectangle that is substantially similar to default Minecraft UI panels.
|
static void |
drawGuiPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
int shadow,
int panel,
int hilight,
int outline)
Draws a beveled, round rectangle with custom edge colors that is substantially similar to default Minecraft UI panels.
|
static void |
drawString(net.minecraft.client.util.math.MatrixStack matrices,
net.minecraft.text.OrderedText text,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
Draws a text component with a custom alignment.
|
static void |
drawString(net.minecraft.client.util.math.MatrixStack matrices,
net.minecraft.text.OrderedText text,
int x,
int y,
int color)
Draws a left-aligned text component.
|
static void |
drawString(net.minecraft.client.util.math.MatrixStack matrices,
java.lang.String s,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
Draws a string with a custom alignment.
|
static void |
drawString(net.minecraft.client.util.math.MatrixStack matrices,
java.lang.String s,
int x,
int y,
int color)
Draws a left-aligned string.
|
static void |
drawStringWithShadow(net.minecraft.client.util.math.MatrixStack matrices,
net.minecraft.text.OrderedText text,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
Draws a shadowed text component.
|
static void |
drawStringWithShadow(net.minecraft.client.util.math.MatrixStack matrices,
java.lang.String s,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
Draws a shadowed string.
|
static void |
drawTextHover(net.minecraft.client.util.math.MatrixStack matrices,
@Nullable net.minecraft.text.Style textStyle,
int x,
int y)
Draws the text hover effects for a text style.
|
static int |
multiplyColor(int color,
float amount) |
static void |
texturedGuiRect(net.minecraft.client.util.math.MatrixStack matrices,
int left,
int top,
int width,
int height,
net.minecraft.util.Identifier texture,
int color)
Draws a textured rectangle with UV values based on the width and height.
|
static void |
texturedGuiRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
int textureX,
int textureY,
int color)
Draws a textured rectangle with UV values based on the width and height.
|
static void |
texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
float u1,
float v1,
float u2,
float v2,
int color)
Draws a textured rectangle.
|
static void |
texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
float u1,
float v1,
float u2,
float v2,
int color,
float opacity)
Draws a textured rectangle.
|
static void |
texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
int color)
Draws a textured rectangle.
|
static void |
texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
int color,
float opacity)
Draws a textured rectangle.
|
static void |
texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
Texture texture,
int color)
Draws a textured rectangle.
|
static void |
texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
Texture texture,
int color,
float opacity)
Draws a textured rectangle.
|
public static void texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
int color)
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the Identifier for the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintpublic static void texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
int color,
float opacity)
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the Identifier for the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintopacity - opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)public static void texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
float u1,
float v1,
float u2,
float v2,
int color)
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the Identifier for the textureu1 - the left edge of the texturev1 - the top edge of the textureu2 - the right edge of the texturev2 - the bottom edge of the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintpublic static void texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
Texture texture,
int color)
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintpublic static void texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
Texture texture,
int color,
float opacity)
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintopacity - opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)public static void texturedRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
float u1,
float v1,
float u2,
float v2,
int color,
float opacity)
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the Identifier for the textureu1 - the left edge of the texturev1 - the top edge of the textureu2 - the right edge of the texturev2 - the bottom edge of the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintopacity - opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)public static void texturedGuiRect(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
net.minecraft.util.Identifier texture,
int textureX,
int textureY,
int color)
If the texture is 256x256, this draws the texture at one pixel per texel.
matrices - the rendering matrix stackx - the x coordinate of the box on-screeny - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the Identifier for the texturetextureX - the x offset into the texturetextureY - the y offset into the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintpublic static void texturedGuiRect(net.minecraft.client.util.math.MatrixStack matrices,
int left,
int top,
int width,
int height,
net.minecraft.util.Identifier texture,
int color)
If the texture is 256x256, this draws the texture at one pixel per texel.
matrices - the rendering matrix stackleft - the x coordinate of the box on-screentop - the y coordinate of the box on-screenwidth - the width of the box on-screenheight - the height of the box on-screentexture - the Identifier for the texturecolor - a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tintpublic static void coloredRect(net.minecraft.client.util.math.MatrixStack matrices,
int left,
int top,
int width,
int height,
int color)
public static void drawGuiPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height)
matrices - the rendering matrix stackx - the X position of the panely - the Y position of the panelwidth - the width of the panelheight - the height of the panelpublic static void drawGuiPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
int panelColor)
matrices - the rendering matrix stackx - the X position of the panely - the Y position of the panelwidth - the width of the panelheight - the height of the panelpanelColor - the panel ARGB colorpublic static void drawGuiPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
int shadow,
int panel,
int hilight,
int outline)
matrices - the rendering matrix stackx - the X position of the panely - the Y position of the panelwidth - the width of the panelheight - the height of the panelshadow - the bottom/right shadow ARGB colorpanel - the center ARGB colorhilight - the top/left hilight ARGB coloroutline - the outline ARGB colorpublic static void drawBeveledPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y)
public static void drawBeveledPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height)
public static void drawBeveledPanel(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int width,
int height,
int topleft,
int panel,
int bottomright)
matrices - the rendering matrix stackx - x coordinate of the topleft cornery - y coordinate of the topleft cornerwidth - width of the panelheight - height of the paneltopleft - color of the top/left bevelpanel - color of the panel areabottomright - color of the bottom/right bevelpublic static void drawString(net.minecraft.client.util.math.MatrixStack matrices,
java.lang.String s,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
matrices - the rendering matrix stacks - the stringalign - the alignment of the stringx - the X positiony - the Y positionwidth - the width of the string, used for aligningcolor - the text colorpublic static void drawString(net.minecraft.client.util.math.MatrixStack matrices,
net.minecraft.text.OrderedText text,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
matrices - the rendering matrix stacktext - the textalign - the alignment of the stringx - the X positiony - the Y positionwidth - the width of the string, used for aligningcolor - the text colorpublic static void drawStringWithShadow(net.minecraft.client.util.math.MatrixStack matrices,
java.lang.String s,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
matrices - the rendering matrix stacks - the stringalign - the alignment of the stringx - the X positiony - the Y positionwidth - the width of the string, used for aligningcolor - the text colorpublic static void drawStringWithShadow(net.minecraft.client.util.math.MatrixStack matrices,
net.minecraft.text.OrderedText text,
HorizontalAlignment align,
int x,
int y,
int width,
int color)
matrices - the rendering matrix stacktext - the text componentalign - the alignment of the stringx - the X positiony - the Y positionwidth - the width of the string, used for aligningcolor - the text colorpublic static void drawString(net.minecraft.client.util.math.MatrixStack matrices,
java.lang.String s,
int x,
int y,
int color)
matrices - the rendering matrix stacks - the stringx - the X positiony - the Y positioncolor - the text colorpublic static void drawString(net.minecraft.client.util.math.MatrixStack matrices,
net.minecraft.text.OrderedText text,
int x,
int y,
int color)
matrices - the rendering matrix stacktext - the text componentx - the X positiony - the Y positioncolor - the text colorpublic static void drawTextHover(net.minecraft.client.util.math.MatrixStack matrices,
@Nullable
@Nullable net.minecraft.text.Style textStyle,
int x,
int y)
This method should only be called from a widget in a screen. For example, there will be nothing drawn in HUDs.
matrices - the rendering matrix stacktextStyle - the text stylex - the X positiony - the Y positionpublic static int colorAtOpacity(int opaque,
float opacity)
public static int multiplyColor(int color,
float amount)