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.6.0 (Forge 1.20.1)

  • R
  • Jul 7, 2026
  • 163.93 KB
  • 35
  • 1.20.1
  • Forge

File Name

magicnpcs-0.6.0.jar

Supported Versions

  • 1.20.1

Curse Maven Snippet

Forge

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

Learn more about Curse Maven

## [0.6.0] — pack-author control & NPC compatibility Driven by real modpack-author feedback. Two headline fixes: **your datapack now deterministically beats the bundled loadouts** (a Guard Villagers file containing only `throw` means guards cast only `throw` — bundled spells can no longer leak in), and **witches, iron golems, and zombies can finally cast** (their own vanilla attack goals were starving the casting goal at the old fixed priority). Plus per-loadout caster chance and held-item requirements, `enabled: false` stubs, a `[builtinLoadouts]` config section, `/magicnpcs config`, and clear server-config/defaultconfigs docs. Every new field is optional and backward compatible. ### Added - **Bundled-loadout yield.** Loadouts loaded from the `magicnpcs` namespace automatically yield to any user datapack loadout for the same `entity_type` (+ optional `profession`) — no `replace` flag needed. The log names exactly what yielded to what. `replace` remains for user-vs-user conflicts; a `replace: true` on a shadowed `magicnpcs` file still asserts itself (deliberate escape hatch). - **`[builtinLoadouts]` config section** — per-bundled-loadout enable toggles (`enableRecruit`, `enableBowman`, `enableCrossbowman`, `enableCaptain`, `enableGuard`; all default on) to remove a shipped loadout without a datapack. Enforced at resolve time, so it respects config reloads. (There is still no bundled skeleton/vanilla-mob loadout — that shipped in 0.5.0.) - **`enabled: false`** — a `{ "enabled": false }` stub shadowing any pack's loadout file (same namespace + path) deletes that loadout; no `entity_type`/`spells` required. - **`caster_chance` (loadout-level)** — chance [0..1] that an individual mob becomes a caster at all. Rolled **once per entity** and persisted in NBT (`ForgeData.magicnpcs.caster_roll`), so the result is stable across saves/chunk reloads; distinct from the per-spell, per-decision `cast_chance`. Chance 1.0 bypasses stale non-caster marks. - **Per-loadout held-item requirements** — `require_held_item`, `required_items` (item ids and `#tags`; empty = the `magicnpcs:spell_focuses` tag), `required_hand` (`main_hand`/`off_hand`/ `either`). Declaring any of them replaces the global `equipment.requireSpellFocus` gate for that loadout — including `require_held_item: false` to exempt a loadout from the global gate. - **`/magicnpcs config`** — dump the active server-side values (master switches, balance, targeting, compat + builtin-loadout toggles with installed-mod markers) plus where the config file lives and how `defaultconfigs/` seeds new worlds. - **Raid-ally protection** — spellcasting raiders (witches!) never fire attack spells at raiders in their own raid; vanilla witches target *friendly* raiders to buff them, which previously read as a hostile target. - **Companion sit gate** — an owned `TamableAnimal` NPC (Human Companions et al.) ordered to sit/halt stops casting. - **`targeting.castGoalPriority`** (default −1 = auto) — see the goal-priority fix below. - **Docs:** README "who wins" precedence section, "where the config file lives" (serverconfig vs defaultconfigs), witch/iron-golem example loadouts, Human Companions id-verification and MineColonies investigation guidance, and a new [`docs/compat-matrix.md`](docs/compat-matrix.md) with per-mod manual QA scripts. ### Fixed - **Witches, iron golems, and zombies never cast.** Vanilla's scheduler only lets a goal preempt a *strictly* lower-priority one; the casting goal sat at fixed priority 2, so a witch's `RangedAttackGoal` (2) and a golem's/zombie's `MeleeAttackGoal` (1/2) held the look-control and starved it exactly while the mob had a target. The priority is now computed per mob (slot just above its own vanilla combat goal, clamped to [0, 2]) — witch → 1, golem → 0, skeleton → 2 (unchanged). Combat AI is only interrupted while a cast is imminent. Override with `targeting.castGoalPriority`; mobs that attach combat goals after spawn aren't seen by the auto computation. New GameTests run witch/golem casters with their **full vanilla AI** intact. - **Bundled Guard Villagers spells leaking into user loadouts.** Previously a user guard file *pooled* with the bundled `guard.json`, so guards sticky-picked either — some kept casting `magic_missile`/`guiding_bolt` despite the user's JSON. Fixed by the bundled-loadout yield. - **Diagnostics:** `/magicnpcs loadout` marks `[builtin]`, disabled-by-config, caster-chance and held-item gates, and reports "rolled non-caster" for mobs that failed their `caster_chance`; `validate` wording reflects the new precedence. ### Notes for existing worlds - A mob whose sticky loadout pick pointed at a now-yielded bundled loadout re-picks cleanly; no migration needed. - Known gap (pre-existing): the opt-in `recruits.useIronsAI` path honors neither the global focus gate nor `required_items`, and ignores per-spell tuning fields. - MineColonies: raider types likely work via the generic path; citizen/guard casting depends on their AI setting the vanilla attack target — see `docs/compat-matrix.md` script 6 before filing bugs. - Iron golems + Villager Recruits: Recruits' `OverrideIronGolemSpawn` option (default true in Recruits' own config) removes/replaces naturally-spawned golems on join, which reads as "golem loadouts don't work". Disable that Recruits option or use player-built golems (exempt).