Entity Selectors
Entity selectors are used to reference and create entities according to provided conditions and values.
Defining
Entity selectors can be defined with
ntscript
@NAME = @FULL_SELECTORor
ntscript
@NAME : @FULL_SELECTORwhere @NAME represents an @ followed by a valid id, and @FULL_SELECTOR is a valid Minecraft entity selector. Previously defined NetherScript selectors can be used in place of @FULL_SELECTOR.
Example
ntscript
@ExplodingCow : @e[type=cow,tag=exploding_cow]Referencing
Entity selectors can be referenced by their name.
Example
ntscript
@ExplodingCowDefining with create
Optionally, entity selectors can also be defined using a define/create/end codeblock, which functions similar to a constructor in other languages.
ntscript
define @NAME : @FULL_SELECTOR
create {NBT_VALUES}
endwhere @NAME and @FULL_SELECTOR are the same, with key-value pairs for valid Minecraft NBT data.
Example
ntscript
define @TacoCat : @e[type=cat,tag=tacocat]
create {CustomName: "tacocat"}
endReferencing with create
Entity selectors can then be referenced using create to summon them into the world.
ntscript
create @NAMEExample
ntscript
define @TacoCat : @e[type=cat,tag=tacocat]
create {CustomName: "tacocat"}
end
create @TacoCat