HappyKiller1O1 Posted January 27, 2016 Share Posted January 27, 2016 I understand the base of how to acquire the player's FoodStats, but I would like to know how it works. Does FoodStats#addExaustion() affect it's drain speed? Or is there a better way of doing this? I simple example would be very helpful. Quote I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat. Link to comment Share on other sites More sharing options...
coolAlias Posted January 27, 2016 Share Posted January 27, 2016 Kind of. For my own purposes, adding exhaustion was sufficient, as once that reaches 0, hunger begins to deplete, and adding more exhaustion will deplete the hunger bar directly. So if you wanted a faster hunger bar drain, you could add 0.1F exhaustion (or however much) every so often and it would basically have the effect you want. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Draco18s Posted January 27, 2016 Share Posted January 27, 2016 See: http://minecraft.gamepedia.com/Hunger#Mechanics Quote 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 More sharing options...
HappyKiller1O1 Posted January 27, 2016 Author Share Posted January 27, 2016 Thank you both, I realized I was on peaceful when testing, so the hunger bar wouldn't deplete. I do have a question about the implementation though: I use it in the #LivingUpdateEvent, and was wondering how I could do this with my weight variable. Should I create a timer that is affected by the player's current weight? Or do some math in order to determine how much exhaustion to add with the weight? Quote I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat. Link to comment Share on other sites More sharing options...
coolAlias Posted January 28, 2016 Share Posted January 28, 2016 Well that depends: how do you want it to work? Either way you'll be doing math, and either way there should be a timer of some sort involved or else the player's hunger will go down pretty darn quick. Btw, why use LivingUpdateEvent when the only ones with hunger are players? This is what PlayerTickEvent is for. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
HappyKiller1O1 Posted January 28, 2016 Author Share Posted January 28, 2016 Most of my update has been in LivingUpdate, will switch over here soon. My only problem is creating a timer within an update event. Seems the timer will always be reset, which is not what someone wants at all. Even though this is basic java, could you give an example on how I would start with a timer in a tick event? Quote I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat. Link to comment Share on other sites More sharing options...
coolAlias Posted January 28, 2016 Share Posted January 28, 2016 Your tick event is handled in a class, is it not? And classes can have class members, can they not? So make your timer a class member, and simply update it in the tick counter. Or use player.ticksExisted, which is already a timer. Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Ernio Posted January 28, 2016 Share Posted January 28, 2016 Or put it in player's IEEP if you need separate timer. Quote 1.7.10 is no longer supported by forge, you are on your own. Link to comment Share on other sites More sharing options...
Recommended Posts
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.