Skip to main content
More RPG Library provides custom loot table functions that extend Minecraft’s loot system with spell-aware functionality and conditional item handling.

Specific Spell Scroll Pool

Generates spell scrolls from specific spell pools with configurable tier ranges and blacklisting.

Function ID

more_rpg_classes:specific_spell_scroll_pool

Parameters

spell_pools
array<string>
required
List of spell pool identifiers. Use #namespace:pool_name for tags or namespace:spell_id for exact spells.Example: ["#wizards:frost", "#wizards:fire"]
spell_tier_min
number
required
Minimum spell tier to include. The function will use Math.min(spell_tier_min, spell_tier_max) as the actual minimum.
spell_tier_max
number
required
Maximum spell tier to include. The function will use Math.max(spell_tier_min, spell_tier_max) as the actual maximum.
count
number
required
Number of spells to add to the scroll. Supports loot number providers.
blacklist_spells
array<string>
List of spell IDs to exclude from selection.Example: ["wizards:frost_blizzard", "wizards:fire_meteor"]

Behavior

  • Filters spells by tier range (inclusive)
  • Supports both spell pool tags (with # prefix) and exact spell IDs
  • Prevents duplicate spells within the same container
  • Returns empty stack if no valid spells are found for scrolls
  • Automatically sorts spell IDs in the container
  • Sets scroll metadata for the first spell when item is a scroll

Example

{
  "type": "minecraft:item",
  "name": "spell_engine:scroll",
  "functions": [
    {
      "function": "more_rpg_classes:specific_spell_scroll_pool",
      "spell_pools": ["#wizards:frost", "#wizards:fire"],
      "spell_tier_min": 3,
      "spell_tier_max": 4,
      "count": 1,
      "blacklist_spells": ["wizards:frost_blizzard", "wizards:fire_meteor"]
    }
  ]
}

Bind Spell From Pools

Binds random spells from specified pools to any item, converting it into a spell container if needed.

Function ID

more_rpg_classes:bind_spell_from_pools

Parameters

spell_pools
array<string>
required
List of spell pool identifiers. Use #namespace:pool_name for tags or namespace:spell_id for exact spells.Example: ["#wizards:arcane", "#wizards:frost"]
count
number
default:"1"
Number of spells to bind to the item. Supports loot number providers.
chance
number
Optional probability (0.0-1.0) for the function to execute. If the random check fails, the original stack is returned unchanged.

Behavior

  • Creates a spell container on any item, even non-spell items
  • Preserves existing spells on items that are already spell containers
  • Prevents duplicate spells on the same item
  • Uses SpellContainer.ContentType.MAGIC for new containers
  • Retries up to 3 times to avoid selecting duplicate spells
  • Returns original stack if no valid spells are available

Example

{
  "type": "minecraft:item",
  "name": "minecraft:diamond_sword",
  "functions": [
    {
      "function": "more_rpg_classes:bind_spell_from_pools",
      "spell_pools": ["#wizards:arcane", "#wizards:frost"],
      "count": 1
    }
  ]
}

Conditional Item

Replaces the loot item with a conditional item if it exists in the registry, otherwise uses the original item as fallback.

Function ID

more_rpg_classes:conditional_item

Parameters

conditional_item
string
required
Item ID to use if the item is registered.Example: "your_mod:jade_gem"

Behavior

  • Checks if the conditional item exists in the item registry
  • If found, replaces the entire stack with a new stack of the conditional item
  • If not found, returns the original stack unchanged
  • Does not preserve stack count from original item (conditional item starts with count 1)
  • Use with minecraft:set_count function to set the count after conditional replacement

Example

{
  "type": "minecraft:item",
  "name": "minecraft:diamond",
  "functions": [
    {
      "function": "more_rpg_classes:conditional_item",
      "conditional_item": "your_mod:jade_gem"
    },
    {
      "function": "minecraft:set_count",
      "count": {
        "min": 1,
        "max": 4
      }
    }
  ]
}
The conditional_item function replaces the item but resets the count. Always apply set_count after this function if you need a specific quantity.