Store Data (Entity Action Type)
Writes the entity's ID, position and NBT into a command storage. From there, /data get storage, a function macro or the arguments of apoli:execute_command can read it back.
Type ID: apoli:store_data
Fields
| Field | Type | Default | Description |
|---|---|---|---|
storage | Identifier | required | The command storage to write into, such as example:scratch. |
path | String | "" | A key path inside that storage, separated by dots, such as "grabbed" or "last.hit". Empty writes at the root. |
nbt | Boolean | true | Whether to include the entity's full NBT under nbt. Serialising an entity isn't cheap, so turn it off in anything that runs every tick. |
merge | Boolean | false | Merges into whatever is already at path instead of replacing it. |
What gets written
| Key | Type | Value |
|---|---|---|
id | String | The entity type ID, such as minecraft:zombie. |
uuid | String | The entity's UUID. |
name | String | The entity's display name. |
x, y, z | Double | The entity's position. |
pos | String | "x y z", ready to paste into a command. |
dimension | String | The dimension the entity is in. |
nbt | Compound | The entity's NBT, when nbt is true. |
Examples
"entity_action": {
"type": "apoli:store_data",
"storage": "example:scratch",
"path": "victim",
"nbt": false
}Then read it back straight away, with no function macro:
"entity_action": {
"type": "apoli:execute_command",
"command": "summon minecraft:lightning_bolt $(pos)",
"arguments": {
"storage": "example:scratch",
"path": "victim"
}
}