promotional bannermobile promotional banner

Magic NPCs

Give your NPCs real spells. Magic NPCs makes mobs cast spells from Iron's Spells 'n Spellbooks — driven by datapacks and config, so any mob can become a spellcaster.

File Details

Magic NPCs 0.3.0 (Forge 1.20.1)

  • R
  • Jun 20, 2026
  • 87.48 KB
  • 26
  • 1.20.1
  • Forge

File Name

magicnpcs-0.3.0.jar

Supported Versions

  • 1.20.1

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:magic-npcs-1578876:8288734")
Curse Maven does not yet support mods that have disabled 3rd party sharing

Learn more about Curse Maven

[0.3.0] — review fixes, completed deferred systems & datapack docs

An independent review pass: correctness fixes, four previously-deferred systems implemented, and a full datapack authoring guide. Builds green; runData and the offline bootSanity GameTest pass. Runtime casting is unchanged from the proven 0.1.1 path.

Added

  • Data generation (./gradlew runData): the shipped loadouts and the magicnpcs:spell_focuses tag are now generated from Java (single source of truth) into src/generated/resources. The focus tag includes Iron's #irons_spellbooks:school_focus by default, so requireSpellFocus works out-of-the-box when Iron's is installed.
  • Profession-scoped loadouts: a loadout may declare an optional profession to apply to only villagers of that profession (multiple loadouts per entity type; a profession-less one is the fallback). See docs/loadouts/.
  • School-aware spell focus (schools.schoolAwareFocus, previously inert): with requireSpellFocus on, a school caster may satisfy it by holding a focus for its own Iron's school (the per-school irons_spellbooks:<school>_focus tag); spawn-with-gear prefers a school-appropriate focus.
  • Runtime casting GameTests (skeletonCastsMagicMissile, recruitCasts, recruitCastsWithIronsAi): assert a real cast (mana spent) in a full Iron's runtime; they skip cleanly offline so bootSanity stays green.
  • Datapack authoring guide in the README (complete pack skeleton with pack_format 15, an annotated multi-spell example, modded-mob and profession examples, the spell-focus tag, and explicit-loadout-vs-magic-school guidance) plus a datapack example in the CurseForge description.

Fixed

  • /magicnpcs school clear and the Tome's sneak-clear are now sticky: they mark the NPC a non-caster instead of resetting it, so it no longer re-rolls into a caster on the next chunk reload.
  • School re-assign/clear now removes the Iron's-AI goal too: with recruits.useIronsAI=true, re-assigning or clearing a school via the command/Tome no longer leaves a stale/duplicate WizardAttackGoal.
  • A villager whose rolled school yields no castable spells is now marked a non-caster instead of re-rolling (and re-failing) every join.
  • Loadout numeric fields are clamped on load, and an invalid role reports a clear error.

Changed

  • Loadouts load as a list per entity type (to support profession); behaviour for existing profession-less loadouts is unchanged.

Notes

  • recruits.useIronsAI (off by default) delegates targeting/fleeing to Iron's, so the built-in line-of-sight, friendly-fire, Peaceful, and spell-focus gates do not apply in that mode (the cast still uses Magic NPCs' mana economy).
  • Iron's Spells 'n Spellbooks and Villager Recruits remain compile-only soft dependencies.

[0.2.0] — NPC compatibility, hardening & magic schools

A broad release-readiness pass plus a new per-NPC magic-school system. Builds green and boots cleanly with or without Iron's/Recruits (offline GameTest bootSanity passes); runtime casting is unchanged from the proven 0.1.1 path.

Added

  • Magic schools for recruits & villagers. Each individual recruit/villager can be assigned an Iron's school (fire, ice, lightning, holy, ender, blood, evocation, nature, eldritch). The spell pool is built dynamically from that school's enabled spells (filtered by rarity/level caps, INSTANT-only, and the allow/deny lists), so add-on spells are picked up automatically. Assignment is stored per-entity in persistent data and rolled once. See docs/schools.md.
    • Automatic on spawn — recruits by chance/rank/mode (RANDOM/BY_TYPE/BY_RANK), villagers by a profession→school map. Villagers only actually cast when they have a target (raids / guard mods), preserving vanilla passivity.
    • /magicnpcs school set|info|reroll|clear <targets> [school] command (perm-gated).
    • School Tome item — right-click an NPC to cycle its school, sneak to clear.
  • Generic owner/team friendly-fire protection (targeting.protectOwners): a vanilla-only adapter (scoreboard teams + OwnableEntity) protects companion/pet/ follower NPCs (e.g. Human Companions) and their owner with no hard dependency.
  • Generic bystander protection (targeting.protectBystanders): attack spells avoid catching villagers, iron golems, players, and tamed pets in their line of fire.
  • Per-mod compat toggles ([compat], default off) gating datapack loadouts for Guard Villagers, MCA Reborn, MineColonies, Easy NPC, Human Companions, More Villagers, and VillagersPlus. A ready Guard Villagers loadout ships (inert until enabled); copy- paste examples for the rest are in docs/loadouts/.
  • Equipment options ([equipment]): requireSpellFocus (NPC must hold an item in the magicnpcs:spell_focuses tag) and spawnWithGearChance.
  • Lang file (en_us.json) with config labels + item text; item model reuses the vanilla enchanted-book texture (no third-party asset shipped).

Changed

  • Casting hardening. NPCs no longer cast while sleeping, dead/dying, removed, or AI-disabled; attack spells now require line of sight (requireLineOfSight); casting is suppressed on Peaceful (peacefulDisablesCasting); mana pools scale with world difficulty (difficultyScaling).
  • Recruits now respect their command system — a recruit ordered to a passive/flee state will not cast.
  • bootSanity GameTest now ships its platform structure and passes offline.

Notes

  • Iron's Spells 'n Spellbooks and Villager Recruits remain compile-only soft dependencies — neither is bundled. The 8 non-Recruits NPC mods are supported via config + datapack + generic vanilla-interface adapters (no API imports), so the mod loads safely whether or not they are installed.