Hunger



Hunger is a new aspect of the game added in the Adventure Update, which governs several aspects of gameplay. Eating food, instead of directly restoring the player's Health, now fills up the Food Bar, which is constantly draining very, very slowly.

While the player is sprinting, the Food Bar will deplete much faster, and they will be unable to sprint at all once the bar falls to 30% or less.

The Food Bar does not drain when playing on Peaceful mode, but its effects on your character's health bar remain.

When you eat Rotten Flesh, there is a ~75% possibility that your Food Bar gets poisoned and depletes faster. There is also a fairly high chance of your food bar poisoning every time you eat Raw Chicken.

Effects

 * When the hunger bar is at 80% or higher, your health will slowly regenerate, at a rate of half a heart approximately every 3 seconds.
 * When the hunger bar is below 30%, you will not be able to sprint
 * When the hunger bar is at 0%, your health will deplete at the same rate it would regenerate when at or above 90%. On Easy difficulty, the player's health stops dropping at 5 hearts, Normal stops at 1/2 a heart, and on Hard it keeps draining until you die..

Contrary to popular belief, having a full Food Bar does not keep your health bar from completely depleting when taking damage from external sources.

Mechanics
There are four fields in level.dat which are related to hunger:
 * foodLevel ranges 0–20, this value represents your hunger bar.
 * foodSaturationLevel is an invisible additional hunger variable, which is depleted before main foodLevel value. Eating any food will also add some to this variable. Note that this value cannot exceed foodLevel.
 * foodTickTimer increases with every tick when foodLevel>17 or zero. When it reaches 80 it will reset and heal or deal one point of damage.
 * foodExhaustionLevel ranges from 0.0 to 4.0 increases with every action you take. When the exhaustion level reaches 4.0 it will reverts to 0.0 and subtracts 1 point from foodSaturationLevel or from foodLevel if foodSaturationLevel equals 0.