-
-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set saturation level to food level with feed flag.
- Loading branch information
Showing
1 changed file
with
10 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't saturation normally max out at 5?
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea...I think without a separate flag, we should set it to 5 for a positive feed_amount, and 0 for any negative feed_amount.
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it might be best to do it only after the food has exceeded the food bar's capacity, otherwise strange things will happen, like 3 hunger with 3 invisible hunger...
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, and according to the MC wiki, saturation levels max at current food level. Therefore, your saturation level would max out at 20 if your food level was 20, and so on, as demonstrated in the code here.
I personally think that adjusting food level without adjusting saturation level is pretty pointless. If your saturation level is at 0 and your food level is bumped to 20, your food level will plummet down to 0 anyway, defeating the purpose.
Now perhaps there's an argument for not adjusting saturation if the food level is on a downward trend.
On the comment of "strange things": If you have 3 hunger and 0 "invisible hunger", you will drop to 0 hunger very soon. You need invisible hunger, aka. saturation. Arguably, 90% of what makes up hunger in Minecraft is the saturation level -- the food level is completely useless (the exception, of course, is when you drop to 6 or below food level).
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I was under the impression that saturation was only affected after your current hunger bar was filled, thus being the extra. For example, steaks restores 8 hunger, and if eaten at 19 hunger would add 7 saturation. (EDIT: Though, now that I think about it, that doesn't make much sense with the presumption that it maxes at 5 lol)
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some testing to confirm how it actually works. Saturation does max out at 20, not 5, however, the behaviour here is still slightly strange, food has a separate value assigned to it for saturation, which makes things very awkward here. Ideally we could just have a separate flag for saturation amounts, but that would cause further confusion when you look at a declining hunger value -- so for addition this probably is the best case. Furthermore, the proper behaviour for removing hunger would indeed be to subtract the saturation, and then begin subtracting from the hunger level, so that should probably be changed.
One thing that I suppose should be considered is that now capping the maximum hunger caps the maximum saturation, which could cause strange behaviour for some existing usage cases of the flag -- though at the same time, the maximum food level is correlated to the maximum saturation level, and it's unlikely that anyone has a mechanic that is so finely tuned that it encompasses the usage of the saturation level, so... do we actually care?
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean by "now" -- maximum hunger has always capped saturation.
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our flag caps it now, if you set max-hunger, it will modify the saturation, where as before it was untouched, ex max-hunger could be 4 and you could have a saturation level of 20 prior to this change. It's probably not worth worrying about in the slightest, but I figured I'd mention it.
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Minecraft not cap it?
b298bed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It caps at 20, you can set a lower value to the saturation now though, and effectively cap it at some lower number like 16 with the flag, where as prior to the change it would be the default value (EDIT: we wouldn't modify the saturation, so the effective cap was the game's hard cap of 20), and thus capped at 20 regardless of the flag's value.