作者:rebot | 分类:模组
Minecraft 版本: 26.1 26.1.1 26.1.2
平台: fabric
标签: adventure game-mechanics library
This API adds a stamina system controlled by entity attributes.
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:
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:
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:
Several activities and actions can be configured to require stamina. If stamina is 0 or lower, they can't be performed.
This includes:
Blocks that can be broken instantly by hand (blocks with a "destroyTime" of 0) can be excluded from the stamina
requirement.
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.
All default values for players can be set in the server config.
"staminaattributes:using_costs_stamina":
{
"values": [
"minecraft:snowball"
]
}
"staminaattributes:continuous_using_costs_stamina":
{
"values": [
"minecraft:bow",
"minecraft:crossbow",
"minecraft:shield"
]
}
The client config allows customizing the HUD element.
Casting a "LivingEntity" to the "StaminaUsingEntity" interface gives access to all relevant methods.
Stamina Attributes implements several data driven methods to interact with the current stamina value of an entity.
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
}请登录后举报
暂无评论,抢个沙发吧~