Skip to content

Copy to Storage

Item Action Type

Copies the data of the item stack to a command NBT storage.

Type ID: eggolib:copy_to_storage

Note

The data of the item stack, such as its ID (id), count (Count), and NBTs (tag), are stored in an object named Item

Fields

Field Type Default Description
id Identifier The identifier of the command NBT storage to put the data of the item stack to.
ops Array of Copy Operations The operations to use to copy NBT from the item stack to the specified command NBT storage.

Examples

"item_action": {
    "type": "eggolib:copy_to_storage",
    "id": "example:storage",
    "ops": [
        {
            "source": "Item",
            "target": "collectedItems",
            "op": "append"
        }
    ]
}

This example will copy and add the object that contains the ID, count, and NBTs of the item stack to the collectedItems array NBT path of the example:storage command NBT storage.

"item_action": {
    "type": "eggolib:copy_to_storage",
    "id": "example:storage",
    "ops": [
        {
            "source": "Item.Count",
            "target": "amountOfItems",
            "op": "replace"
        }
    ]
}

This example will replace the value of the amountOfItems NBT path of the example:storage command NBT storage with the count value of the item stack.