All Mods Resource Packs Data Packs Shaders Modpacks Plugins
Stamina Attributes

Stamina Attributes

by TheRedBrain • Downloads: 0 • Followers: 0
Description
Gallery
Changelog
Versions

Stamina Attributes

This API adds a stamina system controlled by entity attributes.

Default implementation

LivingEntities can have up to _staminaattributes:maxstamina amounts of stamina. Stamina is regenerated by _staminaattributes:staminaregeneration every _staminaattributes:stamina_tickthreshold ticks.

When stamina is reduced, regeneration is stopped for _staminaattributes:stamina_regeneration_delaythreshold ticks.

When stamina is <= 0, regeneration is stopped for _staminaattributes:depleted_stamina_regeneration_delaythreshold ticks.

_staminaattributes:reservedstamina describes the percentage amount of maximum stamina that is currently not available.

_staminaattributes:item_use_staminacost 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:

  1. Items in the "staminaattributes:using_costs_stamina" item tag reduce stamina by _staminaattributes:item_use_staminacost when they are used once. When stamina is < 0 the use action is not performed. In that case the item gets a cooldown, configured in the server config.
  2. Items in the "staminaattributes:continuous_using_costs_stamina" item tag reduce stamina by _staminaattributes:item_use_staminacost every tick while they are used. When stamina is < 0, the usage is cancelled. In that case the item gets a cooldown, configured in the server config.

The different _staminaattributes:*_tick_staminacost attributes describe the stamina cost for the corresponding activity. This cost is applied every tick (20x per second). This includes the following activities:

  • sprinting
  • sneaking
  • walking
  • swimming
  • walking underwater
  • walking in water
  • climbing

The different _staminaattributes:*_action_staminacost attributes describe the stamina cost for the corresponding actions. This cost is applied once every time the action is performed. This includes the following actions:

  • jumping
  • sprint jumping
  • attack blocking
  • attacking
  • block breaking

Several activities and actions can be configured to require stamina. If stamina is 0 or lower, they can't be performed. This includes:

  • jumping
  • sprinting
  • swimming
  • attacking
  • block breaking
  • attacking
  • attack blocking

Blocks that can be broken instantly by hand (blocks with a "destroyTime" of 0) can be excluded from the stamina requirement.

Exhaustion

If a player has 0 or less stamina, they are exhausted, which means that a status effect is applied. This status effect is defined in the server config.

This feature can be enabled in the server config, but it's disabled by default.

Default attribute values

  • _staminaattributes:maxstamina: 10 (10 for players)
  • _staminaattributes:staminaregeneration: 0 (1 for players)
  • _staminaattributes:stamina_tickthreshold: 20
  • _staminaattributes:stamina_regeneration_delaythreshold: 20
  • _staminaattributes:depleted_stamina_regeneration_delaythreshold: 60
  • _staminaattributes:reservedstamina: 0
  • _staminaattributes:item_use_staminacost: 0 (0.05 for players)
  • _staminaattributes:sprinting_tick_staminacost: 0 (0.05 for players)
  • _staminaattributes:sneaking_tick_staminacost: 0 (0.05 for players)
  • _staminaattributes:walking_tick_staminacost: 0
  • _staminaattributes:swimming_tick_staminacost: 0 (0.05 for players)
  • _staminaattributes:walking_underwater_tick_staminacost: 0 (0.05 for players)
  • _staminaattributes:walking_in_water_tick_staminacost: 0 (0.05 for players)
  • _staminaattributes:climbing_tick_staminacost: 0 (0.05 for players)
  • _staminaattributes:jumping_action_staminacost: 0 (1 for players)
  • _staminaattributes:sprint_jumping_action_staminacost: 0 (1 for players)
  • _staminaattributes:attack_blocking_action_staminacost: 0 (1 for players)
  • _staminaattributes:attacking_action_staminacost: 0 (1 for players)
  • _staminaattributes:block_breaking_action_staminacost: 0 (1 for players)

All default values for players can be set in the server config.

Default item tags

"staminaattributes:using_costs_stamina":

{
    "values": [
        "minecraft:snowball"
    ]
}

"staminaattributes:continuous_using_costs_stamina":

{
    "values": [
        "minecraft:bow",
        "minecraft:crossbow",
        "minecraft:shield"
    ]
}

Customization

The client config allows customizing the HUD element.

Using the stamina system

Java

Casting a "LivingEntity" to the "StaminaUsingEntity" interface gives access to all relevant methods.

Data packs

Stamina Attributes implements several data driven methods to interact with the current stamina value of an entity.

  • the "staminaattributes:add_stamina" enchantment effect allows adding a defined amount to the current stamina
  • the "staminaattributes:stamina_using_entity" entity sub predicate passes when the current stamina of an entity matches the defined range

Example

This enchantment reduces stamina of the attacker by 2, as long as the attacker has at least 5 stamina:

{
    "anvil_cost": 1,
    "description": {
        "translate": "enchantment.staminaattributes.test"
    },
    "effects": {
        "minecraft:post_attack": [
            {
                "affected": "attacker",
                "effect": {
                    "type": "staminaattributes:add_stamina",
                    "amount": {
                        "type": "minecraft:linear",
                        "base": -2.0,
                        "per_level_above_first": -2.0
                    }
                },
                "enchanted": "attacker",
                "requirements": {
                    "condition": "minecraft:entity_properties",
                    "entity": "direct_attacker",
                    "predicate": {
                        "type_specific": {
                            "type": "staminaattributes:stamina_using_entity",
                            "stamina_amount": {
                                "min": 5.0
                            }
                        }
                    }
                }
            }
        ]
    },
    "max_cost": {
        "base": 25,
        "per_level_above_first": 8
    },
    "max_level": 1,
    "min_cost": {
        "base": 5,
        "per_level_above_first": 8
    },
    "slots": [
        "hand"
    ],
    "supported_items": "#minecraft:swords",
    "weight": 5
}

All Versions

+ Add Version
Name Game version Platforms Published Downloads Actions
26.1.x
Fabric
6mo ago 1
26.1.x
Fabric
6mo ago 1
1.21.11
Fabric
7mo ago 1
1.21.11
Fabric
8mo ago 1
1.21.11
Fabric
9mo ago 1
1.21.10
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21.1
Fabric
last yr. 1
1.21
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.21
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
1.20.1
Fabric
last yr. 1
[4.0.1] 4.0.1 by TheRedBrain on Apr 16, 2026
Download
# 4.0.1

  • fixed log spam

[4.0.0] 4.0.0 by TheRedBrain on Apr 15, 2026
Download
# 4.0.0

  • updated to 26.1.x

## Additions

  • now shows an overlay message if the jumping action is prevented from insufficient stamina

## Fixes

  • fixed exhaust status effect not getting removed in rare cases

[3.3.0] 3.3.0 by TheRedBrain on Apr 12, 2026
Download
# 3.3.0

## Additions

  • added "jumping_in_water_requires_stamina" server config option, which controls whether the player can jump/ascend in water while stamina is below zero

## Changes

  • the "block_breaking_requires_stamina" feature now stops a block breaking process when the player runs out of stamina

## Fixes

  • fixed an issue where players could not attack when stamina was below zero, even if the "attacking_requires_stamina" server config option as set to false
  • fixed an issue where sprinting/swimming would not stop when stamina falls below zero, while stamina is required for the action
  • fixed an issue where swimming could not be started while sprinting is not possible due to low stamina
  • fixed an issue where respawning would no longer reset stamina after re-joining a world
  • fixed log spam

[3.2.0] 3.2.0 by TheRedBrain on Feb 17, 2026
Download
# 3.2.0

## Additions

  • added "staminaattributes:add_stamina" enchantment effect
  • added "staminaattributes:stamina_using_entity" entity sub predicate
  • the stamina icon bar now blinks when stamina changes, similar to the vanilla health bar. This can be disabled in the client config.
  • the stamina icon bar now displays reserved stamina

## Changes

  • changed default exhaustion effect to "minecraft:slowness"
  • slightly increased the default stamina regeneration delay for players

## Technical

  • replace synced data with a data attachment, following the best practice for custom entity data

[3.1.0] 3.1.0 by TheRedBrain on Jan 25, 2026
Download
# 3.1.0

  • updated to 1.21.11
  • migrated to Mojang Mappings

[3.0.0] 3.0.0 by TheRedBrain on Oct 25, 2025
Download
# 3.0.0

  • updated to 1.21.10

## Additions

  • added entity attributes, that define stamina costs for various in game actions:
  • "staminaattributes:attack_blocking_action_stamina_cost", applied when blocking an attack while using an item with the "blocks_attacks" component
  • "staminaattributes:attacking_action_stamina_cost", applied when attacking an entity
  • "staminaattributes:block_breaking_action_stamina_cost", applied when breaking a block
  • added several server config options for fine-tuning the new attributes

## Changes

  • removed "generic." prefix from all entity attributes, following vanillas example

[2.9.2] 2.9.2 by TheRedBrain on Oct 05, 2025
Download
# 2.9.2

  • fixed stamina bar being empty when joining a world for the first time
  • fixed sprint jumping stamina cost
  • bumped various dependency versions

[2.9.1] 2.9.1 by TheRedBrain on Sep 15, 2025
Download
# 2.9.1

  • tweaked default client config settings
  • fixed default player attribute values
  • fixed stamina bar being empty when joining a world / respawning

[2.9.0] 2.9.0 by TheRedBrain on Aug 27, 2025
Download
# 2.9.0

  • added an "exhaust" mechanic, when stamina is lower than 0, a configurable status effect is applied
  • reworked "swimming_requires_stamina" option

[2.8.0] 2.8.0 by TheRedBrain on Aug 26, 2025
Download
# 2.8.0

  • added "swimming_requires_stamina" server config option
  • added entity attributes for each activity that can cost stamina (previously defined in the server config)
  • added server config options to define the default for each attribute (only affects players)
  • changed default value of all entity attributes to 0.0

[2.7.0] 2.7.0 by TheRedBrain on Jul 30, 2025
Download
# 2.7.0

  • added alternative stamina bar consisting of icons, similar to vanillas resource bars (this first iteration does not yet support multiple icon types per bar, e.g. reserved stamina)
  • reworked the "naturalStaminaRegeneration" game rule (now works with mods that display attribute values)
  • fixed an issue where the stamina bar was empty when joining a world for the first time/respawning
  • fixed an issue where the stamina bar was visible in creative mode
  • fixed an issue where the stamina bar was visible even when the HUD was hidden (pressing F1)

[1.6.0] 1.6.0 by TheRedBrain on Dec 08, 2024
Download
# 1.6.0

HUD rendering overhaul
The initial idea of splitting a bar into three textures per "layer" to allow for easy change of the bar length, came with the cost of massive FPS drops.
With this rewrite the bar size is no longer changeable with a simple config option. Each 'layer' consists of only 1 texture (which can have configurable dimensions).
In addition, the texture can be dynamically replaced by another texture (with configurable dimensions) depending on the max value.
  • removed 'is_centered' option, as it was redundant and unnecessarily complicated
  • 'fill_direction' no longer chooses between a horizontal and a vertical 'texture set', it only determines the direction from which the bar is filled. This means that changing between horizontal and vertical resource bars also requires a texture change.
  • added the option to display an icon (with configurable texture id and dimensions). This can be toggled independently of the bar and the number.

[2.6.0] 2.6.0 by TheRedBrain on Dec 08, 2024
Download
# 2.6.0

HUD rendering overhaul
The initial idea of splitting a bar into three textures per "layer" to allow for easy change of the bar length, came with the cost of massive FPS drops.
With this rewrite the bar size is no longer changeable with a simple config option. Each 'layer' consists of only 1 texture (which can have configurable dimensions).
In addition, the texture can be dynamically replaced by another texture (with configurable dimensions) depending on the max value.
  • removed 'is_centered' option, as it was redundant and unnecessarily complicated
  • 'fill_direction' no longer chooses between a horizontal and a vertical 'texture set', it only determines the direction from which the bar is filled. This means that changing between horizontal and vertical resource bars also requires a texture change.
  • added the option to display an icon (with configurable texture id and dimensions). This can be toggled independently of the bar and the number.

[1.5.0] 1.5.0 by TheRedBrain on Dec 06, 2024
Download
# 1.5.0

  • changed "natural stamina regeneration" gamerule to simply add 1 stamina regeneration. The previous implementation prevented stamina regeneration from ever becoming negative.
  • fixed "offset_from_origin" config values not working correctly
  • stamina number display is now independent of the stamina bar

[2.5.0] 2.5.0 by TheRedBrain on Dec 06, 2024
Download
# 2.5.0

  • changed "natural stamina regeneration" gamerule to simply add 1 stamina regeneration. The previous implementation prevented stamina regeneration from ever becoming negative.
  • fixed "offset_from_origin" config values not working correctly
  • stamina number display is now independent of the stamina bar

[1.4.0] 1.4.0 by TheRedBrain on Dec 04, 2024
Download
# 1.4.0

  • added "generic.reserved_stamina" entity attribute
  • added "generic.item_use_stamina_cost" entity attribute
  • added "using_costs_stamina" item tag. Using items in this tag costs stamina (contains snowball by default)
  • added "continuous_using_costs_stamina" item tag. Continuously using items in this tag costs stamina (contains bow, crossbow and shield by default)
  • HUD element overhaul, improves mod compatibility, increases customization options
  • server config can now be edited in game (Thanks to Fzzy Config)
  • generally improved config layout
  • removed dependency on Cloth Config
  • added dependency on Fzzy Config
  • added dependency on Resource Bar API

[2.4.0] 2.4.0 by TheRedBrain on Dec 04, 2024
Download
# 2.4.0

  • added "generic.reserved_stamina" entity attribute
  • added "generic.item_use_stamina_cost" entity attribute
  • added "using_costs_stamina" item tag. Using items in this tag costs stamina (contains snowball by default)
  • added "continuous_using_costs_stamina" item tag. Continuously using items in this tag costs stamina (contains bow, crossbow and shield by default)
  • HUD element overhaul, improves mod compatibility, increases customization options
  • server config can now be edited in game (Thanks to Fzzy Config)
  • generally improved config layout
  • removed dependency on Cloth Config
  • added dependency on Fzzy Config
  • added dependency on Resource Bar API

[2.3.1] 2.3.1 by TheRedBrain on Sep 09, 2024
Download
# 2.3.1

  • fixed some internal issues

[2.3.0] 2.3.0 by TheRedBrain on Sep 08, 2024
Download
# 2.3.0

  • further improvements to stamina bar customization

[2.2.0] 2.2.0 by TheRedBrain on Sep 03, 2024
Download
# 2.2.0

  • update to 1.21.1
  • improved stamina bar customization

[2.1.0] 2.1.0 by TheRedBrain on Jul 26, 2024
Download
# 2.1.0

  • added optional smooth stamina bar animations
  • added a stamina regeneration delay after stamina is reduced, controlled by an entity attribute
  • added a missing translation key

[1.3.0] 1.3.0 by TheRedBrain on Jul 26, 2024
Download
# 1.3.0

  • added optional smooth stamina bar animations
  • added a stamina regeneration delay after stamina is reduced, controlled by an entity attribute
  • added a missing translation key

[2.0.0] 2.0.0 by TheRedBrain on Jun 14, 2024
Download
Update to 1.21
[1.2.1] 1.2.1 by TheRedBrain on May 24, 2024
Download
  • Fixed an issue with the attribute registration.
[1.2.0] 1.2.0 by TheRedBrain on May 19, 2024
Download
  • Changed the way the attributes are registered, which increased compatibility with other mods.
[1.1.0] 1.1.0 by TheRedBrain on May 12, 2024
Download
  • Added more options to configure the HUD element.
[1.0.1] 1.0.1 by TheRedBrain on May 12, 2024
Download
  • Fixed an issue where some config values where not applied correctly.
  • Fixed an issue where the default stamina regeneration was always 1, even when the
corresponding gamerule was set to false.
[1.0.0] 1.0.0 by TheRedBrain on May 04, 2024
Download
First release!
Stamina Attributes Icon
Download Stamina Attributes
Select game version
Select platform