Перейти к содержимому
Mineforgian

Stamina Attributes

A small API that adds a stamina system controlled by entity attributes.

35K загрузок26 подписчиковMITfabric

Обновлён 16 апреля 2026 г. · опубликован 2 мая 2024 г.

  • Default Stamina Bar
  • Alternative Stamina Bar

Stamina Attributes

This API adds a stamina system controlled by entity attributes.

Default implementation

LivingEntities can have up to staminaattributes:max_stamina amounts of stamina. Stamina is regenerated by staminaattributes:stamina_regeneration every staminaattributes:stamina_tick_threshold ticks.

When stamina is reduced, regeneration is stopped for staminaattributes:stamina_regeneration_delay_threshold ticks.

When stamina is <= 0, regeneration is stopped for staminaattributes:depleted_stamina_regeneration_delay_threshold ticks.

staminaattributes:reserved_stamina describes the percentage amount of maximum stamina that is currently not available.

staminaattributes: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:

  1. Items in the "staminaattributes:using_costs_stamina" item tag reduce stamina by staminaattributes:item_use_stamina_cost 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_stamina_cost 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_stamina_cost 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_stamina_cost 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:max_stamina: 10 (10 for players)
  • staminaattributes:stamina_regeneration: 0 (1 for players)
  • staminaattributes:stamina_tick_threshold: 20
  • staminaattributes:stamina_regeneration_delay_threshold: 20
  • staminaattributes:depleted_stamina_regeneration_delay_threshold: 60
  • staminaattributes:reserved_stamina: 0
  • staminaattributes:item_use_stamina_cost: 0 (0.05 for players)
  • staminaattributes:sprinting_tick_stamina_cost: 0 (0.05 for players)
  • staminaattributes:sneaking_tick_stamina_cost: 0 (0.05 for players)
  • staminaattributes:walking_tick_stamina_cost: 0
  • staminaattributes:swimming_tick_stamina_cost: 0 (0.05 for players)
  • staminaattributes:walking_underwater_tick_stamina_cost: 0 (0.05 for players)
  • staminaattributes:walking_in_water_tick_stamina_cost: 0 (0.05 for players)
  • staminaattributes:climbing_tick_stamina_cost: 0 (0.05 for players)
  • staminaattributes:jumping_action_stamina_cost: 0 (1 for players)
  • staminaattributes:sprint_jumping_action_stamina_cost: 0 (1 for players)
  • staminaattributes:attack_blocking_action_stamina_cost: 0 (1 for players)
  • staminaattributes:attacking_action_stamina_cost: 0 (1 for players)
  • staminaattributes:block_breaking_action_stamina_cost: 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
}

Версии

ВерсияКаналИграЗагрузчикиДатаСкачать
4.0.1Релиз26.1, 26.1.1, 26.1.2fabric16 апреля 2026 г..jar (129 КБ)
4.0.0Релиз26.1, 26.1.1, 26.1.2fabric15 апреля 2026 г..jar (129 КБ)
3.3.0Релиз1.21.11fabric12 апреля 2026 г..jar (129 КБ)
3.2.0Релиз1.21.11fabric17 февраля 2026 г..jar (127 КБ)
3.1.0Релиз1.21.11fabric25 января 2026 г..jar (109 КБ)
3.0.0Релиз1.21.10fabric25 октября 2025 г..jar (111 КБ)
2.9.2Релиз1.21.1fabric5 октября 2025 г..jar (106 КБ)
2.9.1Релиз1.21.1fabric15 сентября 2025 г..jar (106 КБ)
2.9.0Релиз1.21.1fabric27 августа 2025 г..jar (104 КБ)
2.8.0Релиз1.21.1fabric26 августа 2025 г..jar (104 КБ)
2.7.0Релиз1.21.1fabric30 июля 2025 г..jar (102 КБ)
1.6.0Релиз1.20.1fabric8 декабря 2024 г..jar (94 КБ)
2.6.0Релиз1.21.1fabric8 декабря 2024 г..jar (96 КБ)
1.5.0Релиз1.20.1fabric6 декабря 2024 г..jar (94 КБ)
2.5.0Релиз1.21.1fabric6 декабря 2024 г..jar (96 КБ)

Показаны последние 15 из 28 версий. Все версии — на Modrinth.

Ченджлог

4.0.1Релиз26.1, 26.1.1, 26.1.2 · 16 апреля 2026 г.

4.0.1

  • fixed log spam
4.0.0Релиз26.1, 26.1.1, 26.1.2 · 15 апреля 2026 г.

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Релиз1.21.11 · 12 апреля 2026 г.

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Релиз1.21.11 · 17 февраля 2026 г.

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Релиз1.21.11 · 25 января 2026 г.

3.1.0

  • updated to 1.21.11
  • migrated to Mojang Mappings
3.0.0Релиз1.21.10 · 25 октября 2025 г.

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Релиз1.21.1 · 5 октября 2025 г.

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Релиз1.21.1 · 15 сентября 2025 г.

2.9.1

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

Полная история изменений — на Modrinth.

Комментарии

Загружаем…