Skip to content

Draw2D ​

com.jsmacrosce.jsmacros.client.api.classes.render.Draw2D

Since1.0.5

A 2D overlay that stores and draws screen elements.

Element coordinates use GUI-scaled pixels from the window's top-left corner.

The overlay renders only while registered with register(); call unregister() to stop it.

Registering also runs initialization. When an init function is installed, the overlay is emptied before that function rebuilds it; without one, hand-built elements are preserved.

Coordinates are absolute. getZIndex() orders whole overlays (lower first),
while each element's z-index orders elements within its overlay.

Elements are stored in insertion order in a set; adding an equal element does not create a duplicate.

Overlays can be nested with addDraw2D(Draw2D, int, int, int, int); cyclic nesting is rejected. A Surface displays overlays in the world.

js
// an overlay that builds itself, registered so it renders
const draw = Hud.createDraw2D();  
draw.setOnInit(JavaWrapper.methodToJava(function (self) {
  self.addRect(10, 10, 110, 60, Color.argb(0x80, 0, 0, 0));  
  self.addText("a panel", 16, 20, Color.rgb(0xFF, 0xFF, 0xFF), true);  
}));  
draw.register();  

// taken off again, which keeps the elements for next time
draw.unregister();

Constructors ​

new Draw2D ​

new Draw2D()#
Sets up an empty, unregistered overlay with width and height suppliers that read the current window's GUI-scaled dimensions when invoked. Call register() separately to initialize and register it.

Fields ​

heightSupplier ​

heightSupplier: IntSupplierSince1.0.5#
Supplies the value returned by getHeight(). Defaults to the window height in GUI-scaled pixels; nested overlays replace it with their displayed height.

visible ​

visible: booleanSince1.8.4#
Whether this overlay is rendered while registered. Changing visibility does not unregister it or alter its elements; defaults to true.

widthSupplier ​

widthSupplier: IntSupplierSince1.0.5#
Supplies the value returned by getWidth(). Defaults to the window width in GUI-scaled pixels; nested overlays replace it with their displayed width.

zIndex ​

zIndex: intSince1.0.5#
Orders this overlay against other registered overlays, lower values first; it does not affect element ordering. Defaults to 0; use setZIndex(int) to set it.

Methods ​

addDraw2D ​

addDraw2D(Draw2D draw2D, int x, int y, int width, int height): Draw2DElementSince1.8.4#
Adds a nested overlay at the given position and displayed size. The nested overlay has that width and height for its own elements; its elements are not included in this overlay's element lists, while its wrapper appears in getDraw2Ds(). Returns null if nesting would create a cycle, including nesting this overlay inside itself.

Parameters:

  • draw2D: the overlay to draw inside this one
  • x: the x position of the nested overlay within this one
  • y: the y position of the nested overlay within this one
  • width: how wide the nested overlay thinks it is
  • height: how tall the nested overlay thinks it is
Returns: a wrapper for the draw2d, or null if the nesting would make a cycle
addDraw2D(Draw2D draw2D, int x, int y, int width, int height, int zIndex): Draw2DElementSince1.8.4#
Adds a nested overlay as in addDraw2D(Draw2D, int, int, int, int), with the wrapper's z-index ordering it against this overlay's other elements. The nested overlay's elements are ordered within that overlay. Returns null if nesting would create a cycle.

Parameters:

  • draw2D: the overlay to draw inside this one
  • x: the x position of the nested overlay within this one
  • y: the y position of the nested overlay within this one
  • width: how wide the nested overlay thinks it is
  • height: how tall the nested overlay thinks it is
  • zIndex: the z-index of the nested overlay against this one's other elements
Returns: a wrapper for the draw2d, or null if the nesting would make a cycle

addImage ​

addImage(int x, int y, int width, int height, String id, int imageX, int imageY, int regionWidth, int regionHeight, int textureWidth, int textureHeight): ImageSince1.2.3#
Draws a texture region at the specified screen position and size. The region coordinates and dimensions are in texture pixels; width and height are the on-screen dimensions.

Parameters:

  • x: screen x, top left corner
  • y: screen y, top left corner
  • width: width on screen
  • height: height on screen
  • id: image id, in the form minecraft:textures path'd as found in texture packs, ie assets/minecraft/textures/gui/recipe_book.png becomes minecraft:textures/gui/recipe_book.png
  • imageX: the left-most coordinate of the texture region
  • imageY: the top-most coordinate of the texture region
  • regionWidth: the width the texture region
  • regionHeight: the height the texture region
  • textureWidth: the width of the entire texture
  • textureHeight: the height of the entire texture
Returns: added image

See:

addImage(int x, int y, int width, int height, int zIndex, String id, int imageX, int imageY, int regionWidth, int regionHeight, int textureWidth, int textureHeight): ImageSince1.2.3#
Draws a texture region at the specified screen position and size, ordered by zIndex against other overlay elements.

Parameters:

  • x: screen x, top left corner
  • y: screen y, top left corner
  • width: width on screen
  • height: height on screen
  • zIndex: z-index
  • id: image id, in the form minecraft:textures path'd as found in texture packs, ie assets/minecraft/textures/gui/recipe_book.png becomes minecraft:textures/gui/recipe_book.png
  • imageX: the left-most coordinate of the texture region
  • imageY: the top-most coordinate of the texture region
  • regionWidth: the width the texture region
  • regionHeight: the height the texture region
  • textureWidth: the width of the entire texture
  • textureHeight: the height of the entire texture
Returns: added image

See:

addImage(int x, int y, int width, int height, String id, int imageX, int imageY, int regionWidth, int regionHeight, int textureWidth, int textureHeight, double rotation): ImageSince1.2.6#
Draws a texture region at the specified screen position and size, rotated about its center by rotation degrees. The position remains the unrotated image's top-left corner.

Parameters:

  • x: screen x, top left corner
  • y: screen y, top left corner
  • width: width on screen
  • height: height on screen
  • id: image id, in the form minecraft:textures path'd as found in texture packs, ie assets/minecraft/textures/gui/recipe_book.png becomes minecraft:textures/gui/recipe_book.png
  • imageX: the left-most coordinate of the texture region
  • imageY: the top-most coordinate of the texture region
  • regionWidth: the width the texture region
  • regionHeight: the height the texture region
  • textureWidth: the width of the entire texture
  • textureHeight: the height of the entire texture
  • rotation: the rotation (clockwise) of the texture (as degrees)
Returns: added image

See:

addImage(int x, int y, int width, int height, int zIndex, String id, int imageX, int imageY, int regionWidth, int regionHeight, int textureWidth, int textureHeight, double rotation): ImageSince1.2.6#
Adds a texture region with a z-index and rotation about the image's center, in degrees. See IDraw2D.addImage(int, int, int, int, int, String, int, int, int, int, int, int, double).

Parameters:

  • x: screen x, top left corner
  • y: screen y, top left corner
  • width: width on screen
  • height: height on screen
  • zIndex: z-index
  • id: image id, in the form minecraft:textures path'd as found in texture packs, ie assets/minecraft/textures/gui/recipe_book.png becomes minecraft:textures/gui/recipe_book.png
  • imageX: the left-most coordinate of the texture region
  • imageY: the top-most coordinate of the texture region
  • regionWidth: the width the texture region
  • regionHeight: the height the texture region
  • textureWidth: the width of the entire texture
  • textureHeight: the height of the entire texture
  • rotation: the rotation (clockwise) of the texture (as degrees)
Returns: added image
addImage(int x, int y, int width, int height, int zIndex, int color, String id, int imageX, int imageY, int regionWidth, int regionHeight, int textureWidth, int textureHeight, double rotation): ImageSince1.6.5#
Adds a tinted texture region with a z-index and rotation about the image's center, in degrees. A white tint leaves the texture colors unchanged; shorter overloads use a white tint.

Parameters:

  • x: screen x, top left corner
  • y: screen y, top left corner
  • width: width on screen
  • height: height on screen
  • zIndex: z-index
  • color: the tint laid over the image
  • id: image id, in the form minecraft:textures path'd as found in texture packs, ie assets/minecraft/textures/gui/recipe_book.png becomes minecraft:textures/gui/recipe_book.png
  • imageX: the left-most coordinate of the texture region
  • imageY: the top-most coordinate of the texture region
  • regionWidth: the width the texture region
  • regionHeight: the height the texture region
  • textureWidth: the width of the entire texture
  • textureHeight: the height of the entire texture
  • rotation: the rotation (clockwise) of the texture (as degrees)
Returns: added image

See:

addImage(int x, int y, int width, int height, int zIndex, int alpha, int color, String id, int imageX, int imageY, int regionWidth, int regionHeight, int textureWidth, int textureHeight, double rotation): ImageSince1.6.5#
Adds a tinted texture region with explicit alpha, z-index, and rotation about its center, in degrees.

Parameters:

  • x: screen x, top left corner
  • y: screen y, top left corner
  • width: width on screen
  • height: height on screen
  • zIndex: z-index
  • alpha: the transparency of the image, from 0 to 255
  • color: the tint laid over the image
  • id: image id, in the form minecraft:textures path'd as found in texture packs, ie assets/minecraft/textures/gui/recipe_book.png becomes minecraft:textures/gui/recipe_book.png
  • imageX: the left-most coordinate of the texture region
  • imageY: the top-most coordinate of the texture region
  • regionWidth: the width the texture region
  • regionHeight: the height the texture region
  • textureWidth: the width of the entire texture
  • textureHeight: the height of the entire texture
  • rotation: the rotation (clockwise) of the texture (as degrees)
Returns: added image

See:

addItem ​

addItem(int x, int y, String id): ItemSince1.0.5#
Adds an item icon at the given screen position, with the game's item decorations. The item ID may omit the minecraft: namespace.

Parameters:

  • x: left most corner
  • y: top most corner
  • id: item id
Returns: added item

See:

addItem(int x, int y, int zIndex, String id): ItemSince1.0.5#
Adds an item icon at a position, using the default stack overlay.

Parameters:

  • x: left most corner
  • y: top most corner
  • zIndex: z-index
  • id: item id
Returns: the added item element
addItem(int x, int y, String id, boolean overlay): ItemSince1.2.0#
Adds an item icon and selects whether its game-provided overlay is drawn.

Parameters:

  • x: left most corner
  • y: top most corner
  • id: item id
  • overlay: whether to draw the game's item decorations, including durability and count
Returns: added item

See:

addItem(int x, int y, int zIndex, String id, boolean overlay): ItemSince1.2.0#
Adds an item icon with a z-index and control over its game-provided overlay.

Parameters:

  • x: left most corner
  • y: top most corner
  • zIndex: z-index
  • id: item id
  • overlay: whether to draw the game's item decorations, including durability and count
Returns: added item
addItem(int x, int y, String id, boolean overlay, double scale, double rotation): ItemSince1.2.0#
Adds a scaled and rotated item icon, without an explicit z-index. Scale multiplies the icon's size; rotation is in degrees about its center.

Parameters:

  • x: left most corner
  • y: top most corner
  • id: item id
  • overlay: whether to draw the game's item decorations
  • scale: size multiplier
  • rotation: rotation in degrees
Returns: added item

See:

addItem(int x, int y, int zIndex, String id, boolean overlay, double scale, double rotation): ItemSince1.2.0#
Adds an item icon with a z-index, scale, and rotation. Scale multiplies the icon's size; rotation is in degrees about its center.

Parameters:

  • x: left most corner
  • y: top most corner
  • zIndex: z-index
  • id: item id
  • overlay: whether to draw the game's item decorations
  • scale: size multiplier
  • rotation: rotation in degrees
Returns: added item
addItem(int x, int y, ItemStackHelper Item): ItemSince1.0.5#
Adds an item icon from a stack, with the default stack overlay enabled.

Parameters:

  • x: screen-pixel x-coordinate of the icon's top-left corner
  • y: screen-pixel y-coordinate of the icon's top-left corner
  • Item: item stack to draw, such as one from an inventory
Returns: added item

See:

addItem(int x, int y, int zIndex, ItemStackHelper item): ItemSince1.0.5#
Adds an item icon from a stack with a z-index and the default overlay enabled.

Parameters:

  • x: left most corner
  • y: top most corner
  • zIndex: z-index
  • item: from inventory as helper
Returns: the added item element
addItem(int x, int y, ItemStackHelper Item, boolean overlay): ItemSince1.2.0#
Adds an item icon from a stack and selects whether its game-provided overlay is drawn.

Parameters:

  • x: left most corner
  • y: top most corner
  • Item: item stack to draw, such as one from an inventory
  • overlay: whether to draw the game's item decorations, including durability and count
Returns: added item

See:

addItem(int x, int y, int zIndex, ItemStackHelper item, boolean overlay): ItemSince1.2.0#
Adds an item icon from a stack with a z-index and control over its overlay.

Parameters:

  • x: left most corner
  • y: top most corner
  • zIndex: z-index
  • item: from inventory as helper
  • overlay: whether to draw the game's item decorations, including durability and count
Returns: added item
addItem(int x, int y, ItemStackHelper item, boolean overlay, double scale, double rotation): ItemSince1.2.6#
Adds a scaled and rotated item icon from a stack, without an explicit z-index. Scale multiplies the icon's size; rotation is in degrees about its center.

Parameters:

  • x: left most corner
  • y: top most corner
  • item: from inventory as helper
  • overlay: whether to draw the game's item decorations
  • scale: size multiplier
  • rotation: rotation in degrees
Returns: added item

See:

addItem(int x, int y, int zIndex, ItemStackHelper item, boolean overlay, double scale, double rotation): ItemSince1.2.6#
Adds an item icon with the specified z-index, scale, and rotation.

Parameters:

  • x: left coordinate
  • y: top coordinate
  • zIndex: element draw order; lower values draw first
  • item: item stack to draw
  • overlay: whether to draw the item overlay
  • scale: icon scale
  • rotation: rotation in degrees
Returns: the added item element

addLine ​

addLine(int x1, int y1, int x2, int y2, int color): LineSince1.8.4#
Adds a one-pixel-wide line between its start and end points, at z-index 0.

Parameters:

  • x1: the x position of the start
  • y1: the y position of the start
  • x2: the x position of the end
  • y2: the y position of the end
  • color: the line color, including any alpha value
Returns: the added line

See:

addLine(int x1, int y1, int x2, int y2, int color, int zIndex): LineSince1.8.4#
Adds a one-pixel-wide line between its start and end points. Lower z-index elements are drawn first.

Parameters:

  • x1: the x position of the start
  • y1: the y position of the start
  • x2: the x position of the end
  • y2: the y position of the end
  • color: the line color, including any alpha value
  • zIndex: draw order relative to other overlay elements
Returns: the added line

See:

addLine(int x1, int y1, int x2, int y2, int color, double width): LineSince1.8.4#
Adds a line with the specified width, at z-index 0.

Parameters:

  • x1: the x position of the start
  • y1: the y position of the start
  • x2: the x position of the end
  • y2: the y position of the end
  • color: the line color, including any alpha value
  • width: the line width in screen pixels
Returns: the added line

See:

addLine(int x1, int y1, int x2, int y2, int color, int zIndex, double width): LineSince1.8.4#
Adds a line with the specified z-index and width. Lower z-index elements are drawn first.

Parameters:

  • x1: the x position of the start
  • y1: the y position of the start
  • x2: the x position of the end
  • y2: the y position of the end
  • color: the line color, including any alpha value
  • zIndex: draw order relative to other overlay elements
  • width: the line width in screen pixels
Returns: the added line

See:

addLine(int x1, int y1, int x2, int y2, int color, double width, double rotation): LineSince1.8.4#
Adds a line with the specified width and rotation about its first point, at z-index 0.

Parameters:

  • x1: the x position of the start
  • y1: the y position of the start
  • x2: the x position of the end
  • y2: the y position of the end
  • color: the line color, including any alpha value
  • width: the line width in screen pixels
  • rotation: rotation in degrees
Returns: the added line

See:

addLine(int x1, int y1, int x2, int y2, int color, int zIndex, double width, double rotation): LineSince1.8.4#
Adds a line with the specified z-index, width, and rotation about its first point. Lower z-index elements are drawn first.

Parameters:

  • x1: the x position of the start
  • y1: the y position of the start
  • x2: the x position of the end
  • y2: the y position of the end
  • color: the line color, including any alpha value
  • zIndex: draw order relative to other overlay elements
  • width: the line width in screen pixels
  • rotation: rotation in degrees
Returns: the added line

See:

addRect ​

addRect(int x1, int y1, int x2, int y2, int color): RectSince1.0.5#
Adds a filled rectangle between two corners, using the color's alpha channel and z-index 0.

Parameters:

  • x1: the x coordinate of the first corner
  • y1: the y coordinate of the first corner
  • x2: the x coordinate of the second corner
  • y2: the y coordinate of the second corner
  • color: as hex, with alpha channel
Returns: added rect

See:

addRect(int x1, int y1, int x2, int y2, int color, int alpha): RectSince1.1.8#
Adds a rectangle between two corners with a separate alpha value; rotation and z-index are zero.

Parameters:

  • x1: the x coordinate of the first corner
  • y1: the y coordinate of the first corner
  • x2: the x coordinate of the second corner
  • y2: the y coordinate of the second corner
  • color: as hex
  • alpha: alpha channel 0-255
Returns: added rect

See:

addRect(int x1, int y1, int x2, int y2, int color, int alpha, double rotation): RectSince1.2.6#
Adds a rectangle between two corners with a separate alpha value. This overload ignores rotation and uses rotation and z-index zero; use the full overload to set both.

Parameters:

  • x1: the x coordinate of the first corner
  • y1: the y coordinate of the first corner
  • x2: the x coordinate of the second corner
  • y2: the y coordinate of the second corner
  • color: as hex
  • alpha: alpha channel 0-255
  • rotation: ignored; this overload always uses zero rotation
Returns: added rect

See:

addRect(int x1, int y1, int x2, int y2, int color, int alpha, double rotation, int zIndex): RectSince1.2.6#
Adds a rectangle between two corners, with rotation and a z-index. Lower z-index elements are drawn first.

Parameters:

  • x1: the x coordinate of the first corner
  • y1: the y coordinate of the first corner
  • x2: the x coordinate of the second corner
  • y2: the y coordinate of the second corner
  • color: rectangle color
  • alpha: transparency from 0 (transparent) to 255 (opaque)
  • rotation: rotation in degrees
  • zIndex: draw order relative to other overlay elements
Returns: the added rectangle

See:

addText ​

addText(String text, int x, int y, int color, boolean shadow): TextSince1.0.5#
Adds text at the given GUI-scaled screen position. The color is packed with alpha in the top byte; this overload uses z-index 0, scale 1, and no rotation.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • shadow: include shadow layer
Returns: added text

See:

addText(String text, int x, int y, int color, int zIndex, boolean shadow): TextSince1.0.5#
Adds text; despite accepting zIndex, this overload currently uses z-index 0. Use the full overload to specify the element z-index.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • zIndex: currently ignored; the added text uses z-index 0
  • shadow: include shadow layer
Returns: added text
addText(String text, int x, int y, int color, boolean shadow, double scale, double rotation): TextSince1.2.6#
Adds text with the given scale and rotation in degrees, using z-index 0.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • shadow: include shadow layer
  • scale: text scale (as double)
  • rotation: text rotation (as degrees)
Returns: added text

See:

addText(String text, int x, int y, int color, int zIndex, boolean shadow, double scale, double rotation): TextSince1.2.6#
Adds text with the specified z-index, scale, and rotation in degrees.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • zIndex: z-index
  • shadow: include shadow layer
  • scale: text scale (as double)
  • rotation: text rotation (as degrees)
Returns: added text

See:

addText(TextHelper text, int x, int y, int color, boolean shadow): TextSince1.0.5#
Adds styled text from a TextHelper; color tints its existing styling. This overload uses z-index 0, scale 1, and no rotation.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • shadow: include shadow layer
Returns: added text

See:

addText(TextHelper text, int x, int y, int color, int zIndex, boolean shadow): TextSince1.0.5#
Adds styled text from a TextHelper; color tints its existing styling. This overload uses scale 1 and no rotation.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • zIndex: z-index
  • shadow: include shadow layer
Returns: added text

See:

addText(TextHelper text, int x, int y, int color, boolean shadow, double scale, double rotation): TextSince1.0.5#
Adds styled text from a TextHelper; color tints its existing styling. This overload uses z-index 0.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • shadow: include shadow layer
  • scale: text scale (as double)
  • rotation: text rotation (as degrees)
Returns: added text

See:

addText(TextHelper text, int x, int y, int color, int zIndex, boolean shadow, double scale, double rotation): TextSince1.0.5#
Adds styled text from a TextHelper, applying the supplied tint, z-index, scale, and rotation.

Parameters:

  • text: the text to display
  • x: screen x
  • y: screen y
  • color: text color
  • zIndex: z-index
  • shadow: include shadow layer
  • scale: text scale (as double)
  • rotation: text rotation (as degrees)
Returns: added text

See:

clear ​

clear(): voidSince2.0.0#
Removes all elements from this overlay without unregistering it or changing its other settings. The elements themselves are unaffected and can be added again with reAddElement(RenderElement).

getDraw2Ds ​

getDraw2Ds(): List<Draw2DElement>Since1.8.4#
Returns the nested-overlay wrappers in insertion order, not the nested overlays or their contents. The returned list is a separate, mutable list; each wrapper carries the nested overlay's placement and displayed dimensions.
Returns: the nested-overlay wrappers

getElements ​

getElements(): List<RenderElement>Since1.2.9#
Returns an immutable snapshot of all elements on this overlay in insertion order. Nested overlays appear as wrappers; their contents are not included.
Returns: an immutable snapshot of this overlay's elements

getElementsByZIndex ​

getElementsByZIndex(): Iterator<RenderElement>Since1.8.4#
Returns an iterator over this overlay's elements sorted by z-index, lowest first.
Returns: elements in ascending z-index order

getHeight ​

getHeight(): intSince1.0.5#
Returns the height supplied by heightSupplier, in GUI-scaled pixels.
Returns: the supplied height

getLines ​

getLines(): List<Line>Since1.8.4#
Returns this overlay's lines in insertion order. The returned list is a separate, mutable list; nested overlays' contents are not included.
Returns: the line elements

getWidth ​

getWidth(): intSince1.0.5#
Returns the width supplied by widthSupplier, in GUI-scaled pixels.
Returns: the supplied width

getZIndex ​

getZIndex(): intSince1.8.4#
Returns this overlay's draw order relative to other overlays; lower values draw first.
Returns: this overlay's order relative to other overlays

init ​

init(): voidSince1.0.5#
Initializes this overlay and its nested overlays. If an init callback is set, this overlay's elements are cleared before it runs; otherwise they are preserved. Callback failures are passed as strings to the fail callback when set, or logged when it is not. Nested overlays are initialized afterward.

isVisible ​

isVisible(): booleanSince1.8.4#
Returns whether this overlay is set to render; this does not indicate whether it is registered.
Returns: true if this draw2d is visible, false otherwise.

reAddElement ​

reAddElement(T extends RenderElement e): T extends RenderElementSince1.2.9#
Adds an element to this overlay and returns it. An already-present element is not duplicated. Nested-overlay wrappers are rejected with null if they have no underlying overlay, refer to this overlay, or would create a cycle. When this overlay is a Surface, adding a nested overlay initializes it immediately.

Parameters:

  • e: the element to put back

Type Parameters:

  • T: the type of element to add
Returns: the element, or null if it is a nested overlay that was refused

register ​

register(): Draw2DSince1.6.5#
Initializes and registers this overlay for HUD rendering.
Returns: self for chaining

removeDraw2D ​

removeDraw2D(Draw2DElement draw2D): Draw2DSince1.8.4#
Removes the wrapper for a nested overlay from this overlay; the nested overlay and its elements are unchanged.

Parameters:

  • draw2D: the wrapper to take off
Returns: self chaining.

removeElement ​

removeElement(RenderElement e): Draw2DSince1.2.9#
Removes an element from this overlay. If it is absent, this has no effect; the element itself is unchanged and can be added again with reAddElement(RenderElement). Unlike the deprecated typed removals, this accepts any render-element type.

Parameters:

  • e: the element to take off
Returns: self for chaining

removeLine ​

removeLine(Line l): Draw2DSince1.8.4#
Removes a line from this overlay without modifying the line itself. It can be added again with reAddElement(RenderElement).

Parameters:

  • l: the line to remove
Returns: this overlay for chaining

See:

setOnFailInit ​

setOnFailInit(MethodWrapper<String, Object, Object, ?> catchInit): Draw2DSince1.2.7#
Sets the callback that receives the init callback's failure as its toString() value. If unset, the failure is logged. This handles failures from initialization only.

Parameters:

Returns: self for chaining

setOnInit ​

setOnInit(MethodWrapper<Draw2D, Object, Object, ?> onInit): Draw2DSince1.2.7#
Sets the callback run during initialization after this overlay's elements are cleared. Initialization also initializes nested overlays; a callback failure is handled by the configured fail callback or logged.

Parameters:

Returns: self for chaining

setVisible ​

setVisible(boolean visible): Draw2DSince1.8.4#
Sets whether this overlay is rendered. Changing visibility does not unregister the overlay or alter its elements.

Parameters:

  • visible: whether this overlay should be rendered
Returns: self for chaining.

setZIndex ​

setZIndex(int zIndex): voidSince1.8.4#
Sets this overlay's draw order relative to other overlays; lower values draw first. This does not change the order of elements within the overlay.

Parameters:

  • zIndex: this overlay's order relative to other overlays

unregister ​

unregister(): Draw2DSince1.6.5#
Removes this overlay from HUD rendering without removing its elements.
Returns: self for chaining