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 Type
    Method
    Description
    default void
    centeredText(String text, int centerX, int y, int argb)
     
    void
     
    void
    enableScissor(int x1, int y1, int x2, int y2)
    Only draw inside this rectangle until disableScissor()
    void
    fill(int x1, int y1, int x2, int y2, int argb)
    Filled rectangle from (x1, y1) to (x2, y2)
    float
    Minecraft's GUI scale (GUI pixel → screen pixels), used to draw shapes at full resolution
    void
    item(ItemView item, int x, int y)
    16×16 item icon (like in the hotbar), without count or durability bar
    int
     
    void
    outline(int x, int y, int width, int height, int argb)
    1-pixel frame
    void
    pop()
     
    void
    Saves the current transform
    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
    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
    void
    scale(float factor)
     
    default void
    text(String text, int x, int y, int argb)
     
    void
    text(String text, int x, int y, int argb, boolean shadow)
     
    int
     
    void
    translate(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

      void text(String text, int x, int y, int argb, boolean shadow)
    • textWidth

      int textWidth(String text)
    • 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 until disableScissor()
    • disableScissor

      void disableScissor()
    • item

      void item(ItemView item, int x, int y)
      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

      default void text(String text, int x, int y, int argb)
    • centeredText

      default void centeredText(String text, int centerX, int y, int argb)