Origins: Powerful Powers
» Entity actions » Set item cooldown

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.

FieldTypeDefaultDescription
itemIdentifiernoneThe item, like minecraft:ender_pearl. When it's set, slot is ignored.
slotString"weapon.mainhand"Without item: the item in this slot. Same names as Item.id.
ticksIntegerrequiredThe 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 slot name 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.

json
{
  "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.

json
{
  "type": "origins-powerful-powers:set_item_cooldown",
  "ticks": 0
}