MonitoringMinecraft MonitoringMinecraft
S

salinity library

Мод NeoForge

Библиотека-мод для Майнкрафт — добавляет ряд атрибутов

59 скачиваний 0 подписчиков
Оцените первым

Salinity — Common Library Mod

Salinity is my personal utility library mod, providing shared attribute systems and helper tools across my mods to avoid redundant code.

Current Feature Status

The following features are available in all versions (below 26.1):

  • mitigation — damage reduction
  • arrow_damage — arrow damage bonus
  • arrow_speed — arrow speed multiplier
  • attack_range — melee attack range

The following spell-related features are only available in 26.1 and above (not present in versions below 26.1):

1. Spell Attributes
1.1 Spell Damage & Spell Power
Attribute ID Display Name Default Description
salinity:spell_damage Spell Damage 0.0 Direct bonus to spell damage (modifiable)
salinity:spell_power Spell Power 0.0 Secondary multiplier to all spells (modifiable)
1.2 Spell Resistance
Attribute ID Display Name Default Description
salinity:spell_resistance Spell Resistance 0.0 Reduces incoming spell damage; higher = more reduction

All attributes support vanilla modifiers (ADD_VALUE, ADD_MULTIPLIED_BASE, ADD_MULTIPLIED_TOTAL) for flexible configuration.

2. Damage Calculation Flow
2.1 Overall Flow
Base Damage → [Spell Damage Bonus] → [Spell Power Bonus] → [Spell Resistance Reduction] → Final Damage
2.2 Spell Damage Bonus

Apply the caster's spell_damage attribute to the base damage, processing all modifiers in order:

  1. Sum all ADD_VALUE modifiers → add
  2. Sum all ADD_MULTIPLIED_BASE modifiers → mult_base
  3. Sum all ADD_MULTIPLIED_TOTAL modifiers → mult_total

Formula:

after_spell_damage = (base_damage + add) × (1 + mult_base) × (1 + mult_total)
2.3 Spell Power Bonus

Apply the caster's spell_power attribute to the result above, using the same modifier order:

after_spell_power = (after_spell_damage + add_power) × (1 + mult_base_power) × (1 + mult_total_power)
2.4 Spell Resistance Reduction

Apply the target's spell resistance, also considering the target's vanilla armor toughness (minecraft:armor_toughness):

final_damage = after_spell_power × 200 / ( resistance × (1 + toughness/10) × √(after_spell_power) + 200 )

Where:

  • resistance: target's salinity:spell_resistance value
  • toughness: target's minecraft:armor_toughness value (0 if absent)
  • √(after_spell_power): square root of the damage after spell power bonus

Note: If resistance is 0, the reduction step is skipped and final_damage = after_spell_power.

3. Spell Resistance Reduction Example Tables

The tables below assume the caster's spell_damage and spell_power are both 0 (i.e., no bonus, after_spell_power = base damage), showing only the effect of resistance and toughness.

3.1 Toughness = 0
Base Damage Res=5 Res=10 Res=20
10 9.27 8.63 7.60
20 17.99 16.35 13.82
40 34.54 30.39 24.50
3.2 Toughness = 3
Base Damage Res=5 Res=10 Res=20
10 9.07 8.30 7.09
20 17.46 15.50 12.65
40 33.18 28.35 21.95
3.3 Toughness = 6
Base Damage Res=5 Res=10 Res=20
10 8.88 7.98 6.64
20 16.97 14.73 11.66
40 31.93 26.56 19.88
3.4 Toughness = 12
Base Damage Res=5 Res=10 Res=20
10 8.52 7.42 5.90
20 16.05 13.41 10.08
40 29.68 23.59 16.73

All values are rounded to two decimals; actual in-game values are floating point.

4. Damage Type
  • Damage Type ID: salinity:spell
  • Characteristics:
    • Ignores armor
    • Not affected by vanilla Protection enchantments
    • Does not trigger vanilla magic damage related effects (e.g., potion protection)
5 Adding Spell Attributes to Items (API Example)
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;

ItemStack staff = new ItemStack(ModItems.DOOM_STAFF.get());

// Add +5 spell damage (ADD_VALUE)
SalinityAPI.addModifier(staff, ModAttributes.SPELL_DAMAGE, "staff_damage", 5.0, AttributeModifier.Operation.ADD_VALUE);

// Add +20% spell power (ADD_MULTIPLIED_BASE)
SalinityAPI.addModifier(staff, ModAttributes.SPELL_POWER, "staff_power", 0.2, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
6. Notes (Spell Features Only)
  1. The square root in the resistance formula ensures weaker reduction for low damage and significant reduction for high damage.
  2. If the target's spell resistance is 0, the reduction step is skipped entirely.
  3. The caster's spell_damage and spell_power can be dynamically modified via equipment, potion effects, etc.
Usage
  • For Trial Catacombs: Salinity is a required dependency. If using a version below 26.1, spell-related attributes will have no effect.
  • For other developers: Feel free to use Salinity as a dependency. Call the registered attributes as needed. To use the spell system, ensure version ≥ 26.1.
Technical Info

中文介绍

Salinity — 通用模组库

Salinity 是我为个人模组开发的通用库模组,提供跨模组常用的属性系统和工具类,避免重复造轮子。

当前功能状态

以下功能在所有版本中可用(26.1 以下版本):

  • mitigation — 减伤
  • arrow_damage — 箭矢伤害加成
  • arrow_speed — 箭矢速度倍率
  • attack_range — 近战攻击距离

以下法术相关功能仅 26.1 及以上版本提供(26.1 以下版本不包含):

1. 法术属性
1.1 法术伤害与法术强度
属性ID 显示名称 默认值 说明
salinity:spell_damage 法术伤害 0.0 直接对法术伤害加成(可受修饰符影响)
salinity:spell_power 法术强度 0.0 对所有法术进行二次加成(可受修饰符影响)
1.2 法术抗性
属性ID 显示名称 默认值 说明
salinity:spell_resistance 法术抗性 0.0 减免所受法术伤害,值越高减伤越强

所有属性均支持原版修饰符(ADD_VALUE, ADD_MULTIPLIED_BASE, ADD_MULTIPLIED_TOTAL),可灵活配置。

2. 伤害计算流程
2.1 总流程
原始伤害 → [法术伤害加成] → [法术强度加成] → [法术抗性减伤] → 最终伤害
2.2 法术伤害加成

对原始伤害应用施法者的 spell_damage 属性,按以下顺序处理所有修饰符:

  1. 累加所有 ADD_VALUE 修饰符 → add
  2. 累加所有 ADD_MULTIPLIED_BASE 修饰符 → mult_base
  3. 累加所有 ADD_MULTIPLIED_TOTAL 修饰符 → mult_total

计算公式:

after_spell_damage = (原始伤害 + add) × (1 + mult_base) × (1 + mult_total)
2.3 法术强度加成

对上述结果应用施法者的 spell_power 属性,同样按上述顺序处理所有修饰符:

after_spell_power = (after_spell_damage + add_power) × (1 + mult_base_power) × (1 + mult_total_power)
2.4 法术抗性减伤

对加成后的伤害应用目标的法术抗性,同时考虑目标的原版盔甲韧性(minecraft:armor_toughness),公式如下:

最终伤害 = after_spell_power × 200 / ( 法抗 × (1 + 韧性/10) × √(after_spell_power) + 200 )

其中:

  • 法抗:目标的 salinity:spell_resistance 属性值
  • 韧性:目标的 minecraft:armor_toughness 属性值(若无则为 0)
  • √(after_spell_power):加成后伤害的平方根

注意:当法抗为 0 时,跳过减伤步骤,最终伤害 = after_spell_power。

3. 法术抗性减伤效果表(示例)

以下表格假设施法者的 spell_damagespell_power 均为默认值 0(即无加成,after_spell_power = 原始伤害),仅展示抗性和韧性对伤害的影响。

3.1 无韧性(韧性 = 0)
原始伤害 法抗=5 法抗=10 法抗=20
10 9.27 8.63 7.60
20 17.99 16.35 13.82
40 34.54 30.39 24.50
3.2 韧性 = 3
原始伤害 法抗=5 法抗=10 法抗=20
10 9.07 8.30 7.09
20 17.46 15.50 12.65
40 33.18 28.35 21.95
3.3 韧性 = 6
原始伤害 法抗=5 法抗=10 法抗=20
10 8.88 7.98 6.64
20 16.97 14.73 11.66
40 31.93 26.56 19.88
3.4 韧性 = 12
原始伤害 法抗=5 法抗=10 法抗=20
10 8.52 7.42 5.90
20 16.05 13.41 10.08
40 29.68 23.59 16.73

表格中所有数值保留两位小数,实际游戏内为浮点数。

4. 伤害类型
  • 伤害类型 ID: salinity:spell
  • 特性:
    • 无视护甲
    • 不受原版保护附魔影响
    • 不触发原版魔法伤害相关效果(如药水保护)
5. 为物品添加法术属性(API 示例)
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;

ItemStack staff = new ItemStack(ModItems.DOOM_STAFF.get());

// 添加 +5 法术伤害(基础值)
SalinityAPI.addModifier(staff, ModAttributes.SPELL_DAMAGE, "staff_damage", 5.0, AttributeModifier.Operation.ADD_VALUE);

// 添加 +20% 法术强度(乘法)
SalinityAPI.addModifier(staff, ModAttributes.SPELL_POWER, "staff_power", 0.2, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
6.法术功能注意事项
  1. 法术抗性减伤公式中的平方根确保低伤害时减伤较弱,高伤害时减伤显著。
  2. 若目标法术抗性为 0,则不进行减伤计算,直接应用加成后伤害。
  3. 施法者的 spell_damagespell_power 属性可以通过装备、药水效果等动态修改。
使用说明
  • 对 Trial Catacombs:Salinity 为必需前置库。如果使用 v26.1 以下版本,法术相关属性将无效。
  • 对其他开发者:可将 Salinity 作为依赖,按需调用已注册的属性。如需使用法术系统,请确保版本 ≥ 26.1。
开发信息
Смотри также

Похожие подборки моды — по версиям Майнкрафта, загрузчикам и жанрам.

Сервера Майнкрафт

Играть интереснее на сервере — выбирай в рейтинге серверов Майнкрафт и заходи прямо сейчас.

SkyBars
SkyBars Java + BE
1305 онлайн
1.8 — 26.2 версия
🎮 ВЫЖИВАНИЕ ⚔️ АНАРХИЯ 🚗 ГТА РП 🎤 ГОЛОСОВОЙ ЧАТ 🎁 БЕСПЛАТНЫЙ ДОНАТ 🌟 СМП 💻 ПК+ТЕЛЕФОН
MigosMc
MigosMc Java + BE
1132 онлайн
1.8 — 26.2 версия
🌿 MigosMc.net | Гриферский сервер с войс-чатом | Награды за онлайн ⭐ ВЫЖИВАНИЕ⭐ ОДИНБЛОК⭐ МИНИ-ИГРЫ
SeasonEra
5 онлайн
26.1.2 версия
Выживание • Экономика • Кланы • Приваты • Донат • PVP • Работа
PLIRGAME - ДЕВУШКИ ВОЙС ЧАТ
31 онлайн
1.21.10 — 26.1.1 версия
❤️ Выживание! ❤️ Войс Чат ❤️ Девушки ❤️ /free
MineLauncher
Лаунчер Майнкрафт без лицензии — все версии
Бесплатный лаунчер для ПК и Андроид — все версии 26.2, 1.21.11, 26.1.2, 1.21.8. Fabric, NeoForge, Forge, шейдеры, моды и скины в один клик.
Без лицензии Fabric, NeoForge, Forge Моды, шейдеры, скины Все версии Майнкрафта ПК и Андроид Для слабых ПК Сервера в лаунчере
Скачать бесплатно
Windows и Андроид · Бесплатно · Без лицензии
Наш чат