Replace Inventory

Entity Action Type

Replaces the items from either the entity's inventory or a power that uses the Inventory (Power Type).

Type ID: origins:replace_inventory

Fields

Field Type Default Description
inventory_type Inventory Type "inventory" Determines whether to replace the items from the inventory of the entity or the inventory of a power present in the entity.
entity_action Entity Action Type optional If specified, this action will be executed on the entity before the items are replaced.
item_action Item Action Type optional If specified, this action will be executed on the affected items after the affected items are replaced.
item_condition Item Condition Type optional If specified, only items which fulfill this condition will be replaced.
slot Item Slot optional If specified, only items in the designated slot will be replaced.
slots Array of Item Slots optional If specified, only items in the designated slots will be replaced.
power Identifier optional If specified, the items in the inventory of this power will be replaced instead of the items in the entity's inventory if inventory_type is set to "power".
stack Item Stack The item to use as a replacement for the affected items.
merge_nbt Boolean false Determines whether to merge the NBTs of the item that will be replaced and the NBTs of the item that will be used as a replacement.

Examples

"entity_action": {
    "type": "origins:replace_inventory",
    "slot": "weapon.offhand",
    "stack": {
        "item": "minecraft:barrier"
    }
}

This example will replace the item in the entity's offhand with a Barrier item.

"entity_action": {
    "type": "origins:replace_inventory",
    "inventory_type": "power",
    "power": "origins:extra_inventory",
    "stack": {
        "item": "minecraft:air"
    }
}

This example will clear the contents of the origins:extra_inventory power by replacing all the items with Air.