Appearance
helix / Selector
Class: Selector โ
Defined in: core/frontend/nodes/selector/selector.ts:21
A typed entity selector, e.g. Selector.allEntities().type(EntityType.ZOMBIE).tag("boss"). Builders change it in place, so don't reuse one local across clauses.
Extends โ
SelectorFilters
Extended by โ
Constructors โ
Constructor โ
new Selector(
base):Selector
Defined in: core/frontend/nodes/selector/filters.ts:33
Parameters โ
base โ
string
Returns โ
Selector
Inherited from โ
SelectorFilters.constructor
Properties โ
advancementMap โ
protectedadvancementMap:Map<string,boolean>
Defined in: core/frontend/nodes/selector/filters.ts:31
Inherited from โ
SelectorFilters.advancementMap
base โ
protectedbase:string
Defined in: core/frontend/nodes/selector/filters.ts:33
Inherited from โ
SelectorFilters.base
distanceRange? โ
protectedoptionaldistanceRange?:Range
Defined in: core/frontend/nodes/selector/filters.ts:21
Inherited from โ
SelectorFilters.distanceRange
entityTypeValue? โ
protectedoptionalentityTypeValue?:string
Defined in: core/frontend/nodes/selector/filters.ts:29
Inherited from โ
SelectorFilters.entityTypeValue
gamemodeValue? โ
protectedoptionalgamemodeValue?:string
Defined in: core/frontend/nodes/selector/filters.ts:27
Inherited from โ
SelectorFilters.gamemodeValue
limitValue? โ
protectedoptionallimitValue?:number
Defined in: core/frontend/nodes/selector/filters.ts:16
Inherited from โ
SelectorFilters.limitValue
lowered โ
protectedreadonlylowered:true=true
Defined in: core/values/value.ts:14
Tells lowered values apart from plain objects (e.g. NBT compounds).
Inherited from โ
SelectorFilters.lowered
nameValue? โ
protectedoptionalnameValue?:string
Defined in: core/frontend/nodes/selector/filters.ts:19
Inherited from โ
SelectorFilters.nameValue
nbtValue? โ
protectedoptionalnbtValue?:NbtValue
Defined in: core/frontend/nodes/selector/filters.ts:23
Inherited from โ
SelectorFilters.nbtValue
notGamemodes โ
protectedreadonlynotGamemodes:string[] =[]
Defined in: core/frontend/nodes/selector/filters.ts:28
Inherited from โ
SelectorFilters.notGamemodes
originValue? โ
protectedoptionaloriginValue?: readonly [number,number,number]
Defined in: core/frontend/nodes/selector/filters.ts:22
Inherited from โ
SelectorFilters.originValue
predicateIds โ
protectedpredicateIds:string[] =[]
Defined in: core/frontend/nodes/selector/filters.ts:24
Inherited from โ
SelectorFilters.predicateIds
scores โ
Defined in: core/frontend/nodes/selector/filters.ts:14
Inherited from โ
SelectorFilters.scores
sortValue? โ
protectedoptionalsortValue?:Sort
Defined in: core/frontend/nodes/selector/filters.ts:17
Inherited from โ
SelectorFilters.sortValue
tags โ
protectedtags:string[] =[]
Defined in: core/frontend/nodes/selector/filters.ts:15
Inherited from โ
SelectorFilters.tags
teamValue? โ
protectedoptionalteamValue?:string
Defined in: core/frontend/nodes/selector/filters.ts:18
Inherited from โ
SelectorFilters.teamValue
volumeBox? โ
protectedoptionalvolumeBox?:SelectorVolume
Defined in: core/frontend/nodes/selector/filters.ts:20
Inherited from โ
SelectorFilters.volumeBox
xRotationRange? โ
protectedoptionalxRotationRange?:Range
Defined in: core/frontend/nodes/selector/filters.ts:25
Inherited from โ
SelectorFilters.xRotationRange
yBandValue? โ
protectedoptionalyBandValue?:object
Defined in: core/frontend/nodes/selector/filters.ts:30
dy โ
dy:
number
y โ
y:
number
Inherited from โ
SelectorFilters.yBandValue
yRotationRange? โ
protectedoptionalyRotationRange?:Range
Defined in: core/frontend/nodes/selector/filters.ts:26
Inherited from โ
SelectorFilters.yRotationRange
Accessors โ
postEffects โ
Get Signature โ
get postEffects():
PostEffectsRef
Defined in: core/frontend/nodes/selector/selector.ts:96
These players' camera post effects. See PostEffectsRef.
Returns โ
Methods โ
advancement() โ
advancement(
advancement,done?):this
Defined in: core/frontend/nodes/selector/filters.ts:179
Matches players who have (or, with done = false, haven't) completed advancement.
Parameters โ
advancement โ
done? โ
boolean = true
Returns โ
this
Inherited from โ
SelectorFilters.advancement
advancements() โ
advancements(
done):this
Defined in: core/frontend/nodes/selector/filters.ts:172
Matches players by advancement progress (advancements={<id>=true}). Repeat to add more; a later value for the same id wins.
Parameters โ
done โ
Record<string, boolean>
Returns โ
this
Inherited from โ
SelectorFilters.advancements
attribute() โ
attribute(
attr):AttributeRef
Defined in: core/frontend/nodes/selector/selector.ts:91
This entity's attr attribute. See AttributeRef.
Parameters โ
attr โ
Returns โ
distance() โ
distance(
range):this
Defined in: core/frontend/nodes/selector/filters.ts:118
Matches entities within range of the execution position (distance=).
Parameters โ
range โ
Returns โ
this
Inherited from โ
SelectorFilters.distance
forEach() โ
forEach(
body):void
Defined in: core/frontend/nodes/selector/selector.ts:101
Runs body as and at each matched entity.
Parameters โ
body โ
(ctx) => void
Returns โ
void
gamemode() โ
gamemode(
mode):this
Defined in: core/frontend/nodes/selector/filters.ts:145
Matches a game mode. Prefer Gamemode.SURVIVAL over a string.
Parameters โ
mode โ
Returns โ
this
Inherited from โ
SelectorFilters.gamemode
killWithPassengers() โ
killWithPassengers():
void
Defined in: core/frontend/nodes/selector/selector.ts:112
Kills the matched entities and everything riding them, since a killed vehicle only drops its passengers.
Returns โ
void
limit() โ
limit(
n):this
Defined in: core/frontend/nodes/selector/filters.ts:56
At most n entities (limit=).
Parameters โ
n โ
number
Returns โ
this
Inherited from โ
SelectorFilters.limit
name() โ
name(
name):this
Defined in: core/frontend/nodes/selector/filters.ts:76
Matches entities with this name (name=).
Parameters โ
name โ
string
Returns โ
this
Inherited from โ
SelectorFilters.name
nbt() โ
nbt(
nbt):this
Defined in: core/frontend/nodes/selector/filters.ts:185
Matches entities with nbt. Renders for the target version.
Parameters โ
nbt โ
Returns โ
this
Inherited from โ
SelectorFilters.nbt
near() โ
near(
pos,range):this
Defined in: core/frontend/nodes/selector/filters.ts:111
Matches entities within range of a fixed point (x=,y=,z=,distance=). Unlike a bare distance, it doesn't depend on where the command runs, and the engine only searches nearby chunks.
Parameters โ
pos โ
readonly [number, number, number]
range โ
Returns โ
this
Inherited from โ
SelectorFilters.near
notGamemode() โ
notGamemode(
mode):this
Defined in: core/frontend/nodes/selector/filters.ts:151
Excludes a game mode (gamemode=!creative). Repeat to exclude several.
Parameters โ
mode โ
Returns โ
this
Inherited from โ
SelectorFilters.notGamemode
notPredicate() โ
notPredicate(
ref):this
Defined in: core/frontend/nodes/selector/filters.ts:200
Matches entities failing a predicate (predicate=!<id>). Repeat to exclude several.
Parameters โ
ref โ
string | IdValue | PredicateRef
Returns โ
this
Inherited from โ
SelectorFilters.notPredicate
notTag() โ
notTag(
name):this
Defined in: core/frontend/nodes/selector/filters.ts:50
Excludes entities with a tag (tag=!name). Repeat to exclude several.
Parameters โ
name โ
string
Returns โ
this
Inherited from โ
SelectorFilters.notTag
notTeam() โ
notTeam(
name):this
Defined in: core/frontend/nodes/selector/filters.ts:71
Excludes members of a team (team=!name).
Parameters โ
name โ
string
Returns โ
this
Inherited from โ
SelectorFilters.notTeam
on() โ
on(
relation,body):void
Defined in: core/frontend/nodes/selector/selector.ts:107
Runs body as each entity relation of the matched ones, without moving.
Parameters โ
relation โ
body โ
(ctx) => void
Returns โ
void
predicate() โ
predicate(
ref):this
Defined in: core/frontend/nodes/selector/filters.ts:194
Matches entities passing a predicate (predicate=<id>). Repeat to require several. Cheaper than inline nbt={...}.
Parameters โ
ref โ
string | IdValue | PredicateRef
Returns โ
this
Inherited from โ
SelectorFilters.predicate
run() โ
run(
fn): (ctx) =>void
Defined in: core/frontend/nodes/selector/selector.ts:127
A body that runs fn's commands as each matched entity, one execute as per command.
Parameters โ
fn โ
(ctx) => void
Returns โ
(ctx) => void
score() โ
score(
objective,range):this
Defined in: core/frontend/nodes/selector/filters.ts:38
Matches entities whose objective score is in range (scores={...}).
Parameters โ
objective โ
range โ
Returns โ
this
Inherited from โ
SelectorFilters.score
slot() โ
slot(
slot):ItemSlotRef
Defined in: core/frontend/nodes/selector/selector.ts:86
One item slot on this entity. See ItemSlotRef.
Parameters โ
slot โ
Returns โ
sort() โ
sort(
order):this
Defined in: core/frontend/nodes/selector/filters.ts:61
Orders results (sort=). Prefer Sort.NEAREST over a string.
Parameters โ
order โ
Returns โ
this
Inherited from โ
SelectorFilters.sort
span() โ
span(
dx,dy,dz):this
Defined in: core/frontend/nodes/selector/filters.ts:101
Matches entities overlapping a dx/dy/dz box from the execution position. Vanilla adds 1 to each span, so span(0, 0, 0) is a 1-block cube.
Parameters โ
dx โ
number
dy โ
number
dz โ
number
Returns โ
this
Inherited from โ
SelectorFilters.span
tag() โ
tag(
name):this
Defined in: core/frontend/nodes/selector/filters.ts:44
Matches entities with a tag (tag=name). Repeat to require several.
Parameters โ
name โ
string
Returns โ
this
Inherited from โ
SelectorFilters.tag
team() โ
team(
name):this
Defined in: core/frontend/nodes/selector/filters.ts:66
Matches members of a team (team=).
Parameters โ
name โ
string
Returns โ
this
Inherited from โ
SelectorFilters.team
toString() โ
toString():
string
Defined in: core/frontend/nodes/selector/selector.ts:73
The selector as text, so it can be passed to any command method.
Returns โ
string
type() โ
type(
entityType):this
Defined in: core/frontend/nodes/selector/filters.ts:157
Matches one entity type, or a tag via EntityType("#ns:tag") / dp.entityTypeTag.
Parameters โ
entityType โ
Returns โ
this
Inherited from โ
SelectorFilters.type
typeOf() โ
typeOf(
other):this
Defined in: core/frontend/nodes/selector/filters.ts:163
Matches the same entity type as other, if it has one.
Parameters โ
other โ
SelectorFilters
Returns โ
this
Inherited from โ
SelectorFilters.typeOf
volume() โ
volume(
from,to):this
Defined in: core/frontend/nodes/selector/filters.ts:82
Matches entities whose hitbox overlaps the box between two corners, in any order.
Parameters โ
from โ
readonly [number, number, number]
to โ
readonly [number, number, number]
Returns โ
this
Inherited from โ
SelectorFilters.volume
xRotation() โ
xRotation(
range):this
Defined in: core/frontend/nodes/selector/filters.ts:133
Restrict by vertical look angle (x_rotation=<range>).
Parameters โ
range โ
Returns โ
this
Inherited from โ
SelectorFilters.xRotation
yBand() โ
yBand(
y,dy):this
Defined in: core/frontend/nodes/selector/filters.ts:127
A vertical band (y=<y>,dy=<dy>). dy is a signed offset, as in vanilla, not a min/max.
Parameters โ
y โ
number
dy โ
number
Returns โ
this
Inherited from โ
SelectorFilters.yBand
yRotation() โ
yRotation(
range):this
Defined in: core/frontend/nodes/selector/filters.ts:139
Restrict by horizontal look angle (y_rotation=<range>).
Parameters โ
range โ
Returns โ
this
Inherited from โ
SelectorFilters.yRotation
allEntities() โ
staticallEntities():Selector
Defined in: core/frontend/nodes/selector/selector.ts:27
Every entity (@e). Add .type(...) so the game doesn't scan them all.
Returns โ
Selector
allPlayers() โ
staticallPlayers():Selector
Defined in: core/frontend/nodes/selector/selector.ts:23
Every player (@a).
Returns โ
Selector
nearest() โ
staticnearest():Selector
Defined in: core/frontend/nodes/selector/selector.ts:31
The nearest player (@p).
Returns โ
Selector
random() โ
staticrandom():Selector
Defined in: core/frontend/nodes/selector/selector.ts:35
A random player (@r).
Returns โ
Selector
self() โ
staticself():Selector
Defined in: core/frontend/nodes/selector/selector.ts:39
The entity running the command (@s).
Returns โ
Selector
uuid() โ
staticuuid(id):Selector
Defined in: core/frontend/nodes/selector/selector.ts:43
A selector that is a bare entity UUID or player name (its own base form).
Parameters โ
id โ
string
Returns โ
Selector