Appearance
spool / EntitySet
Class: EntitySet
Defined in: plugins/entity_set/index.ts:19
A named set of entities tracked by an entity tag. The point is lag: a bare @e selector iterates every loaded entity every time it runs - the single biggest source of datapack tick cost. Registering the entities you care about under a tag and querying set.all() turns that into a bounded @e[tag=…] scan, which the per-tick cost report (dp.report()) recognises as narrowed and does not flag.
The tag id is the set name, so two EntitySets with the same name address the same membership - identity is the name, not the instance.
(Named EntitySet, not "registry", to stay clear of helix's dp.registryFile and the registry data-resource concept - this is purely an entity-tag set.)
Constructors
Constructor
new EntitySet(
name):EntitySet
Defined in: plugins/entity_set/index.ts:20
Parameters
name
string
Returns
EntitySet
Properties
name
readonlyname:string
Defined in: plugins/entity_set/index.ts:20
Methods
add()
add(
ctx,who?):void
Defined in: plugins/entity_set/index.ts:23
Mark who (default @s) as a member - call where the entity is summoned.
Parameters
ctx
FunctionContext
who?
Selector = ...
Returns
void
all()
all():
Selector
Defined in: plugins/entity_set/index.ts:33
A selector over members only: a bounded @e[tag=name], not a full sweep.
Returns
Selector
nearest()
nearest():
Selector
Defined in: plugins/entity_set/index.ts:38
The nearest single member (@e[tag=name,limit=1,sort=nearest]).
Returns
Selector
remove()
remove(
ctx,who?):void
Defined in: plugins/entity_set/index.ts:28
Drop who (default @s) from the set.
Parameters
ctx
FunctionContext
who?
Selector = ...
Returns
void