Skip to main content

Store Data (Item Action Type)

Writes the item stack's ID, count and NBT into a command storage, so a later command or function macro can rebuild it.

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. Empty writes at the root.
nbtBooleantrueWhether to include the stack's saved NBT under nbt.
mergeBooleanfalseMerges into whatever is already at path instead of replacing it.

What gets written

KeyTypeValue
idStringThe item ID, such as minecraft:diamond_sword.
countIntThe stack size.
nameStringThe stack's display name.
nbtCompoundThe stack's saved NBT, when nbt is true. On 1.21 that is the component form, and on 1.20.1 the tag form.

Examples

Store the held item, then give the player another one of the same item:

"item_action": {
  "type": "apoli:store_data",
  "storage": "example:scratch",
  "path": "held"
}
"entity_action": {
  "type": "apoli:execute_command",
  "command": "give @s $(id)",
  "arguments": {
    "storage": "example:scratch",
    "path": "held"
  }
}