# EntityTraceLine.Builder

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

**Since:** 1.9.0

Configures and builds an [EntityTraceLine](EntityTraceLine.md). 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](EntityTraceLine.md).

## Constructors

### new EntityTraceLine.Builder {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_constructor-Draw3D-}

```js
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 {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_alpha-int-}

```js
alpha(int alpha): EntityTraceLine.Builder
```

Sets the alpha independently of the color, from `0` (transparent) to
 `255` (opaque). Values are not clamped.

**Parameters:**
- `alpha`: the alpha value for the line's color

**Returns:** self for chaining

**Since:** 1.9.0

### alwaysOnTop {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_alwaysOnTop-boolean-}

```js
alwaysOnTop(boolean alwaysOnTop): EntityTraceLine.Builder
```

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

**Since:** 2.1.0

### build {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_build-EntityHelper-}

```js
build(EntityHelper<?> entity): EntityTraceLine
```

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

**Since:** 1.9.0

### build {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_build-}

```js
build(): EntityTraceLine
```

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

**Since:** 1.9.0

### buildAndAdd {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_buildAndAdd-EntityHelper-}

```js
buildAndAdd(EntityHelper<?> entity): EntityTraceLine
```

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

**Since:** 1.9.0

### buildAndAdd {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_buildAndAdd-}

```js
buildAndAdd(): EntityTraceLine
```

Builds the line and adds it to this builder's overlay.

**Returns:** the build line

**Since:** 1.9.0

### color {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_color-int-}

```js
color(int color): EntityTraceLine.Builder
```

Stores the packed color unchanged and derives alpha from its high byte. If that byte is `0`,  
 nonzero RGB is treated as opaque; an all-zero color remains transparent.

**Parameters:**
- `color`: the color of the line

**Returns:** self for chaining

**Since:** 1.9.0

### color {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_color-int-int-}

```js
color(int color, int alpha): EntityTraceLine.Builder
```

Sets the packed color 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

**Since:** 1.9.0

### color {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_color-int-int-int-}

```js
color(int r, int g, int b): EntityTraceLine.Builder
```

Packs the red, green, and blue components into the color 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

**Since:** 1.9.0

### color {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_color-int-int-int-int-}

```js
color(int r, int g, int b, int a): EntityTraceLine.Builder
```

Packs the RGB components into the color 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

**Since:** 1.9.0

### entity {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_entity-EntityHelper-}

```js
entity(EntityHelper<?> entity): EntityTraceLine.Builder
```

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

**Since:** 1.9.0

### getAlpha {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_getAlpha-}

```js
getAlpha(): int
```

Returns the alpha currently stored by this builder (default `255`).

**Returns:** the alpha value of the line's color

**Since:** 1.9.0

### getColor {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_getColor-}

```js
getColor(): int
```

Returns the packed color currently stored by this builder.

**Returns:** the color of the line

**Since:** 1.9.0

### getEntity {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_getEntity-}

```js
getEntity(): EntityHelper<?>
```

Returns the helper entity supplied to this builder, or `null` if none was set.

**Returns:** the target entity

**Since:** 1.9.0

### getYOffset {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_getYOffset-}

```js
getYOffset(): double
```

Returns the y offset currently stored by this builder (default `0.5`).

**Returns:** the offset of y-axis

**Since:** 1.9.0

### yOffset {#com.jsmacrosce.jsmacros.client.api.classes.render.components3d.EntityTraceLine.Builder_yOffset-double-}

```js
yOffset(double yOffset): EntityTraceLine.Builder
```

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

**Since:** 1.9.0
