Hunger



Hunger is a player-specific feature of Minecraft that regulates player's certain abilities (health regeneration and the ability to sprint) the value of which is managed by the player's activity.

Description
The player's hunger value is shown on the heads-up display in the form of a hunger bar (also called food bar), which is similar to health bar (located above the hotbar), located opposite to it and represented by ten drumsticks. One half of a drumstick represents one hunger point or half-unit of hunger, thus the full bar consists of twenty hunger points. It is replenished by eating food, and decreased by player's actions such as sprinting, digging or attacking.

Various levels of player's hunger control health regeneration (or depletion) and the ability to sprint. When hunger is at a high enough value, the player's health regenerates. If it falls below a specific threshold, the player loses the ability to sprint. If the hunger bar is at zero, the player's health depletes. The specific effects are described in the Effects of hunger section. The hunger value does not drain on Peaceful difficulty and regenerates if it is not at the maximum value.

An important aspect of hunger not shown on the hunger bar is called food saturation and controls the decreasing of the hunger value. It depends on what the player has eaten last. There is also a food exhaustion value that controls the decreasing of the food saturation level. How exactly they control the overall hunger value is described in more depth in the Mechanics section.

Certain foods have a chance of inflicting Hunger status effect on the player upon consumption, causing the player's food bar to deplete faster. See also Food poisoning.

Mechanics
The hunger system utilizes four variables to control players' abilities, the values of which are stored in the player.dat format:
 * foodLevel: The player's current hunger level, shown on the hunger bar. Its initial value on world creation is 20 (full bar).
 * foodSaturationLevel: The player's current saturation level, which determines how fast the hunger level depletes and is controlled by the kinds of food the player has eaten. Its maximum value always equals foodLevel's value and decreases with the hunger level. Its initial value on world creation is 5.
 * foodTickTimer: This variable is used when the hunger value either exceeds, or is at zero. It increases on every tick, and whenever it reaches 80 (4 seconds), it resets to zero and is added or deducted, depending on whether the player is saturated or starving. If the player has a full , $1/6$ of  times the player's saturation level is restored, up to a maximum of , when foodTickTimer reaches 10 ($1/2$ second), and foodTickTimer is reset to zero.
 * foodExhaustionLevel: The player's current exhaustion level, which determines how fast the saturation level depletes. Its value is increased by the player's actions (see Exhaustion level increase for specific values). The initial value is zero. When it reaches the maximum value of 4, it resets to zero and one point is subtracted from foodSaturationLevel.

As a visible sign that the saturation is used up, the hunger bar starts to shake or jitter periodically. When the saturation level is at zero, once the exhaustion value reaches 4, the total hunger value is decreased by one hunger point. Eating food replenishes both hunger and saturation levels (see Food level and saturation level restoration for specific values), with the hunger level being replenished first, which also increases the maximum allowed saturation level. For example, if a golden carrot (giving and 14.4 saturation points) is eaten by a player whose hunger bar is at  and saturation is below 1, its value increases to, and the golden carrot's saturation potential is fully used. However, if the hunger level is lower than, the specific foodstuff's saturation points are wasted.

Effects of hunger
Various hunger levels lead to various effects on the player:
 * When the hunger bar is at and there is still some saturation left, health regenerates at up to  health point each $1/2$-second, costing 1.5 food points (6 units of exhaustion) per point healed.
 * When the hunger bar is at or more with no saturation remaining, the player's health slowly regenerates at a rate of  every 4 seconds, costing 1.5 food points (6 units of exhaustion) per point healed.
 * When the hunger bar is at points or below, the player does not naturally regenerate health unless difficulty is switched to Peaceful.
 * If the hunger bar is at points or below, then the player cannot sprint unless difficulty is switched to Peaceful.
 * When the hunger bar is at, the player's health depletes at a rate of every 4 seconds (this makes sleeping impossible). On Easy difficulty, the player's health stops dropping at , on Normal it stops at , and on Hard it keeps draining until either the player eats something or starves to death.

Exhaustion level increase
''Any action not listed here does not increase exhaustion level. For example, normal walking doesn't increase exhaustion, and therefore does not decrease saturation or the food bar.''