Started by
Mando1mS
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make an item that heals you when you are low hp. The problem is that I need a cooldown for that heal or it would be too op.
I issued a cooldown on the item when healed but that cooldown only disables the item not the procedure where he heals.
So I tried to do this but its not working... I think its because the NBT Tag that I put is not the same for item stack (CoolDownActivated) or maybe this is not the way to verify if it has cooldown
If you could help me I would appreciate.
Edited by Mando1mS on Tue, 08/25/2020 - 17:33
https://gyazo.com/173999bfc43c760e0d20f0d49f92cb32
this is the image couldn't link it sry
The cooldown makes you unable to use an item, basically disabling right-click. I doubt there is a vanilla NBT tag for checking for cooldown, and if there is one, it surely is named differently.
If you want the item to heal you on right-click, the cooldown works just fine. If you want it to work automatically, you would have to create a manual kind of cooldown.
You could either have a custom cooldown potion effect (so the procedure could check if the player has that effect active) or create a new player nbt variable.
When the item heals the player, the variable is set to 6000. Each tick the variable automatically decreases by one (by using a global trigger like "on player tick").
You could still have the visual item cooldown (besides the nbt variable) so the player knows if the item can be used again :)
Nice point. I think I will do that with the potion effect its even better because the player can see how much cooldown is left. Thank you for your help
No problem :)