Irons_Spells_Restringed_Rarities

Lock Iron's Spells 'n Spellbooks spell rarities per player and unlock them via quests, commands or config.

An unofficial addon for Iron's Spells 'n Spellbooks that lets you lock spell rarities (Common, Uncommon, Rare, Epic, Legendary) per player. It's made for servers and modpacks with a progression system: players unlock rarities by completing quests, through commands, or from the config.

How it works

A player can cast a spell only if they have unlocked its rarity or a higher one through any of these sources:

Source Where Applies to
Personal unlock /spellrarity command (works as a Questlog reward). Persists through death. One player
Config list Server config, individual_unlocks (player names or UUIDs) Listed players
Global toggle Server config, global_unlocks Everyone
  • Unlocking a rarity includes all lower ones. Legendary also grants Epic, Rare, Uncommon and Common.
  • Turning a global toggle off doesn't erase anything: players go back to their personal or config-list unlocks.
  • A blocked cast is cancelled before it starts. No mana, cooldown or scroll is consumed, and the player sees an action bar message.
  • Only players are restricted. Mobs cast normally.

⚠️ By default every rarity is locked, even Common. Set global_unlocks.common = true if you want Common spells to be available to everyone.

Commands

Command Permission Effect
/spellrarity grant <players> <rarity> op Raises the personal unlock up to that rarity (never lowers it)
/spellrarity revoke <players> <rarity> op Removes that rarity and every higher one
/spellrarity set <players> <rarity\|none> op Sets the exact personal unlock
/spellrarity reset <players> op Clears the personal unlock
/spellrarity get <player> op Shows every source. Returns 0 (none) to 5 (legendary)
/spellrarity check <player> <rarity> op Succeeds only if the player can use that rarity (for execute store success)
/spellrarity info everyone Shows your own unlocks

Questlog integration

Use a questlog:command reward. @s is the player who completed the quest, and the player doesn't need to be op:

"rewards": [
  {
    "type": "questlog:command",
    "command": "/spellrarity grant @s epic",
    "permission_level": 2,
    "auto_claim": true
  }
]

To chain progression (Epic, then Legendary), give the next quest a questlog:quest_complete requirement.

Functions, advancements and command blocks

Anything that can run commands can unlock rarities:

spellrarity grant @s rare

For example, a vanilla advancement reward "rewards": { "function": "yourpack:unlock_rare" }, or /function from Questlog.

Configuration

File: <world>/serverconfig/irons_restricted_rarities-server.toml. It reloads automatically when saved, without a restart. Put a copy in defaultconfigs/ to use it as the template for new worlds.

  • enabled: master switch.
  • rarityBasis: CAST_LEVEL (default) uses the rarity of the level the spell is cast at, the same one shown on scrolls and spellbooks. SPELL_MIN_RARITY uses the spell's base rarity regardless of level.
  • restrictCommandCasts: whether Iron's /cast command is also restricted (off by default).
  • showDeniedMessage / notifyPlayerOnChange: player messages.

Requirements

  • Minecraft 1.20.1, Forge 47.4.0+
  • Iron's Spells 'n Spellbooks (tested with 1.20.1-3.16.4)
  • Questlog (optional, tested with 3.5.5)

Server-side: clients don't need it. For singleplayer, install it like any other mod.

Source code and issues: GitHub

Irons_Spells_Restringed_Rarities Team

profile avatar
  • 3
    Projects
  • 165
    Downloads

More from joruughen