Adding Stat Bars to GUIs and overlays

Upvotes: 12
Issue description

Can we have a way to make custom stat bars with events to cause them to change? Like health bars and hungers bars; health changes when the player is injured, poisoned or other things, hunger changes when moving or eating, and oxygen decreases as the player spends more time underwater. A way to make our own status bars with different causes for change would be great.

Issue comments

A limited way to do this can already be achieved using Overlays and procedures. We will add the support for actual stat bars as hunger, health, air, ... in the future updates.

You can do this by adding multiple overlays for each different stage of the status bar, and use procedures to activate them when different things happen. You can do this with global variables to help, but I don't recommend it as it would not be multiplayer friendly and would act weirdly with other worlds and reloading a world.

How does 1.8.3 change this? Please respond, I need something like this for my mod. 

Sorry for late reply diamondcarrot, just make lots of different overlays, each one at each different stage of the bar. (so one for full, one for 1 off full, one for 2 off full etc.). Then, add a player nbt tag for your stat bar. Have a player tick update procedure that puts a different overlay on depending on the nbt number tag. Then, when you want something to add or take away from your stat bar, just make it do that for the nbt tag.

Ok but i can not do that beacuse (im using 1.8.3) it does not let me acsess global varibles in the "when to show overlay" block(code?) area and says that it does not support it.

 

(sry for terrible grammar)

I guess the way to do this will be option to link progress bar with a number variable and you will be able to control the value of the variable from the update tick then.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.