
Personalized Loot with Extra Loot
Extra Loot opens up new possibilities for loot customization in Minecraft by tying dropped items to creature attributes. This mod introduces a special predicate for loot tables, allowing for fine-grained control over loot drops based on mobs' health, armor, and attack stats.
Flexible Loot Configuration
The configuration file provides complete control: you can adjust the weight of various creature characteristics (maximum health, armor, armor toughness, and attack damage) using numerical coefficients, and also add extra loot pools to existing loot tables.
Configuration
The standard configuration file structure looks like this:
{
"maxHealthWeight": 1.0,
"armorWeight": 1.0,
"armorToughnessWeight": 1.0,
"attackDamageWeight": 1.0,
"extraLoots": [],
"extraXpMultiplier": 1.0,
"extraXpChance": 0.5
}
The first four parameters control how different creature characteristics influence loot determination, while the remaining ones handle the configuration of additional item and experience drops.
Practical Examples
Let's demonstrate how this system works. Note that comments are provided for understanding purposes only and should not be included in the actual JSON.
Configuration
{
"maxHealthWeight": 1.0,
"armorWeight": 2.0,
"armorToughnessWeight": 2.0,
"attackDamageWeight": 4.0,
"extraLoots": [
{
"target_regex": "^(?!.xxx).entities.", //Regular expressions support
"extra_table": "xxx:common_drop"
}
],
"extraXpMultiplier": 1.0,
"extraXpChance": 0.1
}
Custom Loot Table
{
"pools": [
{
"conditions": [
{
"condition": "minecraft:killed_by_player"
},
{
"condition": "extra-loot:entity_tier",
"entity": "this",
"min": 0,
"max": 50 //value -1 means infinity
}
],
"entries": [
...
]
}
]
}
How the System Works
The configuration shown above adds an extra loot table to any loot tables with identifiers containing "entities" but excluding the substring "xxx".
For example, when a player kills a zombie, the system calculates the weighted sum of the creature's characteristics (health, armor, armor toughness, and attack damage). If this value falls within the specified range of 0 to 50, the condition is met.
Additionally, there's a chance to drop extra experience when killing any mob. The probability is determined by the "extraXpChance" value from the configuration file, and the amount of extra experience equals the weighted sum of characteristics multiplied by the "extraXpMultiplier" factor.
Important Notes
You should avoid creating infinite loops in loot tables. For instance, this configuration could lead to problems:
{
...
"extraLoots": [
{
"target_regex": ".",
"extra_table": "minecraft:entities/zombie"
}
]
...
}
In this case, the zombie's loot table would attempt to add its own table, causing recursive infinity.