Skip to content

[1.21.1] Loot Modifiers

Insane96 edited this page Apr 19, 2026 · 1 revision

Loot Modifiers

InsaneLib provides several Global Loot Modifiers that can be used in data packs.

Global loot modifier files are placed in: data/<namespace>/neoforge/loot_modifiers/<name>.json

All modifiers support the standard conditions array from NeoForge.


insanelib:replace_loot

Replaces occurrences of one item with another in the generated loot. Supports fortune-dependent chance and count multipliers, partial replacement, and durability preservation.

Key Type Default Info
item_to_replace Identifier Required The item to replace
new_item Identifier Required The item to replace with
amount_to_replace Integer -1 Number of items to replace. -1 replaces the entire stack
chances List of Decimals [1.0] Per-fortune-level replacement chances. Index 0 = no fortune, index 1 = Fortune I, etc. The last value is used for all higher fortune levels
multipliers List of Decimals [1.0] Per-fortune-level count multipliers applied after replacement. Index 0 = no fortune, index 1 = Fortune I, etc. The last value is used for all higher fortune levels
keep_durability Boolean false If true, transfers the durability percentage from the original item to the replacement. Only effective when amount_to_replace is -1 and both items are damageable
chests_only Boolean false If true, only applies to loot tables whose path contains chests/

The following example replaces iron swords with diamond swords in all loot, with a 50% base chance and higher chance with fortune:

{
  "type": "insanelib:replace_loot",
  "conditions": [],
  "item_to_replace": "minecraft:iron_sword",
  "new_item": "minecraft:diamond_sword",
  "chances": [0.5, 0.75, 1.0],
  "keep_durability": true
}

insanelib:inject_loot_table

Appends the contents of another loot table into the current loot roll.

Key Type Info
loot_table Identifier The loot table whose results are appended

The following example adds the contents of minecraft:chests/simple_dungeon to a loot table roll:

{
  "type": "insanelib:inject_loot_table",
  "conditions": [],
  "loot_table": "minecraft:chests/simple_dungeon"
}

insanelib:drop_multiplier

Multiplies the count of matching items in the generated loot. Matching can be done by item, item tag, or both. Stacks of the same item are merged before the multiplier is applied, and fractional results are resolved probabilistically.

At least one of item or tag should be specified; if neither is specified, all items are multiplied.

Key Type Default Info
multiplier Decimal (0–1024) Required Multiplier applied to the matched item count
item Identifier None If present, only stacks of this item are multiplied
tag Identifier None If present, only stacks matching this item tag are multiplied
amount_to_keep Integer (0–256) 0 Amount subtracted from the stack count before applying the multiplier (kept as-is)
ignore_unstackable Boolean true If true, non-stackable items are skipped

The following example doubles wheat drops:

{
  "type": "insanelib:drop_multiplier",
  "conditions": [],
  "item": "minecraft:wheat",
  "multiplier": 2.0
}

insanelib:loot_purger

Removes (or damages) items based on distance from world spawn. Items have a higher chance of being purged the closer they generate to spawn, creating a progressive difficulty curve where loot near spawn is worse.

The survival probability is linearly interpolated between (1 - multiplier_at_start) at start_range and 1.0 at end_range. Beyond end_range, items are never purged.

Key Type Default Info
end_range Integer Required Distance from spawn beyond which no purging occurs
start_range Integer 0 Distance from spawn at which purging begins. Items within this radius are always purged at multiplier_at_start rate
multiplier_at_start Decimal 0.0 Survival chance multiplier at start_range. 0 removes all items; 1 removes nothing
apply_to_damageable Boolean false If true, damageable items are damaged proportionally instead of being removed
blacklisted_items_tag Identifier None Items in this tag are never purged or damaged
blacklisted_entity_type_tag Identifier None Entity types in this tag are never affected by this modifier

The following example removes all loot within 5000 blocks of spawn, with full loot beyond that distance:

{
  "type": "insanelib:loot_purger",
  "conditions": [],
  "end_range": 5000,
  "multiplier_at_start": 0.0,
  "blacklisted_items_tag": "insanelib:loot_purger_blacklist"
}

insanelib:disenchant

Strips enchantments from all items in the generated loot. Enchanted books are converted back to plain books. An optional item tag can be used to protect specific items from being disenchanted.

Key Type Default Info
blacklisted_items_tag Identifier None Items in this tag are not disenchanted. Enchanted books in this tag are also kept as enchanted books

The following example removes all enchantments from loot, except for items in the blacklist tag:

{
  "type": "insanelib:disenchant",
  "conditions": [],
  "blacklisted_items_tag": "insanelib:disenchant_blacklist"
}

insanelib:feature_enabled (Loot Condition)

A loot condition that passes only when the specified InsaneLib feature is enabled. Useful for making loot modifiers respect mod configuration.

Key Type Info
condition String Must be "insanelib:feature_enabled"
feature String The fully qualified feature name to check
{
  "condition": "insanelib:feature_enabled",
  "feature": "modid.CategoryName.FeatureName"
}

Clone this wiki locally