EntityTraceLine.Builder
com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder
Configures and builds an EntityTraceLine. Defaults are white, fully opaque, always on top, offset by 0.5 blocks, and no entity; a line with no entity is marked for removal when rendered.
js
const player = Player.getPlayer();
if (player !== null) {
const draw = Hud.createDraw3D();
draw.entityTraceLineBuilder()
.entity(player)
.color(Color.rgb(0x00, 0xFF, 0x00), 128)
.yOffset(1.5)
.alwaysOnTop(false)
.buildAndAdd();
draw.register();
}Nested type declared in EntityTraceLine.
Constructors
new EntityTraceLine.Builder
Creates a builder with no entity, a
0.5-block offset, opaque white, and alwaysOnTop enabled. The parent is stored without validation; it is used only by buildAndAdd(), so it may be null when building detached lines. Calling buildAndAdd() with a null parent throws NullPointerException.Parameters:
parent: overlay used bybuildAndAdd(), or null for detached builds only
Methods
alpha
Sets the alpha independently of the colour, from
0 (transparent) to 255 (opaque). Values are not clamped.Parameters:
alpha: the alpha value for the line's color
Returns: self for chaining
alwaysOnTop
Sets whether the built line renders on top of scene geometry (default
true); false enables depth testing so geometry can occlude it.Parameters:
alwaysOnTop: whether the line should render on top of everything else.
Returns: self for chaining
build
Builds a line for
entity without adding it to an overlay. A null entity results in a line that is marked for removal when rendered.Parameters:
entity: the target entity
Returns: the build line
Builds a line without adding it to an overlay. Its target starts at the origin and is updated to the entity's interpolated position on its first render.
Returns: the build line
buildAndAdd
Builds the line for
entity and adds it to this builder's overlay. A null entity results in a line that is marked for removal when rendered.Parameters:
entity: the target entity
Returns: the build line
Builds the line and adds it to this builder's overlay.
Returns: the build line
color
Stores the packed colour unchanged and derives alpha from its high byte. If that byte is
0, nonzero RGB is treated as opaque; an all-zero colour remains transparent.Parameters:
color: the color of the line
Returns: self for chaining
Sets the packed colour and alpha separately; any alpha byte in
color is not extracted.Parameters:
color: the color of the linealpha: the alpha value of the line's color
Returns: self for chaining
Packs the red, green, and blue components into the colour without changing alpha. Components are not clamped.
Parameters:
r: the red component of the colorg: the green component of the colorb: the blue component of the color
Returns: self for chaining
Packs the RGB components into the colour and stores alpha separately; components 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
entity
Sets the entity for the line;
null leaves the builder without an entity, in which case the line is marked for removal when rendered.Parameters:
entity: the target entity, ornullfor no entity
Returns: self for chaining
getAlpha
Returns the alpha currently stored by this builder (default
255).Returns: the alpha value of the line's color
getColor
Returns the packed colour currently stored by this builder.
Returns: the color of the line
getEntity
Returns the helper entity supplied to this builder, or
null if none was set.Returns: the target entity
getYOffset
Returns the y offset currently stored by this builder (default
0.5).Returns: the offset of y-axis
yOffset
Sets how far above the entity's feet the line points, in blocks. The default is
0.5.Parameters:
yOffset: the offset of y-axis
Returns: self for chaining