Attributes For Iron's Spells

Quick rating

Community listing page, reviews here may not be monitored by the author.

Attributes For Iron's Spells

No reviews yet

Creates Minecraft attributes for every spell and school registered with Iron's Spells and Spellbooks, including entries supplied by addon mods.

Mod Loaders
Minecraft

About

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
  • Optional: Alshanex's Familiars for the tamed spell attack delay attribute

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.

Direct damage resistance attributes

Every living entity has these attributes:

Attribute Default Effect
ais:damage_resistance 0.0 Reduces damage from every incoming damage source.
ais:ranged_resistance 0.0 Reduces damage whose damage type is tagged minecraft:is_projectile.
ais:magic_resistance 0.0 Reduces Iron's SpellDamageSource damage and damage tagged neoforge:is_magic.

Resistance uses damage × (1 - resistance). A value of 0.5 halves matching damage, 1.0 reduces it to zero, and -0.5 increases it to 150%. Values range from -1024.0 to 1.0. Reducing damage to zero does not cancel the incoming damage event, so resistance does not itself grant immunity to unrelated impact or on-hit behavior.

ais:damage_resistance applies to every source without inspecting its damage type. This makes a temporary value of 1.0 suitable for skills that prevent all incoming damage while leaving the normal hit event and unrelated effects intact.

Ranged classification deliberately follows Minecraft's damage-type tag. Modded arrows, throwable spears, bullets, and other ranged attacks work when their damage type is properly included in minecraft:is_projectile. Magic classification uses both Iron's source class and NeoForge's standard magic tag so addon damage remains covered when it retains only one of those signals. Later generic fire, poison, and wither ticks are not reclassified based on the spell that originally applied them.

attribute @s ais:damage_resistance base set 1
attribute @s ais:ranged_resistance base set 0.5
attribute @s ais:magic_resistance base set -0.25

Tamed-mob attributes

These attributes are stored on the owner and affect all of that player's loaded, genuinely tamed mobs:

Owner attribute Default Effect on each tamed mob
ais:tamed_damage_resistance 1.0 Multiplies all incoming damage.
ais:tamed_ranged_resistance 0.0 Reduces minecraft:is_projectile damage; negative values increase it.
ais:tamed_magic_resistance 0.0 Reduces Iron's or neoforge:is_magic damage; negative values increase it.
ais:tamed_damage 1.0 Multiplies all damage credited to the mob, including melee, projectiles, and spells.
ais:tamed_speed 1.0 Multiplies movement speed.
ais:tamed_max_health 1.0 Multiplies maximum health while preserving current health percentage.
ais:tamed_blast_resistance 1.0 Additionally multiplies explosion damage.
ais:tamed_dodge_chance 0.0 Chance from 0.0 to 1.0 to avoid direct melee attacks and projectile impacts.
ais:tamed_armor 1.0 Multiplies existing armor.
ais:tamed_armor_toughness 1.0 Multiplies existing armor toughness.
ais:tamed_life_steal 0.0 Heals the mob by this proportion of final damage it deals.
ais:tamed_attack_speed 1.0 Multiplies attack speed and scales standard melee-AI attack intervals.
ais:tamed_attack_knockback 1.0 Multiplies existing attack knockback; establishes knockback on a zero-base mob.
ais:tamed_spell_attack_delay 1.0 Only available when Alshanex's Familiars is installed. Multiplies existing attack spell casting delay for tamed Alshanex's Familiars mobs. Setting this to 0.5 will halve the delay between casting spells.

For multiplier attributes, 1.0 is neutral, 0.5 halves the value, and 2.0 doubles it. Some mobs omit vanilla attribute containers, so AIS adds missing physical containers at startup without replacing values supplied by Minecraft or another mod. Armor, armor toughness, and attack knockback need special handling when their underlying value is zero: factors above 1.0 establish a value of factor - 1.0, while 1.0 remains neutral. Standard vanilla attribute modifiers can be used on the owner, for example:

attribute @s ais:tamed_max_health base set 2
attribute @s ais:tamed_damage base set 1.5
attribute @s ais:tamed_magic_resistance base set 0.5
attribute @s ais:tamed_dodge_chance base set 0.2
attribute @s ais:tamed_attack_knockback base set 1.5

Changes reach every loaded pet by its next server tick. AIS uses transient modifiers and updates only when the owner or a relevant value changes, avoiding permanent mob data and repeated modifier churn.

Supported mobs include vanilla tameable animals and tamed horses, subclasses used by other mods, and Alshanex's Familiars. Alshanex integration is optional and uses FamiliarLib's owner contract without making either addon a required dependency.

Spell-summoned mobs are deliberately excluded from the tamed_* profile. In particular, Iron's Spells summons such as summoned skeletons, Vexes, polar bears, and spectral steeds do not receive tamed attributes merely because they reference a summoner. A mob must be genuinely tamed through a supported tameable/familiar ownership contract.

Summon attributes

Summons use a separate owner-side profile with the same behavior:

Owner attribute Default Effect on each summon
ais:summon_damage_resistance 1.0 Multiplies all incoming damage
ais:summon_ranged_resistance 0.0 Reduces minecraft:is_projectile damage; negative values increase it
ais:summon_magic_resistance 0.0 Reduces Iron's or neoforge:is_magic damage; negative values increase it
ais:summon_damage 1.0 Multiplies all damage credited to the summon
ais:summon_speed 1.0 Multiplies movement speed
ais:summon_max_health 1.0 Multiplies maximum health while preserving current health percentage
ais:summon_blast_resistance 1.0 Additionally multiplies explosion damage
ais:summon_dodge_chance 0.0 Chance to avoid direct melee attacks and projectile impacts
ais:summon_armor 1.0 Multiplies existing armor
ais:summon_armor_toughness 1.0 Multiplies existing armor toughness
ais:summon_life_steal 0.0 Heals the summon by this proportion of final damage it deals
ais:summon_attack_speed 1.0 Multiplies attack speed and scales standard melee-AI attack intervals
ais:summon_attack_knockback 1.0 Multiplies existing attack knockback; establishes knockback on a zero-base summon
attribute @s ais:summon_max_health base set 2
attribute @s ais:summon_damage base set 1.5
attribute @s ais:summon_ranged_resistance base set 0.25
attribute @s ais:summon_attack_speed base set 1.25

This profile applies to Iron's Spells summons, including summoned skeletons, zombies, Vexes, polar bears, spectral steeds, and summoned weapons that are living entities. Addon summons are supported when they implement Iron's IMagicSummon contract, or when a tagged summon exposes a standard Minecraft owner. Summons take priority during classification and never receive tamed_* and summon_* modifiers simultaneously. Damage attribution recognizes the summon itself, projectiles owned by it, and damage sources where another entity (such as the owner) is recorded as the causing entity. Custom addon attack goals can still define their own fixed cadence; AIS directly scales Minecraft's standard melee goal and also exposes the modified vanilla attack speed value for addon AI to consume.

Direct, companion, general-damage, and blast resistance factors stack multiplicatively when more than one applies. Companion resistance values are read from the owner during the incoming damage event, so changes affect the next matching hit without waiting for companion synchronization.

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.

Active cooldown command

Operators with permission level 2 can adjust the remaining time of active spell cooldowns. Spell and school IDs use the same slash form as AIS attributes and support autocomplete, including IDs registered by addon mods:

/ais cooldown spell <namespace/path> <set|add|multiply> <value> [targets]
/ais cooldown school <namespace/path> <set|add|multiply> <value> [targets]
/ais cooldown all <set|add|multiply> <value> [targets]

set and add values are seconds and may contain decimals. multiply is a factor. The optional targets default to the executing player; selectors such as @s and @a are supported. Results at or below zero immediately refresh the matching spell.

ais cooldown spell irons_spellbooks/throw set 0 @s
ais cooldown spell irons_spellbooks/throw add 100 @s
ais cooldown spell irons_spellbooks/throw add -2 @s
ais cooldown all set 0 @s
ais cooldown school irons_spellbooks/fire multiply 0.5

Only spells that are currently cooling down are changed. The command never creates a new cooldown for an available spell. School operations inspect only the player's active cooldown entries and resolve their registered schools, keeping command cost proportional to active cooldown count rather than the full spell registry.

The development-only ai/ais-throw-kill-refresh datapack demonstrates this command by refreshing only Throw after Throw deals a killing blow.

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.

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.
  • Tamed-mob modifiers are transient, cached, server-driven, and removed while an owner is offline.
  • Damage resistance performs constant-time tag and attribute checks only when damage occurs; it does not add a scan or loop.