Hunger



Hunger is a new aspects 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.

If the Food Bar is 90%-100% full you slowly regenerate health, but if you let it drain all the way to 0%, you constantly lose half a heart instead, as you are starving to death. 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.

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.

Mechanics
There are four fields in level.dat which are related to hunger: Some info about food level and saturation level restoration:
 * foodLevel ranges 0–20, this value represents your hunger bar.
 * foodSaturationLevel is a 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. Moving, sprinting, jumping all of this will increase this variable. Breaking a block will add 0.025 to value, placing a block will not add anything. After exhaustion level reaches 4.0 it will reverts to 0.0 and substract 1 point from foodSaturationLevel or from foodLevel if foodSaturationLevel equals 0.