Description
Attributes For Iron's Spells
Attributes For Iron's Spells (ais) is a NeoForge 1.21.1 mod that creates Minecraft attributes for every spell and school registered with Iron's Spells and Spellbooks, including entries supplied by addon mods.
Requirements
- Minecraft 1.21.1
- NeoForge 21.1.226 or newer
- Iron's Spells and Spellbooks 1.21.1-3.15.6 or newer
- Iron's Spells' normal dependencies: Iron's Lib, GeckoLib, Player Animator, and Curios
Attributes
Global attributes:
| Attribute | Default | Effect |
|---|---|---|
ais:all |
0 |
Innate level for every spell |
ais:all_cooldown |
1.0 |
Cooldown multiplier for every spell |
ais:all_cast_time |
1.0 |
Cast-time multiplier for every spell |
ais:all_cost |
1.0 |
Mana-cost multiplier for every spell |
ais:keep_scroll |
0.0 |
Chance that a successfully used scroll is not consumed |
For every registered spell <namespace>:<path>:
ais:spell/<namespace>/<path>ais:spell_cooldown/<namespace>/<path>ais:spell_cast_time/<namespace>/<path>ais:spell_cost/<namespace>/<path>
For every registered school <namespace>:<path>:
ais:school/<namespace>/<path>ais:school_cooldown/<namespace>/<path>ais:school_cast_time/<namespace>/<path>ais:school_cost/<namespace>/<path>
Examples:
attribute @s ais:school/irons_spellbooks/fire base set 3
attribute @s ais:spell/irons_spellbooks/cloud_of_regeneration base set 5
attribute @s ais:spell_cooldown/irons_spellbooks/fireball base set 0.5
All attributes support vanilla operations such as add_value, add_multiplied_base, and add_multiplied_total.
Resolution rules
The effective spell level is:
max(spellbook level, ais:all, school level, spell level)
Fractional levels are floored and the result is clamped to the spell's declared level range.
Cooldown, cast time, and mana cost use:
global factor × school factor × spell factor
For example, a global factor of 0.5 and a spell factor of 0.5 produce a final factor of 0.25. These factors affect spellbook and innate casting. Negative values clamp to zero; non-finite values safely fall back to neutral behavior.
Reset command
Operators with permission level 2 can reset stored base values without removing modifiers supplied by equipment, effects, or other mods:
/ais reset <targets> all
/ais reset <targets> spell [spell_id]
/ais reset <targets> school [school_id]
/ais reset <targets> cooldown [spell_or_school_id]
/ais reset <targets> cast_time [spell_or_school_id]
/ais reset <targets> cost [spell_or_school_id]
/ais reset <targets> keep_scroll
Spell and school IDs support Brigadier autocomplete. Omitting the ID resets the whole selected category.
Spell-specific damage tags
Damage predicates can identify the exact spell that produced an Iron's Spells
SpellDamageSource. Every spell automatically exposes a virtual damage-type tag using:
<spell_namespace>:spell/<spell_path>
For example, a minecraft:player_hurt_entity advancement can match only Sacrifice:
{
"damage": {
"type": {
"tags": [
{
"id": "irons_spellbooks:spell/sacrifice",
"expected": true
}
]
}
}
}
No damage-type tag JSON file is required. Addon spell IDs follow the same rule, so a
spell registered as hazennstuff:shadow/arcane_cards is available as
hazennstuff:spell/shadow/arcane_cards. This works for addons that use or subclass
Iron's SpellDamageSource, including the standard AbstractSpell#getDamageSource
flow. An addon that creates an unrelated damage source does not carry a spell ID and
is therefore left untagged.
A minimal development-only Sacrifice test pack is provided at
ai/ais-sacrifice-damage-test. Install it in a test
world, tag a target with ais_sacrifice_test_target, and that target will say hello
when Sacrifice damages it. The ai directory is not part of the built mod jar.
Stability behavior
- Dynamic holders are cached during startup; casting does not scan registries.
- Missing attributes, unknown spells, missing schools, malformed scroll data, and incompatible addon entries safely no-op.
- A spell introduced too late for Minecraft's frozen attribute registry is left unchanged rather than risking a server crash.
- Attribute synchronization refreshes innate client selections only when a relevant level attribute changes.





