Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProfessorFichte/More-RPG-Classes/llms.txt
Use this file to discover all available pages before exploring further.
More RPG Library provides conditional loot functions that allow you to create loot tables compatible with optional mod dependencies. These functions gracefully handle items that may not be registered.
Overview
Conditional loot comes in two forms:
- Conditional Item Function - Replaces an item with another if it exists (with fallback)
- Conditional Item Entry - Adds an item only if it exists (no fallback)
Both approaches ensure your loot tables remain functional even when optional mods are not installed.
Conditional Item Function
Replaces a base item with a conditional item if the conditional item is registered. If not registered, the base item is used as a fallback.
Syntax
{
"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
}
}
]
}
Parameters
conditional_item
Type: String (Item ID)
Required: Yes
The item to use if it exists in the registry.
"conditional_item": "other_mod:custom_item"
How It Works
Item Check
The function checks if conditional_item is registered in the game.
Replace or Keep
- If the item exists: Replace the base item with the conditional item
- If the item doesn’t exist: Keep the base item (fallback)
Apply Additional Functions
Any subsequent functions (like set_count) are applied to the resulting item.
Examples
Cross-Mod Gem Drops
{
"type": "minecraft:chest",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:diamond",
"functions": [
{
"function": "more_rpg_classes:conditional_item",
"conditional_item": "custom_gems:ruby"
},
{
"function": "minecraft:set_count",
"count": {
"min": 1,
"max": 3
}
}
]
}
]
}
]
}
Result:
- If
custom_gems:ruby is registered: 1-3 rubies
- If not registered: 1-3 diamonds
Optional Material with Enchantment
{
"type": "minecraft:item",
"name": "minecraft:iron_ingot",
"functions": [
{
"function": "more_rpg_classes:conditional_item",
"conditional_item": "better_metals:steel_ingot"
},
{
"function": "minecraft:set_count",
"count": 5
}
]
}
Use this function when you want to provide better rewards if a mod is installed, but still want to give something if it’s not.
Conditional Item Entry
Adds an item to the loot pool only if it exists. If the item isn’t registered, nothing is added to the loot table (no fallback).
Syntax
{
"type": "more_rpg_classes:conditional_item",
"item": "your_mod:jade_gem",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 3
}
}
Parameters
item
Type: String (Item ID)
Required: Yes
The item to add if it exists.
count
Type: Number provider
Required: No
Default: 1
Number of items to drop. Can be a constant or a number provider.
weight
Type: Integer
Required: No
Default: 1
Loot table weight for this entry.
quality
Type: Integer
Required: No
Default: 0
Loot table quality (affects luck-based selection).
Examples
Optional Bonus Items
{
"type": "minecraft:chest",
"pools": [
{
"rolls": 2,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:gold_ingot",
"weight": 10
},
{
"type": "more_rpg_classes:conditional_item",
"item": "rare_materials:adamantite_ore",
"weight": 5,
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 2
}
}
]
}
]
}
Result:
- If
rare_materials:adamantite_ore exists: Chance to get 1-2 adamantite ore
- If not: Only gold ingots can drop
Multiple Optional Items
{
"type": "minecraft:chest",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "more_rpg_classes:conditional_item",
"item": "custom_gems:ruby",
"weight": 10,
"count": 3
},
{
"type": "more_rpg_classes:conditional_item",
"item": "custom_gems:sapphire",
"weight": 10,
"count": 3
},
{
"type": "more_rpg_classes:conditional_item",
"item": "custom_gems:emerald_shard",
"weight": 5,
"count": 1
}
]
}
]
}
If none of the conditional items are registered, the loot pool will be empty. Consider including at least one vanilla fallback entry.
With Vanilla Fallback
{
"type": "minecraft:chest",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "more_rpg_classes:conditional_item",
"item": "special_weapons:legendary_sword",
"weight": 1
},
{
"type": "minecraft:item",
"name": "minecraft:diamond_sword",
"weight": 9
}
]
}
]
}
Binding Spells to Items
The bind_spell_from_pools function allows you to bind random spells from spell pools to any item, turning it into a spell container.
Syntax
{
"type": "minecraft:item",
"name": "minecraft:diamond_sword",
"functions": [
{
"function": "more_rpg_classes:bind_spell_from_pools",
"spell_pools": ["#wizards:arcane", "#wizards:frost"],
"count": 1
}
]
}
Parameters
spell_pools
Type: Array of strings
Required: Yes
Spell pools or specific spells to bind. Use # prefix for tags.
count
Type: Number provider
Required: No
Default: 1
Number of spells to bind to the item.
chance
Type: Number provider (0.0 - 1.0)
Required: No
Default: 1.0 (100%)
Probability of applying the spell binding.
Examples
Enchanted Sword with Spell
{
"type": "minecraft:item",
"name": "minecraft:diamond_sword",
"functions": [
{
"function": "more_rpg_classes:bind_spell_from_pools",
"spell_pools": ["#wizards:fire"],
"count": 1
},
{
"function": "minecraft:enchant_randomly"
}
]
}
Multi-Spell Staff
{
"type": "minecraft:item",
"name": "wizards:arcane_staff",
"functions": [
{
"function": "more_rpg_classes:bind_spell_from_pools",
"spell_pools": ["#wizards:arcane", "#wizards:frost", "#wizards:fire"],
"count": {
"type": "minecraft:uniform",
"min": 2,
"max": 3
}
}
]
}
Chance-Based Spell Binding
{
"type": "minecraft:item",
"name": "minecraft:golden_sword",
"functions": [
{
"function": "more_rpg_classes:bind_spell_from_pools",
"spell_pools": ["#paladins:holy"],
"count": 1,
"chance": 0.25
}
]
}
If the item is not already a spell container, this function will convert it into one.
Comparison Table
| Feature | Conditional Item Function | Conditional Item Entry |
|---|
| Entry Type | minecraft:item with function | more_rpg_classes:conditional_item |
| Fallback | Yes (base item) | No |
| Use Case | Better rewards if mod exists | Optional bonus items |
| If item missing | Returns base item | Returns nothing |
| Best For | Primary loot with upgrades | Secondary/bonus loot |
Implementation Reference
Conditional Item Function
net.more_rpg_classes.util.loot.ConditionalItemLootFunction
Function ID: more_rpg_classes:conditional_item
Conditional Item Entry
net.more_rpg_classes.util.loot.ConditionalItemEntry
Entry Type: more_rpg_classes:conditional_item
Bind Spell Function
net.more_rpg_classes.util.loot.BindSpellFromPoolsLootFunction
Function ID: more_rpg_classes:bind_spell_from_pools