Skip to content

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 nameWhat it is
RenderElements.AlignableProvides fluent horizontal and vertical alignment for render elements.
RenderElements.BoxAn axis-aligned cuboid with an outline and an optional filled interior.
RenderElements.Draw2DDraws a Draw2D as a positioned, scaled, and rotated element of another overlay.
RenderElements.ElementA renderable element that can be added to a 2D overlay.
RenderElements.Element3DA drawable element in a Draw3D overlay.
RenderElements.EntityTraceLineA TraceLine whose target follows an entity, with yOffset added to its interpolated Y coordinate each frame.
RenderElements.ImageDraws a texture region at a position and destination size.
RenderElements.ItemDraws an item stack using its model in a 16-by-16 GUI-pixel box; scale changes its reported dimensions, and rotation affects drawing.
RenderElements.LineA line is defined by two endpoints, a stroke thickness, and a rotation.
RenderElements.Line3DA fixed line segment between two world-space points.
RenderElements.RectA filled rectangle defined by two corner positions.
RenderElements.SurfaceA Draw2D panel rendered in the world.
RenderElements.TextA positioned text element with colour, shadow, scale, and rotation.
RenderElements.TraceLineA line from the camera toward a script-selected world-space target.