RenderElements
Lets scripts identify 2D and 3D drawing elements through the RenderElements global.
js
const draw = Hud.createDraw2D();
draw.addText("hello", 10, 10, Color.rgb(0xFF, 0xFF, 0xFF), true);
for (const element of draw.getElements()) {
if (element instanceof RenderElements.Text) {
element.setText("updated");
}
}These names are available in JavaScript and Python without importing anything. They are read-only aliases of Java types, so instanceof works as usual.
| Script name | What it is |
|---|---|
RenderElements.Alignable | Provides fluent horizontal and vertical alignment for render elements. |
RenderElements.Box | An axis-aligned cuboid with an outline and an optional filled interior. |
RenderElements.Draw2D | Draws a Draw2D as a positioned, scaled, and rotated element of another overlay. |
RenderElements.Element | A renderable element that can be added to a 2D overlay. |
RenderElements.Element3D | A drawable element in a Draw3D overlay. |
RenderElements.EntityTraceLine | A TraceLine whose target follows an entity, with yOffset added to its interpolated Y coordinate each frame. |
RenderElements.Image | Draws a texture region at a position and destination size. |
RenderElements.Item | Draws an item stack using its model in a 16-by-16 GUI-pixel box; scale changes its reported dimensions, and rotation affects drawing. |
RenderElements.Line | A line is defined by two endpoints, a stroke thickness, and a rotation. |
RenderElements.Line3D | A fixed line segment between two world-space points. |
RenderElements.Rect | A filled rectangle defined by two corner positions. |
RenderElements.Surface | A Draw2D panel rendered in the world. |
RenderElements.Text | A positioned text element with colour, shadow, scale, and rotation. |
RenderElements.TraceLine | A line from the camera toward a script-selected world-space target. |