Jump to content

How can I make my own hunger-style bar?


Recommended Posts

Hey guys.


I want to make two new GUI bars; Thirst and Fatigue, which will add a new element of gameplay to my mod to add immersion. (I know mod's already exist for both, but I don't want to suggest people install other mods; instead these will just be disable-able)


Anyways, I followed the GUI Overlay tutorial on the wiki, but it really didn't help me very much. I only really need to know two things;


1. How can I render the bar? (The tutorial doesn't cover that, just gives code to copy and I can't figure out which numbers read specific textures from the spritesheet)


2. Where is the vanilla hunger class? (Not the EntityPlayer) I want to see how it works, how it decreases and how food increases it again so I can learn from it. If that is covered in EntityPlayer can you give me line numbers, because I really can't find it in there.


3. How can I designate when things will render? I want other overlays which only render at certain times (Such as when in certain dimensions, or when wearing a helmet)


4. Is it possible to disable vanilla bars? I'm also adding Oxygen, so it'd be nice if I can disable the vanilla bubbles and replace them with mine, seeing as when players have an oxygen tank that bar would be useless anyway.

Also, totally off topic but the forums barely load for me anymore, so squeezing as much into this post as I can. Does anyone know an up-to-date 1.5.2 plant tutorial?

width=463 height=200


My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

Best I can offer is the code I made when I added my own bar.  I think it was this thread.  If it wasn't I linked to it in this thread.  And all my code is on github, because I'm awesome like that, even if it took me a few days to figure out how to use it (and towards the end of my development cycle*).


As far as I know, there's no way to disable the vanilla bars outside of base class editing.  I am not aware of any kind of render order controls, but if you find some, let me know!  My bar renders on top of the chat, which is annoying (there's 2 pixels of coverage on the last line).


*I wanted to archive the project when I was done, rather than keep a version history.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.


Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.


DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

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.


  • Create New...

Important Information

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