OneEnoughDamage
你是否遇到过无法修改的硬编码伤害值?
你是否曾因为缺乏实用的切入点,而在平衡投射物、尖牙、魔法、召唤物或范围攻击的伤害时感到困扰?
你知道吗,利维坦(Leviathan)有 11 种不同的伤害值,而伊格尼斯(Ignis)则有 17 种?
你的整合包中是否包含数百个需要平衡伤害的生物?
使用 OED,调整伤害变得简单。在启动时,该模组会扫描所有模组的硬编码伤害,并为相关生物自动注册匹配的属性条目。 你还可以直接在配置文件中编辑默认值,包括原版的伤害属性,这对于需要平衡各种伤害的整合包作者来说,支持一秒重载。
自动属性注册
默认情况下,此模组会在启动时扫描 Minecraft 本体及所有已安装模组中的硬编码伤害,然后将任何可以分配给特定生物的伤害注册为属性。
所有权通过静态分析进行追踪。例如,由唤魔者(evoker)召唤的尖牙会被分配给该唤魔者,大多数召唤伤害、增益伤害以及类似情况也可以正确分配给每个可能的来源生物。
示例属性 ID:oneenoughdamage:fuzs/illagerinvasion/world/entity/monster/invoker_fangs/damage/2/r
命名规则是精确的伤害点路径、顺序和计算模式。r 表示固定伤害,而 m 表示乘数伤害。乘数属性仅用于动态情况,例如随难度变化的伤害,并默认为 1.0。
你拥有的模组越多,扫描时间就越长。拥有约 200 个模组的整合包预计需要大约十秒进行扫描。首次启动后,你可以在配置中启用 readCache,以便后续启动直接读取缓存并跳过扫描阶段。
快速伤害调整
安装此模组后,你有两种方式调整生物伤害:直接在配置文件中编辑默认伤害值,或通过 KubeJS 等工具动态修改属性。
以下文件生成于 config/OED/ 目录下:
damage_points-cache.json:扫描缓存,旨在供机器读取。它可能很大,通常可以忽略。damage-point-dictionary.md:属性化伤害点字典,内置中英文名称,并按生物分组伤害以便查找。damage-point-dictionary.toml:可编辑的配置文件,采用字典式布局。它还包含原版minecraft:generic.attack_damage。damage-point-unattributed.md:当前无法安全分配给生物的伤害点。oneenoughdamage.toml:模组行为配置。
更改 damage-point-dictionary.toml 中的属性值会直接改变注册该属性时使用的默认值,但必须重启游戏才能生效。这非常适合不需要动态伤害变化的简单平衡调整。
如果你仍在测试中,可以在配置中启用 debugMode。此时文件中的默认值更改将被监听并立即注入游戏中。
可编辑的条目包括原版 minecraft:generic.attack_damage,因此即使硬编码伤害不是你的主要关注点,你仍然可以快速调整和测试许多生物的伤害。
damage-point-dictionary.toml 是增量更新的。当你添加或删除模组时,现有配置会被备份,并在保留你对属性值更改的同时添加或删除条目。
动态伤害调整
如果需要动态调整伤害,建议使用 KubeJS 调用与属性相关的方法,或使用命令。
推荐教程:
以下示例将 Cataclysm 的水晶蟹在受伤后缩回地下再跳出来时造成的范围伤害翻倍。安装 ProbeJS 后,输入 @attribute 即可触发属性名称的自动补全。
// server_scripts
EntityEvents.hurt(event => {
if (event.getEntity().is("cataclysm:amethyst_crab")) {
/** @type {Internal.LivingEntity} */
let entity = event.getEntity();
let attr = `oneenoughdamage:com/github/l_ender/cataclysm/entity/animation_monster/boss_monsters/amethyst_crab_entity/area_attack/1/m`;
entity.modifyAttribute(attr, "oneenoughdamage:example", 1, 'addition');
}
});
覆盖范围
大多数由原始数字或简单变量组合定义的伤害都可以被扫描。由于一些模组作者有自己的实现方式,无法达到 100% 的覆盖率。
到目前为止,Minecraft 原版、Cataclysm 和 Illager Invasion 已经过测试,覆盖率非常高。后两个模组几乎完全是硬编码伤害。
Cataclysm 拥有自己的动态伤害系统,因此许多注册的属性使用乘数形式,默认值为 1.0。这部分不能保证被完美检测,需要持续完善。
对于 Cataclysm,此模组的主要用例是平衡同一生物上的不同伤害值。例如,利维坦有 11 种不同的伤害值,伊格尼斯有 17 种,而原版仅提供单一的 minecraft:generic.attack_damage,远远不足。
实际上,仍有一些硬编码情况是本模组目前无法解决的。例如,一个生物可能会召唤一个没有 owner 字段的投射物实体,该投射物可能会以 null DamageSource 对玩家造成伤害。
通过一些技巧,可以追踪是什么类型的生物造成了这种伤害。不幸的是,当同时存在多个相同类型的生物时,追踪确切的受害生物非常困难。
为此,有一个表现良好的邻近搜索回退机制:
inferAttributeHolder:当伤害没有直接的LivingEntity攻击者时,尝试推断附近的所属实体。inferAttributeHolderSearchRadius:归属推断的搜索半径,以方块为单位测量。
如果您遇到其他覆盖范围问题,欢迎提供反馈。
路线图
- 继续改进覆盖范围
- 添加属性默认值的游戏内可视化编辑功能
- 移植到其他版本
OneEnoughDamage
Have you ever run into hardcoded damage values that cannot be modified?
Have you ever struggled to balance damage from projectiles, fangs, magic, summons, or area attacks because there was no practical entry point?
Did you know that the Leviathan has 11 different damage values, while the Ignis has 17?
Does your modpack contain hundreds of mobs whose damage needs balancing?
With OED, adjusting damage becomes simple. Hardcoded damage from every mod is scanned at startup, and matching Attribute entries are automatically registered for the relevant mobs. You can also edit default values directly in the config files, including vanilla damage attributes, with one-second reloads for modpack authors who need to balance every kind of damage.
Automatic Attribute Registration
By default, this mod scans hardcoded damage in Minecraft itself and all installed mods during startup, then registers any damage that can be assigned to a specific mob as an Attribute.
Ownership is traced through static analysis. For example, evoker fangs summoned by an evoker are assigned to the evoker, and most summon damage, buff damage, and similar cases can also be correctly assigned to every possible source mob.
Example attribute ID: oneenoughdamage:fuzs/illagerinvasion/world/entity/monster/invoker_fangs/damage/2/r
The naming rule is the exact damage-point path, order, and calculation mode. r means fixed damage, while m means multiplier damage. Multiplier attributes are only used for dynamic cases such as damage that changes with difficulty, and default to 1.0.
The more mods you have, the longer scanning takes. A modpack with around 200 mods is expected to take about ten seconds to scan. After the first startup, you can enable readCache in the config so later launches read the cache directly and skip the scan stage.
Quick Damage Tuning
After installing this mod, you have two ways to tune mob damage: edit the default damage values directly in the config files, or dynamically modify Attributes through tools such as KubeJS.
The following files are generated under config/OED/:
damage_points-cache.json: Scan cache, intended for machine reading. It can be large and is usually safe to ignore.damage-point-dictionary.md: Dictionary of attributed damage points, with built-in Chinese-English names and damage grouped by mob for easier lookup.damage-point-dictionary.toml: Editable config file with a dictionary-like layout. It also includes vanillaminecraft:generic.attack_damage.damage-point-unattributed.md: Damage points that cannot currently be safely assigned to a mob.oneenoughdamage.toml: Mod behavior config.
Changing an attribute value in damage-point-dictionary.toml directly changes the default value used when the attribute is registered, but the game must be restarted for it to take effect. This is well suited for simple balancing that does not require dynamic damage changes.
If you are still testing, you can enable debugMode in the config. Default value changes in the file will then be watched and injected into the game immediately.
The editable entries include vanilla minecraft:generic.attack_damage, so even if hardcoded damage is not your main concern, you can still quickly tune and test damage for many mobs.
damage-point-dictionary.toml is updated incrementally. When you add or remove mods, the existing config is backed up, and entries are added or removed while preserving your attribute value changes.
Dynamic Damage Tuning
If you need to tune damage dynamically, it is recommended to use KubeJS to call Attribute-related methods, or to use commands.
Recommended tutorials:
The following example doubles the area damage dealt by Cataclysm's Amethyst Crab when it retracts underground and jumps back out after taking damage. After installing ProbeJS, typing @attribute can trigger autocomplete for attribute names.
// server_scripts
EntityEvents.hurt(event => {
if (event.getEntity().is("cataclysm:amethyst_crab")) {
/** @type {Internal.LivingEntity} */
let entity = event.getEntity();
let attr = `oneenoughdamage:com/github/l_ender/cataclysm/entity/animation_monster/boss_monsters/amethyst_crab_entity/area_attack/1/m`;
entity.modifyAttribute(attr, "oneenoughdamage:example", 1, 'addition');
}
});
Coverage
Most damage defined by raw numbers or simple variable combinations can be scanned. Since some mod authors have their own implementation approaches, 100% coverage is not possible.
So far, vanilla Minecraft, Cataclysm, and Illager Invasion have been tested with very high coverage. The latter two mods are almost entirely hardcoded damage.
Cataclysm has its own dynamic damage system, so many registered attributes use multiplier form with a default value of 1.0. This part cannot be guaranteed to be perfectly detected and will need continued refinement.
For Cataclysm, the main use case of this mod is balancing different damage values on the same mob. For example, the Leviathan has 11 different damage values and the Ignis has 17, while vanilla only provides the single minecraft:generic.attack_damage, which is nowhere near enough.
In practice, there are still some hardcoded cases that this mod cannot solve yet. For example, a mob may summon a projectile entity with no owner field, and that projectile may deal damage to the player with a null DamageSource.
With some trickery, it is possible to trace what type of mob caused that damage. Unfortunately, when multiple mobs of the same type are present at the same time, tracing the exact target mob is very difficult.
For this, there is a nearby-search fallback that works well enough:
inferAttributeHolder: When damage has no directLivingEntityattacker, try to infer the owning entity nearby.inferAttributeHolderSearchRadius: Search radius for ownership inference, measured in blocks.
Feedback is welcome if you run into other coverage issues.
Roadmap
- Continue improving coverage
- Add in-game visual editing for attribute default values
- Port to other versions
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
下载 One Enough Damage
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
详见项目更新日志。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧