minecraft.wiki-mirror/wiki_backup/Hunger#Mechanics.txt

169 lines
14 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{about|the gameplay mechanic|the effect|Hunger (effect)}}
[[File:Hotbar with xp.png|thumb|350px|The hunger indicator is shown above the hotbar, to the right of the health bar.]]
'''Hunger''' is a player-specific feature that regulates 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 (aka food bar), which is similar to the [[health]] bar. It is located above the [[hotbar]], opposite to health bar and represented by ten ham shanks ({{hunger|20|notag=1}}). One half of a ham shank ({{hunger|1|notag=1}}) represents one hunger point or half-unit of hunger, thus the full bar consists of twenty hunger points. It is replenished by eating [[food]] or having the Saturation effect, and decreased by actions such as [[sprinting]], [[digging]], or attacking.
Various levels of the player's hunger control health regeneration (or depletion) and the ability to sprint. When hunger is at least 18 ({{Hungerbar|18|9px|total=20}}), the player's health regenerates. If it falls to 6 ({{Hungerbar|6|9px|total=20}}), 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|Effects of hunger section]].
The hunger value does not drain on [[Peaceful]] difficulty and regenerates if it is not at the maximum value.
An 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. The exact mechanics that control the overall hunger value are described in detail in the [[#Mechanics|Mechanics section]].
{{See also|#Food poisoning}}
Certain foods have a chance of inflicting the [[Hunger (status effect)|Hunger]] effect on the player upon consumption, causing the player's food bar to deplete faster and turn a yellow-green color ({{hungerbar|2|9px|poisoned=1}}). These foods are [[Pufferfish (item)|pufferfish]], [[raw chicken]] (30% chance), and [[rotten flesh]] (80% chance). A [[husk]] also inflicts Hunger when it attacks a player.
== Mechanics ==
The hunger system utilizes four variables to control players' abilities, the values of which are stored in the [[player.dat format]]:
*<code>foodLevel</code>: The player's current hunger level, shown on the hunger bar. Its initial value on [[world]] creation or respawn is {{hunger|20}}.
*<code>foodSaturationLevel</code>: The player's current saturation level, which determines how fast <code>foodLevel</code> depletes and is controlled by the kinds of food the player has eaten. Its maximum value always equals <code>foodLevel</code>'s value and decreases with <code>foodLevel</code>. Its initial value on world creation or respawn is 5.
*<code>foodTickTimer</code>: This variable is used when <code>foodLevel</code> either exceeds 17 ({{Hungerbar|17|9px|total=20}}), or is at zero. It increases on every [[tick]], and whenever it reaches 80 (4 seconds), it resets to zero and {{hp|1}} is added or deducted, depending on whether the player is saturated or starving. If the player has a full {{hunger|20}}, {{frac|1|6}} of {{hp|1}} times the player's <code>foodSaturationLevel</code> is restored, up to a maximum of {{hp|1}}, when <code>foodTickTimer</code> reaches 10 ({{frac|1|2}} second), and <code>foodTickTimer</code> is reset to zero.
*<code>foodExhaustionLevel</code>: The player's current exhaustion level, which determines how fast the <code>foodSaturationLevel</code> depletes. Its value is increased by the player's actions (see [[#Exhaustion level increase|Exhaustion level increase]] for specific values). The initial value is zero. When it reaches a value of at least 4, the total value is decreased by 4 and one point is subtracted from <code>foodSaturationLevel</code>, or <code>foodLevel</code> if <code>foodSaturationLevel</code> is at zero.
The above variables can be queried in-game with the following command: {{cmd|data get entity <player's name> <variable>}}{{only|je}}.
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 {{hunger|1}}. Eating [[food]] replenishes both hunger and saturation levels (see [[#Food level and saturation level restoration|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 {{hunger|6}} and 14.4 saturation points) is eaten by a player whose hunger bar is at {{hunger|9|total=20}} and saturation is below 1, its value increases to 15 ({{Hungerbar|15|9px|total=20}}), and the golden carrot's saturation potential is fully used. However, if the hunger level is {{hunger|8|total=20}}, its value increases to 14 ({{Hungerbar|14|9px|total=20}}) and only 14 saturation points are used.
=== Effects of hunger ===
Various hunger levels lead to various effects on the player:
*When the hunger bar is at 20 ({{Hungerbar|20|9px}}) and there is any saturation left, health regenerates {{hp|1}} every {{frac|1|2}} second.{{only|java|short=JE}}
*When the hunger bar is at 18 ({{Hungerbar|18|9px|total=20}}) or more, health slowly regenerates {{hp|1}} every 4 seconds.
*When the hunger bar is at 17 ({{Hungerbar|17|9px|total=20}}) points or below, the player does not naturally regenerate health.
*If the hunger bar is at {{hunger|6|total=20}} points or below, then the player cannot sprint.
*When the hunger bar is at {{hunger|0|total=20}}, the player's health depletes at a rate of {{hp|1}} every 4 seconds (this makes [[sleeping]] impossible). On Easy [[difficulty]], the player's health stops dropping at {{hp|10|total=20}}, on Normal, it stops at {{hp|1|total=20}}, and on Hard, it keeps draining until either the player eats something or starves to death. [[Resistance]] and [[armor]] do not reduce starvation damage.<ref>{{tweet|jeb_|111047534318858240|If the the food bar is empty in MC 1.8, it will slowly drop your health to 5 hearts on easy, to 0.5 hearts on normal, and kill you on hard|September 6, 2011}}</ref>
Switching to [[Peaceful]] difficulty eliminates all penalties above, and rapidly restores the player's hunger bar and health.
=== 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.''
{| class="sortable mw-collapsible wikitable" data-description="Exhaustion"
! class="unsortable" |Action
!Exhaustion<br>level increase
!Units
|-
|[[Swimming]]
| style="text-align: center;" |0.01
|per meter
|-
|[[Breaking]] a block
| style="text-align: center;" |0.005
|per block broken
|-
|[[Sprinting]]
| style="text-align: center;" |0.1
|per meter
|-
|[[Jumping]]
| style="text-align: center;" |0.05
|per jump
|-
|Attacking an [[entity]]
| style="text-align: center;" |0.1
|per attack landed
|-
|Taking [[damage]] that is normally [[Armor#Damage types|protected by armor]]
| style="text-align: center;" |0.1
|per distinct instance of damage being received
|-
|{{EffectLink|link=Hunger (status effect)|Hunger}}
| style="text-align: center;" |0.005
|per tick, per Hunger status effect level
|-
|Jumping while sprinting
| style="text-align: center;" |0.2
|per jump
|-
|Regenerating health by having {{hunger|18|notag=1}} or higher and<br>having [[gamerule]] <code>naturalRegeneration</code> set to <code>true</code>
| style="text-align: center;" |6.0
|per {{hp|1}} healed
|-
|{{EffectLink|link=Hunger (status effect)|Hunger}} from [[raw chicken]] or [[rotten flesh]], or taking damage from [[husk]]s.
| style="text-align: center;" |3.0
|full 0:30 duration of Hunger I, at 0.1 per second
|-
|{{EffectLink|link=Hunger (status effect)|Hunger}} from [[Pufferfish (item)|pufferfish]]
| style="text-align: center;" |4.5
|full 0:15 duration of Hunger III, at 0.3 per second
|-
|Getting pushed by flowing water
| -
| -
|}
=== Food level and saturation level restoration ===
{{main|Food}}
{{:Food/table}}
== Food poisoning ==
{{expand section|section=}}
{{main|Hunger (effect)}}
[[File:Eating Rotten Flesh.png|thumb|right|An example of how eating rotten flesh can cause the food poisoning.]]
When the player eats [[raw chicken]], [[rotten flesh]], or [[pufferfish (item)|pufferfish]], they have a chance to briefly get the hunger effect. This is called food poisoning.
This turns hunger bar ({{hunger|20|notag=1}}) green, and causes the player to lose 1 point ({{hunger|1|notag=1}}) of hunger every 4 seconds, for every level, for the duration of the effect. This is stacked with hunger lose from sprinting, jumping, etc.
== Achievements ==
{{load achievements|Iron Belly}}
== Video ==
<div style="text-align:center">{{Video note|This video is from [[Java Edition 1.5]], so not all changes were applied.}}{{yt|yOAGhLP971s}}</div>
== History ==
{{HistoryTable
|{{HistoryLine|java beta}}
|{{HistoryLine||July 19, 2011|link={{tweet|notch|93305042941132801}}|The hunger bar is first seen in an image Notch posted to Twitter that showcases his experimentation with world height.}}
|{{HistoryLine||1.8|dev=Pre-release|Hunger was introduced. Food no longer restores health directly, but the player can regenerate if the hunger meter is 90% or over.}}
|{{HistoryLine|java}}
|{{HistoryLine||1.6.1|dev=13w23a|Natural health regeneration now increases the food exhaustion level.}}
|{{HistoryLine||1.8|dev=14w29a|Hunger now regenerates when depleted if the [[difficulty]] is set to Peaceful.}}
|{{HistoryLine||1.9|dev=15w40a|Health regenerates faster when saturation is non-zero.
|Health regeneration increases exhaustion more.}}
|{{HistoryLine|||dev=15w44a|Health regenerates speed bonus from non-zero saturation only applies when the hunger bar is at 20.}}
|{{HistoryLine|||dev=15w49a|Sneaking now increases exhaustion by 0.005/m, decreased from 0.01/m.}}
|{{HistoryLine||1.11|dev=16w32a|Exhaustion rates decreased across the board: Swimming decreased from 0.015/m to 0.01/m, breaking blocks decreased from 0.025/block to 0.005/block, jumping decreased from 0.2/jump to 0.05/jump, sprint jumping decreased from 0.8/jump to 0.2/jump, attacking and taking damage both decreased from 0.3/attack to 0.1/attack, Hunger status effect decreased from 0.5/s to 0.1/s.
|Sneaking and walking no longer affect exhaustion.
|Exhaustion rate from regeneration is increased from 4.0/half-heart to 6.0/half-heart.
|The hunger bar is now visible when riding a [[boat]] or a [[minecart]].}}
|{{HistoryLine|upcoming java}}
|{{HistoryLine||Combat Tests|dev=Combat Test 5|Saturation is no longer capped by the hunger level of the player.|Upon eating food, the player's saturation is always set to the food's provided saturation amount unless their current saturation level exceeds what is obtainable from the food.|High saturation no longer gives a fast regeneration boost.|Changed food eating speed from {{convert|32|ticks|seconds}} to {{convert|40|ticks|seconds}}.|The player now naturally regenerates health when above a hunger level of {{hunger|7|total=20}} instead of {{hunger|18|total=2}}|The player now naturally heals every {{convert|60|ticks|seconds}} instead of every {{convert|80|ticks|seconds}}.|The player now takes damage from starvation every {{convert|60|ticks|seconds}} instead of every {{convert|80|ticks|seconds}} when the hunger bar is empty.|Natural healing now always drains food points.|Saturation is not used when healing damage, and is only relevant to other actions that drain the hunger bar.|The player can now [[sprint]] at any hunger value.}}
|{{HistoryLine|||dev=Combat Test 6|Reverted eating speed to 32 ticks (1.6 seconds).|Eating is now interrupted if something hits the [[player]].|The player now naturally heals every {{convert|40|ticks|seconds}} instead of every {{convert|60|ticks|seconds}}.|The player now takes damage from starvation every {{convert|40|ticks|seconds}} instead of every {{convert|60|ticks|seconds}} when the hunger bar is empty.|Natural healing drains [[food]] points 50% slower.|Reintroduced the rule that [[sprint]]ing requires more than 6 points of food.}}
|{{HistoryLine|pocket alpha}}
|{{HistoryLine||v0.12.1|dev=build 1|Hunger was introduced. Food no longer restores health directly, but the player can regenerate if the hunger meter is 90% or over.}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.18.30|dev=Preview 1.18.20.26|The rate that hunger decreases has been changed to better match ''[[Java Edition]]'' and can now be changed with behavior packs ([[add-on]]s).<ref>{{cite bug|MCPE|56031|Hunger bar depletes too fast|date=November 7, 2019|resolution=Fixed}}</ref>}}
|{{HistoryLine|console}}
|{{HistoryLine||xbox=TU5|xbone=CU1|ps3=1.00|psvita=1.00|ps4=1.00|wiiu=Patch 1|switch=1.0.1|Added the food bar and hunger.}}
|{{HistoryLine||xbox=TU43|xbone=CU33|ps3=1.36|psvita=1.36|ps4=1.36|wiiu=Patch 13|Food now regenerates health.}}
|{{HistoryLine||xbox=TU54|xbone=CU44|ps3=1.52|psvita=1.52|ps4=1.52|wiiu=Patch 24|switch=1.0.4|Exhaustion rates decreased across the board: Swimming decreased from 0.015/m to 0.01/m, breaking blocks decreased from 0.025/block to 0.005/block, jumping decreased from 0.2/jump to 0.05/jump, sprint jumping decreased from 0.8/jump to 0.2/jump, attacking and taking damage both decreased from 0.3/attack to 0.1/attack, Hunger status effect decreased from 0.5/s to 0.1/s.
|Sneaking and walking no longer affect exhaustion.
|Exhaustion rate from regeneration is increased from 0.4/half-heart to 0.6/half-heart.}}
}}
== Issues ==
{{issue list}}
== References ==
{{Reflist}}
== Navigation ==
{{Navbox gameplay}}
[[Category:Rewritten gameplay]]
[[de:Hunger]]
[[es:Hambre]]
[[fr:Faim]]
[[hu:Éhség]]
[[it:Fame]]
[[ja:満腹度]]
[[ko:배고픔]]
[[nl:Honger]]
[[pl:Głód]]
[[pt:Fome]]
[[ru:Голод]]
[[tr:Açlık]]
[[uk:Голод]]
[[zh:饥饿]]