Download Stamina Attributes — Minecraft Mods — MetaMods
Stamina Attributes

Stamina Attributes

Active

Downloads

11

Last update

1 month ago

Versions

1.20.1 — 1.21.1
Client and server
Fabric
Adventure
Game mechanics
Libraries

Stamina Attributes

This API mod introduces an endurance system into the game, controlled through entity attributes.

Basic Implementation

Living entities can have up to max_stamina endurance points. Recovery occurs at a rate of stamina_regeneration every stamina_tick_threshold ticks.

When endurance decreases, its recovery is paused for stamina_regeneration_delay_threshold ticks.

When the endurance reserve drops to zero or below, recovery is blocked for depleted_stamina_regeneration_delay_threshold ticks.

The reserved_stamina parameter determines the percentage of maximum endurance that is currently unavailable for use.

item_use_stamina_cost - the amount of endurance consumed when using items with corresponding costs.

There are two ways to assign endurance cost to items:

  1. Items from the "staminaattributes:using_costs_stamina" tag consume item_use_stamina_cost during single use. If endurance is insufficient, the action is not performed, and the item receives a cooldown configured in the server settings.

  2. Items from the "staminaattributes:continuous_using_costs_stamina" tag continuously spend item_use_stamina_cost every tick during use. When endurance is depleted, usage is interrupted, and the item also receives a cooldown.

Standard Attribute Values

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

Standard Item Tags

"staminaattributes:using_costs_stamina":

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

"staminaattributes:continuous_using_costs_stamina":

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

Configuration

With the "naturalStaminaRegeneration" game rule enabled, players automatically receive endurance recovery of at least 1.

Client configuration allows customization of the endurance interface element.

Server configuration manages integration with game mechanics, including endurance costs for various actions like jumping.

API

Casting "LivingEntity" to the "StaminaUsingEntity" interface provides access to all corresponding endurance management methods.

Project members
TheRedBrain

TheRedBrain

Developer

Created: 6 May 2024

ID: 9363