Started by
FreezieYT
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make it so each time you use the item, (right click) it will give you potion effects, (already did that part) but my issue comes in when I try to make it add time. How do i make it add to the duration of the potion effect each time I use it item?
Since potion effects only override eachother if the duration is longer, you would need a special procedure, in which the duration of the potion is the duration you want, added to the existing duration of that potion. (Make an if bracket that checks if the player already has the potion, and, if they do, add the potion, but replace the duration with the duration + the existing duration of the potion.)
The 'get ticks remaining of potion' function should be helpful here.
Do you know how to make that procedure?
Normally you would use the 'apply potion to entity' function. But in your case, you need to replace the duration, (the part where it asks you for a number), with the current duration of the potion, plus the duration you want to add. It should just be a single procedure block, but with a plus function where you would normally put the duration.
I'm still confused on how to make the function so each time it is used, you get the effects longer
It should probably look something like this. You may not even need the if bracket, it should probably just work with the first part, but this way you could make the initial duration longer, if you wanted.