Finding the Right Table Name
LootTweaker scripts reference loot tables by their resource location, like minecraft:entities/zombie or minecraft:chests/simple_dungeon. Before writing anything, confirm the exact path. You can list loaded tables from the CraftTweaker log or by using the in-game /ct loottweaker style dump commands that the mod exposes. Mob tables live under entities/, block tables under blocks/, and chest tables under chests/.
Writing the Script
Create a .zs file inside the scripts folder. Import the LootTweaker classes at the top, then grab the table and add your entry:
`zenscript
import mods.loottweaker.LootTweaker;
val table = LootTweaker.getTable("minecraft:entities/zombie");
table.addEntry(<minecraft:diamond>, 1, 1, 0.05);
`
The numeric arguments control minimum count, maximum count, and drop chance. Keep chances as decimals between 0 and 1. If you want the drop to always appear, set the chance to 1.
Testing and Reloading
Run /reload or restart the world so the script recompiles. Kill the target mob repeatedly and watch the drops. If nothing changes, check the log for a parse error — a single typo in the table name silently does nothing. Remove the entry with table.removeEntry(...) if you need to revert.
