Jump to content

[1.15.2] How do you create a GUI Overlay like a hunger bar?


xVoidZx

Recommended Posts

I can't find any documentation for 1.15.2 forge on how to do this. I basically want a thirst meter that goes above the hunger bar. If anyone knows where any docs for this are or has any source code please let me know! :)

This is my first time using forge, normally I make plugins for Spigot so apologies.

Edited by xVoidZx
Link to comment
Share on other sites

Subscribe to the RenderGameOverlayEvent (Pre or Post, depending on your needs) and put your rendering code there. Important: Make sure to filter the event by calling getType on it, otherwise your code will be called multiple times which isn't good. For your purposes, I'd recommend filtering for the FOOD event type.

To see what your rendering code would need to be, simply study how vanilla does it. A good example of what you're trying to do would be in ForgeIngameGui#renderFood.

Edited by imacatlolol
  • Like 1

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.