Mana Attributes
此 API 添加了一个由实体属性控制的法力系统。
默认实现
生物实体最多可以拥有 manaattributes:max_mana 点法力。法力每 manaattributes:mana_tick_threshold 刻通过 manaattributes:mana_regeneration 进行恢复。
当法力减少时,恢复将在 manaattributes:mana_regeneration_delay_threshold 刻内停止。
当法力 <= 0 时,恢复将在 manaattributes:depleted_mana_regeneration_delay_threshold 刻内停止。
manaattributes:reserved_mana 描述了当前不可用的最大法力的百分比数量。
默认属性值
- manaattributes:max_mana: 0
- manaattributes:mana_regeneration: 0
- manaattributes:mana_tick_threshold: 20
- manaattributes:mana_regeneration_delay_threshold: 20
- manaattributes:depleted_mana_regeneration_delay_threshold: 60
- manaattributes:reserved_mana: 0
玩家的所有默认值都可以在服务器配置中设置。
自定义
客户端配置允许自定义 HUD 元素。
使用法力系统
Java
将“LivingEntity”转换为“ManaUsingEntity”接口即可访问所有相关方法。
数据包
Mana Attributes 实现了多个数据驱动的方法,用于与实体的当前法力值进行交互。
- “manaattributes:add_mana”附魔效果允许向当前法力增加指定数量的法力
- “manaattributes:mana_using_entity”实体子谓词在实体的当前法力符合定义的范围时通过
示例
此附魔会使攻击者的法力减少 2,前提是攻击者至少有 5 点法力:
{
"anvil_cost": 1,
"description": {
"translate": "enchantment.manaattributes.test"
},
"effects": {
"minecraft:post_attack": [
{
"affected": "attacker",
"effect": {
"type": "manaattributes:add_mana",
"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": "manaattributes:mana_using_entity",
"mana_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
}
你是这个资源的作者?登录后可认领此资源。
相似资源
一个用于收集生物掉落物的多区块模组。
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
查看物品与配方
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
适用于 MC 1.18+ 的 Effekseer 加载器
评论 0
登录后参与评分
还没有评论,来抢沙发吧