{Help} How to create a display for remaining time on potions (1.12.2)

Started by HummingBird on

Topic category: Help with modding (Java Edition)

Last seen on 18:32, 12. Oct 2020
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
{Help} How to create a display for remaining time on potions (1.12.2)
Tue, 10/06/2020 - 17:42 (edited)

I'm trying to make it so you when a player has a potion effect active, numbers will appear telling them how much time is left on their effect. I'm also pretty new at working with mcreator and stuff so nice and descriptive help would be nice, thanks in advance  

Edited by HummingBird on Tue, 10/06/2020 - 17:42
Last seen on 15:43, 1. Jan 2024
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think there should be an…
Tue, 10/06/2020 - 20:03

I think there should be an procedure block for "get duration of potion ____".
You may be able to have a procedure that runs every tick and sets a global player-lifetime variable to the potion duration. And then have an overlay that displays that variable.

However, this would only work if a specific potion effect is listed, you may need to have it set for every potion. But then, since it would be trying to show all of them, you could have it so it checks for the highest one. Using is __>___ and such. Though, that would take a long while and a lot of ___>___s.

So it may be better just to leave things as is. After all, vanilla minecraft already lists potion effect durations while the inventory is open. But that's of course your choice.