Denizen Script Commands

Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.

Showing 1 out of 183 commands...
Syntaxattach [<entity>|...] [to:<entity>/cancel] (offset:<offset>) (relative) (yaw_offset:<#.#>) (pitch_offset:<#.#>) (sync_server) (no_rotate/no_pitch) (for:<player>|...)
Short DescriptionAttaches a list of entities to another entity, for client-visible motion sync.
Full DescriptionAttaches a list of entities to another entity, for client-visible motion sync.

You must specify the entity or list of entities to be attached.
You must specify the entity that they will be attached to, or 'cancel' to end attachment.

Optionally, specify an offset location vector to be a positional offset. This can include a yaw/pitch to offset those as well.
Note that setting an offset of 0,0,0 will produce slightly different visual results from not setting any offset.

Optionally, specify 'relative' to indicate that the offset vector should rotate with the target entity.
If relative is used, optionally specify yaw_offset and/or pitch_offset to add an offset to rotation of the target entity when calculating the attachment offset.

Optionally, specify 'for' with a player or list of players to only sync motion for those players.
If unspecified, will sync for everyone.

Optionally, specify 'sync_server' to keep the serverside position of the attached entities near the target entity.
This can reduce some visual artifacts (such as entity unloading at distance), but may produce unintended functional artifacts.
Note that you should generally only use 'sync_server' when you exclude the 'for' argument.

Optionally specify 'no_rotate' to retain the attached entity's own rotation and ignore the target rotation.
Optionally instead specify 'no_pitch' to retain the attached entity's own pitch, but use the target yaw.

Note that attaches involving a player will not be properly visible to that player, but will still be visible to *other* players.

It may be ideal to change setting "Packets.Auto init" in the Denizen config to "true" to guarantee this command functions as expected.
Related Tags<EntityTag.attached_entities[(<player>)]> Returns the entities attached to this entity by Command:attach. (...)
<EntityTag.attached_to[(<player>)]> Returns the entity that this entity was attached to by Command:attach. (...)
<EntityTag.attached_offset[(<player>)]> Returns the offset of an attachment for this entity to another that was attached by Command:attach. (...)
Usage Example
#Use to attach random NPC to the air 3 blocks above a linked NPC.
- attach <server.list_npcs.random> to:<npc> offset:0,3,0