Origins: Powerful Powers
» Entity conditions » Item on cooldown

Item on cooldown

origins-powerful-powers:item_on_cooldownentity conditionplayers only

Checks vanilla's item cooldown: the one that greys out an ender pearl or chorus fruit in the hotbar after you use it, or a shield after an axe hits it. Origins' origins:cooldown power is a separate timer.

FieldTypeDefaultDescription
itemIdentifiernoneThe item to check, like minecraft:ender_pearl. When it's set, slot is ignored.
slotString"weapon.mainhand"Without item: check whatever item is in this slot. Same names as Item.id: weapon.mainhand, weapon.offhand, armor.headarmor.feet, hotbar.0 to 8, inventory.0 to 26, enderchest.0 to 26.
comparisonComparisonnoneOptional. With it, compares the ticks left on the cooldown with compare_to.
compare_toInteger0ticks
  • Without comparison it's true while the item is on cooldown at all.
  • With comparison, an item that isn't on cooldown has 0 ticks left.
  • Cooldowns belong to the item type, so every ender pearl shares one. Each item type has its own cooldown in 1.20.1.
  • An empty slot is never on cooldown. A bad slot name is an error when the datapack loads.
  • Vanilla sends cooldowns to the client, so this also works in client-checked places like hud_render.
  • Set one yourself with set_item_cooldown. Read the ticks in code with Item.cooldown.

Example: a pearl's recoil. While your ender pearl is cooling down, you're slower.

json
{
  "type": "origins:conditioned_attribute",
  "condition": {
    "type": "origins-powerful-powers:item_on_cooldown",
    "item": "minecraft:ender_pearl"
  },
  "modifier": {
    "attribute": "minecraft:generic.movement_speed",
    "operation": "multiply_base",
    "value": -0.3
  },
  "tick_rate": 1
}

For the 20 ticks after you throw a pearl, you move 30% slower.

Example: the item in your hand has more than 5 seconds of cooldown left.

json
{
  "type": "origins-powerful-powers:item_on_cooldown",
  "comparison": ">",
  "compare_to": 100
}

Attribute: mainhand_cooldown (ticks left on the item in your main hand)