Set item cooldown
origins-powerful-powers:set_item_cooldownentity actionplayers only
Puts an item on vanilla's item cooldown, or takes it off. It's the cooldown ender pearls and chorus fruit use: the item greys out in the hotbar and can't be used until it runs out. It works on any item. Vanilla checks it before every right-click use, so a block on cooldown can't be placed and a bow can't be drawn. Attacking with the item still works. Check it with item_on_cooldown.
| Field | Type | Default | Description |
|---|---|---|---|
item | Identifier | none | The item, like minecraft:ender_pearl. When it's set, slot is ignored. |
slot | String | "weapon.mainhand" | Without item: the item in this slot. Same names as Item.id. |
ticks | Integer | required | The new cooldown. 0 or less removes it. |
- It replaces any cooldown the item already has, longer or shorter.
- Cooldowns belong to the item type: cooling down the pearl in your hand cools down every pearl.
- An empty slot does nothing. A bad
slotname is an error when the datapack loads. - The hotbar shows the change. Like vanilla's, it isn't saved and is gone after relogging.
Example: "Anchor". Getting hit locks your ender pearls for 5 seconds.
{
"type": "origins:action_when_damage_taken",
"entity_action": {
"type": "origins-powerful-powers:set_item_cooldown",
"item": "minecraft:ender_pearl",
"ticks": 100
},
"cooldown": 1
}Example: clear the cooldown on whatever you're holding.
{
"type": "origins-powerful-powers:set_item_cooldown",
"ticks": 0
}