Mods Resource Packs Data Packs Plugins Shaders Modpacks
Get Modrinth App
Upgrade to Modrinth+
Sign in
ModsPluginsData PacksShadersResource PacksModpacks
Sign in
Settings
Stamina Attributes

Stamina Attributes

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

14.4k
16
Adventure
Game Mechanics
Library
AboutGalleryChangelogVersions

Stamina Attributes

This API adds a stamina system controlled by entity attributes.

Default implementation

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:

  1. Items in the "staminaattributes:using_costs_stamina" item tag reduce stamina by generic.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 generic.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.

Default attribute values

  • generic.max_stamina: 10
  • generic.stamina_regeneration: 0
  • generic.stamina_tick_threshold: 20
  • generic.stamina_regeneration_delay_threshold: 20
  • generic.depleted_stamina_regeneration_delay_threshold: 60
  • generic.reserved_stamina: 0
  • generic.item_use_stamina_cost: 0

Default item tags

"staminaattributes:using_costs_stamina":

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

"staminaattributes:continuous_using_costs_stamina":

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

Customization

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.

API

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

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Compatibility

Minecraft: Java Edition

1.21.x
1.20.1

Platforms

Fabric

Supported environments

Server only
Singleplayer

Links

Report issues View source Join Discord server

Creators

TheRedBrain
TheRedBrain Member

Details

Licensed MIT
Published last year
Updated 6 months ago

Modrinth is open source.

new-project-page@ac78952

© Rinth, Inc.

Company

TermsPrivacyRulesCareers

Resources

SupportBlogDocsStatus

Interact

Discord X (Twitter) Mastodon Crowdin
Get Modrinth App Settings
NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.