Started by
UT27
on
Topic category: Help with Minecraft modding (Java Edition)
I really want to make a villager that sells the custom enchanted book. I tried to pick a enchantment, but there was just an Item Selector. I found a Enchanted Book and i was like: "You know what? Maybe there is a random enchantment on the enchanted book", but no, that didnt work. It was just a regular enchanted book without any enchantments on it. I tried modifying it, but it didnt work either. Please help
For anything involving NBT data, (potions, enchanted books, named items, damaged items, etc), you unfortunately have to manually alter the loot tables by locking the mod element and changing the code. For an enchantment, here's the before:
And here's after: (The list of enchantments you provide will be the list of possible enchantments, and the levels will also be randomized.)
You need to make sure you're using the correct registry names of the enchantments, (which you can find here). Microsoft also has a pretty decent list of loot table functions; it's intended for bedrock, but most of them work on Java edition too.