Interface RenderContext
public interface RenderContext
Drawing for screens and HUD widgets, the same on every Minecraft version. Coordinates are GUI pixels
(Minecraft's scaled units); colours are ARGB (
0xFF12141A). Never touch OpenGL directly – this
keeps addons working when Minecraft changes its renderer (1.21.6, 26.x, Vulkan).-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcenteredText(String text, int centerX, int y, int argb) voidvoidenableScissor(int x1, int y1, int x2, int y2) Only draw inside this rectangle untildisableScissor()voidfill(int x1, int y1, int x2, int y2, int argb) Filled rectangle from (x1, y1) to (x2, y2)floatguiScale()Minecraft's GUI scale (GUI pixel → screen pixels), used to draw shapes at full resolutionvoid16×16 item icon (like in the hotbar), without count or durability barintvoidoutline(int x, int y, int width, int height, int argb) 1-pixel framevoidpop()voidpush()Saves the current transformdefault voidroundedRect(int x1, int y1, int x2, int y2, int radius, int argb) Filled rectangle with rounded corners; corners are drawn at screen-pixel resolutiondefault voidroundedRect(int x1, int y1, int x2, int y2, int radius, int fill, int border) Rounded rectangle with a 1-screen-pixel bordervoidscale(float factor) default voidvoidintvoidtranslate(float x, float y)
-
Method Details
-
fill
void fill(int x1, int y1, int x2, int y2, int argb) Filled rectangle from (x1, y1) to (x2, y2) -
outline
void outline(int x, int y, int width, int height, int argb) 1-pixel frame -
text
-
textWidth
-
lineHeight
int lineHeight() -
push
void push()Saves the current transform -
pop
void pop() -
translate
void translate(float x, float y) -
scale
void scale(float factor) -
enableScissor
void enableScissor(int x1, int y1, int x2, int y2) Only draw inside this rectangle untildisableScissor() -
disableScissor
void disableScissor() -
item
16×16 item icon (like in the hotbar), without count or durability bar -
guiScale
float guiScale()Minecraft's GUI scale (GUI pixel → screen pixels), used to draw shapes at full resolution -
roundedRect
default void roundedRect(int x1, int y1, int x2, int y2, int radius, int argb) Filled rectangle with rounded corners; corners are drawn at screen-pixel resolution -
roundedRect
default void roundedRect(int x1, int y1, int x2, int y2, int radius, int fill, int border) Rounded rectangle with a 1-screen-pixel border -
text
-
centeredText
-