Skip to main content

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

FieldTypeDefaultDescription
storageIdentifierrequiredThe command storage to write into, such as example:scratch.
pathString""A key path inside that storage, separated by dots, such as "grabbed" or "last.hit". Empty writes at the root.
nbtBooleantrueWhether 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.
mergeBooleanfalseMerges into whatever is already at path instead of replacing it.

What gets written

KeyTypeValue
idStringThe entity type ID, such as minecraft:zombie.
uuidStringThe entity's UUID.
nameStringThe entity's display name.
x, y, zDoubleThe entity's position.
posString"x y z", ready to paste into a command.
dimensionStringThe dimension the entity is in.
nbtCompoundThe 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"
  }
}