TraceLine.Builder
com.jsmacrosce.jsmacros.client.api.classes.render.components3d.TraceLine.Builder
Configures a trace line before building it. Defaults are a white, fully opaque line targeting the origin and drawn over terrain. build() returns a detached line; buildAndAdd() adds it to this builder's overlay.
Nested type declared in TraceLine.
Constructors
new TraceLine.Builder
Creates a builder with an origin target, opaque white color, and
alwaysOnTop enabled. The parent is stored without validation and is used only by buildAndAdd(); it may be null for detached build() calls, but buildAndAdd() then fails with NullPointerException.Parameters:
parent: overlay forbuildAndAdd(), or null when only building detached lines
Methods
alpha
Sets alpha independently of the stored colour integer; the value is not clamped.
Parameters:
alpha: the alpha value for the line's color
Returns: self for chaining
alwaysOnTop
Sets whether the line is drawn over terrain; the default is
true. const draw = Hud.createDraw3D();
draw.traceLineBuilder().pos(0, 64, 0).alwaysOnTop(false).buildAndAdd();
draw.register();Parameters:
alwaysOnTop: whether terrain depth should be ignored when drawing the line
Returns: self for chaining
build
buildAndAdd
color
Sets the packed colour and derives alpha from its top byte after applying the renderer's zero-alpha rule; non-black RGB with a zero alpha becomes opaque.
Parameters:
color: the color of the line
Returns: self for chaining
Stores the colour integer unchanged and sets alpha separately; neither value is clamped.
Parameters:
color: the color of the linealpha: the alpha value of the line's color
Returns: self for chaining
Sets packed RGB using
(r << 16) | (g << 8) | b; values are not clamped and alpha is unchanged.Parameters:
r: the red component of the colorg: the green component of the colorb: the blue component of the color
Returns: self for chaining
Sets packed RGB as in color(int, int, int) and sets alpha separately; values are not clamped.
Parameters:
r: the red component of the colorg: the green component of the colorb: the blue component of the colora: the alpha value of the color
Returns: self for chaining
getAlpha
Returns the alpha value stored by the builder, initially
255. color(int) derives it from the supplied packed colour.Returns: the alpha value of the line's color
getColor
Returns the colour integer stored by the builder unchanged.
Returns: the color of the line
getPos
Returns the target position held by the builder. It defaults to the origin; a position passed to pos(Pos3D) is retained by reference.
Returns: the position of the target
pos
Sets the world-space target endpoint; the camera-side endpoint is computed each render frame.
Parameters:
pos: the position of the target
Returns: self for chaining
Sets the target to the block position's integer coordinates (the block corner, with no half-block offset).
Parameters:
pos: the position of the target
Returns: self for chaining
Sets the target using block coordinates; integer coordinates identify block corners, not centers.
Parameters:
x: the x coordinate of the targety: the y coordinate of the targetz: the z coordinate of the target
Returns: self for chaining