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

helix / NbtView

Class: NbtView โ€‹

Defined in: core/frontend/nodes/data-view/view.ts:22

One value in NBT (a storage, entity or block, at a path). Verbs emit into the ambient context; checks are detectors for ctx.if.

Extended by โ€‹

Constructors โ€‹

Constructor โ€‹

new NbtView(target, path): NbtView

Defined in: core/frontend/nodes/data-view/view.ts:23

Parameters โ€‹

target โ€‹

NbtTargetSpec

path โ€‹

NbtPathValue

Returns โ€‹

NbtView

Properties โ€‹

path โ€‹

readonly path: NbtPathValue

Defined in: core/frontend/nodes/data-view/view.ts:25


target โ€‹

readonly target: NbtTargetSpec

Defined in: core/frontend/nodes/data-view/view.ts:24

Methods โ€‹

add() โ€‹

add(n): this

Defined in: core/frontend/nodes/data-view/view.ts:114

Adds n to a number.

Parameters โ€‹

n โ€‹

number

Returns โ€‹

this


all() โ€‹

all(): NbtView

Defined in: core/frontend/nodes/data-view/view.ts:48

Every element of this list.

Returns โ€‹

NbtView


append() โ€‹

append(value): this

Defined in: core/frontend/nodes/data-view/view.ts:53

Adds value to the end of this list; a view matching several values adds them all.

Parameters โ€‹

value โ€‹

NbtInput | NbtView

Returns โ€‹

this


child() โ€‹

child(key): NbtView

Defined in: core/frontend/nodes/data-view/view.ts:38

The field key of this compound.

Parameters โ€‹

key โ€‹

string

Returns โ€‹

NbtView


exists() โ€‹

exists(): Detector

Defined in: core/frontend/nodes/data-view/view.ts:69

Holds when the path matches anything.

Returns โ€‹

Detector


get() โ€‹

get(): Score

Defined in: core/frontend/nodes/data-view/view.ts:106

The value as a number, in a new local score; 0 if it's missing.

Returns โ€‹

Score


holder() โ€‹

protected holder(ctx?): NbtHolder

Defined in: core/frontend/nodes/data-view/view.ts:29

The holder the view lives in, in ctx.

Parameters โ€‹

ctx? โ€‹

FunctionContext

Returns โ€‹

NbtHolder


index() โ€‹

index(i): NbtView

Defined in: core/frontend/nodes/data-view/view.ts:43

Element i of this list; negative counts from the end.

Parameters โ€‹

i โ€‹

number

Returns โ€‹

NbtView


missing() โ€‹

missing(): Detector

Defined in: core/frontend/nodes/data-view/view.ts:74

Holds when the path matches nothing.

Returns โ€‹

Detector


ref() โ€‹

ref(): NbtRef

Defined in: core/frontend/nodes/data-view/view.ts:64

This value, as a copy source or a text part.

Returns โ€‹

NbtRef


remove() โ€‹

remove(): this

Defined in: core/frontend/nodes/data-view/view.ts:100

Removes the value.

Returns โ€‹

this


set() โ€‹

set(value, type?): this

Defined in: core/frontend/nodes/data-view/view.ts:89

Sets the value. A score is stored in real units, as type: an int by default, or a double for a scaled score.

Parameters โ€‹

value โ€‹

ViewSource

type? โ€‹

StoreNumType

Returns โ€‹

this


storeInto() โ€‹

protected storeInto(chain, type?, factor?): ExecuteBuilder

Defined in: core/frontend/nodes/data-view/view.ts:127

execute store result into this value, as type times factor.

Parameters โ€‹

chain โ€‹

ExecuteBuilder

type? โ€‹

StoreNumType = "int"

factor? โ€‹

number = 1

Returns โ€‹

ExecuteBuilder


toText() โ€‹

toText(): this

Defined in: core/frontend/nodes/data-view/view.ts:121

Turns a number into its text, e.g. for a lore line that shouldn't show the number colour.

Returns โ€‹

this


whenAtMost() โ€‹

protected whenAtMost(score, n, body): void

Defined in: core/frontend/nodes/data-view/view.ts:135

Runs body when the number is at most n.

Parameters โ€‹

score โ€‹

Score

n โ€‹

number

body โ€‹

() => void

Returns โ€‹

void


where() โ€‹

where(filter): NbtView

Defined in: core/frontend/nodes/data-view/view.ts:59

The elements of this list that match filter.

Parameters โ€‹

filter โ€‹

Returns โ€‹

NbtView

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