Appearance
helix / ListView
Class: ListView<E> โ
Defined in: core/frontend/nodes/data-view/list.ts:16
A list in NBT whose elements are E.
game.players.forEach((c, p) => c.if(p.hp.missing(), () => p.hp.set(20)));
Extends โ
Extended by โ
Type Parameters โ
E โ
E
Constructors โ
Constructor โ
new ListView<
E>(target,path):ListView<E>
Defined in: core/frontend/nodes/data-view/view.ts:23
Parameters โ
target โ
NbtTargetSpec
path โ
Returns โ
ListView<E>
Inherited from โ
Properties โ
path โ
readonlypath:NbtPathValue
Defined in: core/frontend/nodes/data-view/view.ts:25
Inherited from โ
target โ
readonlytarget:NbtTargetSpec
Defined in: core/frontend/nodes/data-view/view.ts:24
Inherited from โ
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
Inherited from โ
all() โ
all():
NbtView
Defined in: core/frontend/nodes/data-view/view.ts:48
Every element of this list.
Returns โ
Inherited from โ
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 โ
Returns โ
this
Inherited from โ
child() โ
child(
key):NbtView
Defined in: core/frontend/nodes/data-view/view.ts:38
The field key of this compound.
Parameters โ
key โ
string
Returns โ
Inherited from โ
exists() โ
exists():
Detector
Defined in: core/frontend/nodes/data-view/view.ts:69
Holds when the path matches anything.
Returns โ
Inherited from โ
forEach() โ
forEach(
body):void
Defined in: core/frontend/nodes/data-view/list.ts:29
Runs body once per element, first to last.
Walks a copy, so body may change the list. Compiles to a ctx.while, so the command chain limit caps how long a list it can walk in one tick.
Parameters โ
body โ
(ctx, el) => void
Returns โ
void
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 โ
Inherited from โ
holder() โ
protectedholder(ctx?):NbtHolder
Defined in: core/frontend/nodes/data-view/view.ts:29
The holder the view lives in, in ctx.
Parameters โ
ctx? โ
Returns โ
NbtHolder
Inherited from โ
index() โ
index(
i):FieldView<E>
Defined in: core/frontend/nodes/data-view/list.ts:18
Element i; negative counts from the end.
Parameters โ
i โ
number
Returns โ
FieldView<E>
Overrides โ
missing() โ
missing():
Detector
Defined in: core/frontend/nodes/data-view/view.ts:74
Holds when the path matches nothing.
Returns โ
Inherited from โ
ref() โ
ref():
NbtRef
Defined in: core/frontend/nodes/data-view/view.ts:64
This value, as a copy source or a text part.
Returns โ
Inherited from โ
remove() โ
remove():
this
Defined in: core/frontend/nodes/data-view/view.ts:100
Removes the value.
Returns โ
this
Inherited from โ
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 โ
type? โ
StoreNumType
Returns โ
this
Inherited from โ
storeInto() โ
protectedstoreInto(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 โ
type? โ
StoreNumType = "int"
factor? โ
number = 1
Returns โ
Inherited from โ
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
Inherited from โ
whenAtMost() โ
protectedwhenAtMost(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 โ
n โ
number
body โ
() => void
Returns โ
void
Inherited from โ
where() โ
where(
filter):NbtView
Defined in: core/frontend/nodes/data-view/view.ts:59
The elements of this list that match filter.