Started by
YuriRusher98
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make an item that increases your health while in the inventory and undo the health increase when taken out, but it loops constantly and keeps increasing health by tick.
This is what I was trying when I realized it didnt make sense.
This is the procedure.
Edited by YuriRusher98 on Wed, 09/14/2022 - 20:20
create a global logic variable of player lifetime
and a global procedure on player tick
IF the global is FALSE
check if player has item
if so set the variable to true. and execute your health command
ELSE if in true
and DOESN'T
have the item on inventory. execute back the command to decrease hp
and set to false the var
if you pass to 1.17+ instead of your entire procedure for the hp just execute
attribute @s minecraft:generic.max_health base set (max hp + X)
and. 0.5 in max health is less than half heart. a full heart is 2 hp