Mana Attributes

模组

· 作者 TheRedBrain

一个小型 API,通过实体属性添加受控的法力系统。

0 本站下载 0 关注 更新于 7 个月前

需要前置:Resource Bar API、Fabric API、Fzzy Config

最新 4.0.0 · 26.1.2 · Fabric

一键开服(送7天)

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
}

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源