
A small API that adds a stamina system controlled by entity attributes.
This API adds a stamina system controlled by entity attributes.
LivingEntities can have up to generic.max_stamina amounts of stamina. Stamina is regenerated by generic.stamina_regeneration every generic.stamina_tick_threshold ticks.
When stamina is reduced, regeneration is stopped for generic.stamina_regeneration_delay_threshold ticks.
When stamina is <= 0, regeneration is stopped for generic.depleted_stamina_regeneration_delay_threshold ticks.
generic.reserved_stamina describes the percentage amount of maximum stamina, that is currently not available.
generic.item_use_stamina_cost is the amount of stamina that is reduced when using an item with a stamina cost.
There are two ways to give an item a stamina cost:
"staminaattributes:using_costs_stamina":
{
"values": [
"minecraft:snowball"
]
}
"staminaattributes:continuous_using_costs_stamina":
{
"values": [
"minecraft:bow",
"minecraft:crossbow",
"minecraft:shield"
]
}
When the gamerule "naturalStaminaRegeneration" is true, players have a stamina regeneration of at least 1.
The client config allows customizing the HUD element. The details are explained
in this wiki article.
The server config controls the integration with game mechanics, like stamina costs for various actions like jumping.
Casting a "LivingEntity" to the "StaminaUsingEntity" interface gives access to all relevant methods.