loot — Loot API
Phase: Server
Modify loot tables — add extra drops or remove existing ones.
Loot tables load before server_scripts/ run. Place loot.removeDrop calls in startup_scripts/ so they take effect on the very first world load. Otherwise, run /reload in-game after the server starts.
Adding Drops
onEvent("loot.modify", fn) — Global listener
The loot.modify event fires for every loot table that is loaded. Check e.tableId to target specific tables.
onEvent("loot.modify", function(e)
if e.tableId == "minecraft:blocks/coal_ore" then
e.addDrop("minecraft:diamond", 1)
end
end)
loot.modifyTable(tableId, fn) — Single-table shortcut
A convenience wrapper that only calls fn for the specified table.
loot.modifyTable("minecraft:blocks/stone", function(e)
e.addDrop("minecraft:cobblestone", 2)
end)
e.addDrop(itemId, count)
Adds a constant-count drop to the loot table being modified. Available inside both callback styles above.
| Parameter | Type | Description |
|---|---|---|
itemId | string | Item identifier, e.g. "minecraft:emerald" |
count | int | Number of items to drop (default 1) |
Removing Drops
loot.removeDrop(tableId, itemId)
Pre-registers a drop removal rule. Pools that contain only the prohibited item are stripped from the table at load time.
For precise control, prefer Tags.replace or the /loot command. loot.removeDrop only strips entire pools — it cannot partially reduce a pool.
-- startup_scripts/loot_tweaks.lua
loot.removeDrop("minecraft:blocks/gravel", "minecraft:flint")
Full Example
-- startup_scripts/loot.lua
-- Remove gravel's flint drop
loot.removeDrop("minecraft:blocks/gravel", "minecraft:flint")
-- Add a rare diamond to all stone blocks
loot.modifyTable("minecraft:blocks/stone", function(e)
e.addDrop("minecraft:diamond", 1)
end)
-- Add mob drops via event
onEvent("loot.modify", function(e)
if e.tableId == "minecraft:entities/zombie" then
e.addDrop("minecraft:emerald", 1)
end
end)