Skip to content

EntityTraceLine.Builder ​

com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder

Since1.9.0

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 ​

new EntityTraceLine.Builder(Draw3D parent)#
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 by buildAndAdd(), or null for detached builds only

Methods ​

alpha ​

alpha(int alpha): EntityTraceLine.BuilderSince1.9.0#
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 ​

alwaysOnTop(boolean alwaysOnTop): EntityTraceLine.BuilderSince2.0.0#
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 ​

build(EntityHelper<?> entity): EntityTraceLineSince1.9.0#
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
build(): EntityTraceLineSince1.9.0#
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 ​

buildAndAdd(EntityHelper<?> entity): EntityTraceLineSince1.9.0#
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
buildAndAdd(): EntityTraceLineSince1.9.0#
Builds the line and adds it to this builder's overlay.
Returns: the build line

color ​

color(int color): EntityTraceLine.BuilderSince1.9.0#
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
color(int color, int alpha): EntityTraceLine.BuilderSince1.9.0#
Sets the packed colour and alpha separately; any alpha byte in color is not extracted.

Parameters:

  • color: the color of the line
  • alpha: the alpha value of the line's color
Returns: self for chaining
color(int r, int g, int b): EntityTraceLine.BuilderSince1.9.0#
Packs the red, green, and blue components into the colour without changing alpha. Components are not clamped.

Parameters:

  • r: the red component of the color
  • g: the green component of the color
  • b: the blue component of the color
Returns: self for chaining
color(int r, int g, int b, int a): EntityTraceLine.BuilderSince1.9.0#
Packs the RGB components into the colour and stores alpha separately; components are not clamped.

Parameters:

  • r: the red component of the color
  • g: the green component of the color
  • b: the blue component of the color
  • a: the alpha value of the color
Returns: self for chaining

entity ​

entity(EntityHelper<?> entity): EntityTraceLine.BuilderSince1.9.0#
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, or null for no entity
Returns: self for chaining

getAlpha ​

getAlpha(): intSince1.9.0#
Returns the alpha currently stored by this builder (default 255).
Returns: the alpha value of the line's color

getColor ​

getColor(): intSince1.9.0#
Returns the packed colour currently stored by this builder.
Returns: the color of the line

getEntity ​

getEntity(): EntityHelper<?>Since1.9.0#
Returns the helper entity supplied to this builder, or null if none was set.
Returns: the target entity

getYOffset ​

getYOffset(): doubleSince1.9.0#
Returns the y offset currently stored by this builder (default 0.5).
Returns: the offset of y-axis

yOffset ​

yOffset(double yOffset): EntityTraceLine.BuilderSince1.9.0#
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