How to Apply the name_enchanted_item Function to a Loot Table
What the function does
name_enchanted_item is a loot table function added by Looot. When it runs on a generated item, it reads that item's enchantments and either picks a themed name (for items with one or two enchantments) or rolls a random name (for items with three or more). You do not craft anything — you edit a loot table JSON so the function fires when the item is rolled.
Adding it to a loot table
1. Locate or create the loot table you want to modify (for example, a chest or mob drop table in your datapack).
2. Inside the entry that produces the enchanted item, add a functions array if one does not already exist.
3. Add an object with "function": "looot:name_enchanted_item" (confirm the exact namespace in the mod's own docs before shipping).
4. Make sure the function runs *after* the enchantments are applied to the item, otherwise there is nothing for it to read.
5. Reload with /reload and test by opening the container or killing the mob.
Testing tips
Use /loot commands to spawn the table's output directly into your inventory so you can iterate quickly. If names come out blank, the item likely had no enchantments at the moment the function ran — reorder your function list so enchantment functions come first.