Started by
Wooddent
on
Topic category: Help with Minecraft modding (Java Edition)
I'm working on a procedure to increase energy on an energy GUI bar, but the wait time only works once and now makes it so that if any energy decreases, it instantly fills up again. Here is the image of the procedure: https://imgur.com/MM70r0g
This is something I've struggled with too. The issue is you have it on the global "on player tick update" so every tick, it's waiting 140 ticks and then doing your procedure, so once you reach the 140 ticks the first time, it will always be a 1 tick delay after the initial 140 ticks.
I found that the solution to this is creating something that locks the code, and then you can create something that unlocks it.
Here is an example of code: https://imgur.com/a/Q10Dw4T - For simplicity I turned your global into a local, but you should leave it as a global. If you would like you can also create a global player persistent instead of the NBT data.