Hunger



Hunger is an aspect of Minecraft added in the Adventure Update, which governs several aspects of gameplay. Eating food, instead of directly restoring the player's Health as it did before the Adventure Update, now fills up the Food Bar, which is constantly drained by the player's actions. The Food Bar is located next to the player's Health Bar on the bottom of the screen and is represented by ten "drumsticks":



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%.

The Food Bar does not drain when playing on Peaceful mode. However, its effects on your health level remain, and switching difficulties has no effect on your Food Bar's current level. Thus, if you change the difficulty level to Peaceful while your Food Bar is empty, it will not restore your hunger level and you will continue to starve half a heart then heal half a heart.

Certain foods and potions have a chance of poisoning the player upon consumption, which causes your Food Bar to deplete faster. Rotten Flesh causes poisoning 80% of the time, and Raw Chicken causes poisoning only 30% of the time.

Effects

 * When the Food Bar is at 90% or higher, your health will slowly regenerate, at a rate of half a heart every 4 seconds.
 * When the Food Bar is below 30%, you will not be able to sprint
 * When the Food 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, on Normal it 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.

Food poisoning
Food poisoning is an effect induced by eating either raw chicken or rotten flesh, which turns the Food Bar a sickly yellow-green and slowly drains food. Rotten flesh has a high chance (80%) to cause food poisoning, and raw chicken has a fairly low chance to cause it (30%). Strangely, raw porkchop and raw beef do not have any chance of giving you food poisoning.

Behavior
Food poisoning lasts 30 seconds, and adds 15.0 to your Exhaustion Level over the duration. This is slightly less than (two "drumsticks"). In peaceful mode, the Food Bar changes color, but does not get drained.

The duration of food poisoning doesn't stack, so if the player eats many poisonous foods at once, he or she will only feel the negative effects of the most recent poisonous food, plus the consumption time of each other food.

As of prerelease 4, green swirls rise around you to indicate the sickness when you are poisoned.

Mechanics
There are four fields in level.dat which are related to hunger:
 * foodLevel ranges from 0 to 20 and is represented by your Food Bar. One point equals (half a "drumstick").
 * 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 cannot exceed foodLevel. The Food Bar jitters when this equals 0.
 * foodTickTimer increases with every tick when foodLevel is either greater than 17 or equals zero. When foodTickTimer reaches 80 it resets to zero and then heals or deals one point of damage to the Health Bar, respectively.
 * foodExhaustionLevel ranges from 0.0 to 4.0 and increases with every action you take. When the exhaustion level reaches above 4.0 it will get subtracted by 4.0 and subtracts 1 point either from foodSaturationLevel or, if foodSaturationLevel equals zero, from foodLevel.

Exhaustion level increase
''Any action not listed here will not increase exhaustion level. For example, you can travel several days in a row by boat and food bar will not decrease.''