Trying to make an item heal a player a specific amount, but is just fill healing player

Started by Raven78 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Trying to make an item heal a player a specific amount, but is just fill healing player

So I'm trying to make an item heal the player 3 hearts. I have it working, but it full heals the player instead of just 3 hearts.

 Here is what I currently have:

https://imgur.com/a/WYWMZFI

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm guessing the problem…
Fri, 10/21/2022 - 12:47

I'm guessing the problem here is that the right click trigger will trigger repeatedly if you're pushing right-click, even if you quickly discard the item. If you want to avoid this, either:

  • If the item is consumable, make sure to put a 'shrink itemstack' block before the healing trigger, so it won't continue to process the thing.
  • ...And if not, add some sort of cooldown, probably in the form of a player persistent variable that counts down every tick until it reaches zero and only allows the player to heal if it's at zero.