Alpha: this compiler is under active development and updates will break your projects. Not recommended for real use yet.
Skip to content

helix / ScoreVec3

Class: ScoreVec3<S> โ€‹

Defined in: core/frontend/nodes/score_vec3/vec.ts:34

Three score slots used as one vector, so vector maths reads as maths.

Arithmetic lowers per axis to /compute or operation. Holds references to existing slots, emits into the ambient context (or ctx), and chains: v.assign(a).sub(b).scale(k). Division floors toward -infinity.

Extends โ€‹

  • ScoreVec3Ops<S>

Type Parameters โ€‹

S โ€‹

S extends number = number

Constructors โ€‹

Constructor โ€‹

new ScoreVec3<S>(x, y, z): ScoreVec3<S>

Defined in: core/frontend/nodes/score_vec3/ops.ts:11

Parameters โ€‹

x โ€‹

Score<S>

y โ€‹

Score<S>

z โ€‹

Score<S>

Returns โ€‹

ScoreVec3<S>

Inherited from โ€‹

ScoreVec3Ops<S>.constructor

Properties โ€‹

x โ€‹

readonly x: Score<S>

Defined in: core/frontend/nodes/score_vec3/ops.ts:12

Inherited from โ€‹

ScoreVec3Ops.x


y โ€‹

readonly y: Score<S>

Defined in: core/frontend/nodes/score_vec3/ops.ts:13

Inherited from โ€‹

ScoreVec3Ops.y


z โ€‹

readonly z: Score<S>

Defined in: core/frontend/nodes/score_vec3/ops.ts:14

Inherited from โ€‹

ScoreVec3Ops.z

Accessors โ€‹

components โ€‹

Get Signature โ€‹

get components(): readonly [Score<number>, Score<number>, Score<number>]

Defined in: core/frontend/nodes/score_vec3/ops.ts:18

The three components as a tuple (e.g. for store result score reads).

Returns โ€‹

readonly [Score<number>, Score<number>, Score<number>]

Inherited from โ€‹

ScoreVec3Ops.components

Methods โ€‹

add() โ€‹

add(other, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:51

this += other.

Parameters โ€‹

other โ€‹

ScoreVec3Ops

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.add


assign() โ€‹

assign(other, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:23

this = other (component-wise =).

Parameters โ€‹

other โ€‹

ScoreVec3Ops<S>

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.assign


clamp() โ€‹

clamp(lo, hi, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:73

Clamp every axis into [lo, hi] (< hi then > lo).

Parameters โ€‹

lo โ€‹

Score

hi โ€‹

Score

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.clamp


divide() โ€‹

divide(k, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:67

Divide every axis by k (/=, integer floor).

Parameters โ€‹

k โ€‹

number | Score<number>

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.divide


dot() โ€‹

dot(other, out, ctx?): Score

Defined in: core/frontend/nodes/score_vec3/ops.ts:82

Dot product into out, as one expression. Uses an internal temp, so no scratch slot needed.

Parameters โ€‹

other โ€‹

ScoreVec3Ops

out โ€‹

Score

ctx? โ€‹

FunctionContext

Returns โ€‹

Score

Inherited from โ€‹

ScoreVec3Ops.dot


each() โ€‹

protected each(op, rhs, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:31

Per axis, dest = f(dest, operand) as one expression.

Parameters โ€‹

op โ€‹

ExprOp

rhs โ€‹

(axis) => Score

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.each


lengthSquared() โ€‹

lengthSquared(out, ctx?): Score

Defined in: core/frontend/nodes/score_vec3/ops.ts:97

Squared length |v|^2 = vยทv (into out).

Parameters โ€‹

out โ€‹

Score

ctx? โ€‹

FunctionContext

Returns โ€‹

Score

Inherited from โ€‹

ScoreVec3Ops.lengthSquared


readEntity() โ€‹

readEntity(who, path, scaleOrOpts?, maybeOpts?): this

Defined in: core/frontend/nodes/score_vec3/vec.ts:57

Reads a 3-element NBT list on who into this vector, scaled to integers:

v.readEntity(target, Path.Entity.Pos, 100) // centi-blocks

Parameters โ€‹

who โ€‹

Selector

path โ€‹

NbtPathValue

scaleOrOpts? โ€‹

number | ScoreVec3NbtOptions

maybeOpts? โ€‹

ScoreVec3NbtOptions

Returns โ€‹

this


readStorage() โ€‹

readStorage(storage, path, scaleOrOpts?, maybeOpts?): this

Defined in: core/frontend/nodes/score_vec3/vec.ts:80

Reads a 3-element NBT list in storage into this vector, scaled to integers:

v.readStorage(dp.storage("temp"), NbtPath("vec_k"), 100000)

Parameters โ€‹

storage โ€‹

Storage

path โ€‹

NbtPathValue

scaleOrOpts? โ€‹

number | ScoreVec3NbtOptions

maybeOpts? โ€‹

ScoreVec3NbtOptions

Returns โ€‹

this


scale() โ€‹

scale(k, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:61

Scale every axis by k (*=).

Parameters โ€‹

k โ€‹

number | Score<number>

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.scale


scaled() โ€‹

scaled<K>(scale): ScoreVec3<K>

Defined in: core/frontend/nodes/score_vec3/vec.ts:48

This vector holding scale units per real unit; see Score.scaled.

Type Parameters โ€‹

K โ€‹

K extends number

Parameters โ€‹

scale โ€‹

K

Returns โ€‹

ScoreVec3<K>


slot() โ€‹

protected slot(k, ctx?): Score

Defined in: core/frontend/nodes/score_vec3/ops.ts:43

k as a score: itself, or a literal set once into #_k rather than per axis.

Parameters โ€‹

k โ€‹

number | Score<number>

ctx? โ€‹

FunctionContext

Returns โ€‹

Score

Inherited from โ€‹

ScoreVec3Ops.slot


storeEntity() โ€‹

storeEntity(who, path, type, scaleOrOpts?, maybeOpts?): this

Defined in: core/frontend/nodes/score_vec3/vec.ts:103

Writes this vector into a 3-element NBT list on who, scaled back to fractions:

v.storeEntity(shot, Path.Entity.Motion, "double", 1 / 10000)

Parameters โ€‹

who โ€‹

Selector

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scaleOrOpts? โ€‹

number | ScoreVec3NbtOptions

maybeOpts? โ€‹

ScoreVec3NbtOptions

Returns โ€‹

this


sub() โ€‹

sub(other, ctx?): this

Defined in: core/frontend/nodes/score_vec3/ops.ts:56

this -= other.

Parameters โ€‹

other โ€‹

ScoreVec3Ops

ctx? โ€‹

FunctionContext

Returns โ€‹

this

Inherited from โ€‹

ScoreVec3Ops.sub


from() โ€‹

static from(of): ScoreVec3

Defined in: core/frontend/nodes/score_vec3/vec.ts:41

Builds a vector from a per-axis score:

ScoreVec3.from((axis) => work.score(ScoreTarget(#v${axis}))) ScoreVec3.from((_, i) => objectives[i].score(self()))

Parameters โ€‹

of โ€‹

(axis, index) => Score

Returns โ€‹

ScoreVec3

Released under the MIT License ยท Credits
These docs were written with AI; the layout and every page have been reviewed by a human.