how to give the player an enchanted book?

Started by Hercules1080 on

Topic category: Help with modding (Java Edition)

Last seen on 18:14, 1. Apr 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to give the player an enchanted book?

I am trying to make a mod where you can get a mystery enchanted book, and when you right-click with it in your main hand, it's supposed to give you a random enchanted book. I did this by replacing the item in your main hand to an enchanted book, then adding a random enchantment. Here's the problem: It literally enchants the book! If it has silk touch and you mine a grass block with the book, it'll drop a grass block. same works with sharpness, fire aspect, and any other enchantment. I can't even use these books to enchant stuff in an anvil, because they technically don't have any enchantments on them. The book items themselves are enchanted though. Any help would be greatly appreciated. Thanks!