"Apply cooldown on <item> to provided player" procedure block

Status
Fixed
Issue description

It's possible to apply the vanilla cooldown (see enderpearls) on any item with this line of code:

playerIn.getCooldownTracker().setCooldown(Item item, int duration);

where "duration" is measured in ticks.

Issue comments

Thanks for the code example, I will consider implementing this.

But there is another way to make a cooldown for items:

  1. Use NBT variable to store cooldown info
  2. On item in inventory tick update or in hand tick update, decrement the value of the NBT variable by one, until it is 0, then stop decrementing
  3. In on item used, check if the variable is 0 and in this case, perform item action and set the counter to say 100 for 5 second cooldown (20 ticks = 1 second), otherwise do nothing

There are some cases where this can not be used so I will definitely test your code too and try to add it.