Giving a player an enchanted book

Started by Coolmanz7 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Giving a player an enchanted book

I'm trying to give a player an enchanted book with a certain enchant on it(ex. Sharpness V). I currently am getting a book and enchanting it but it doesn't work like other enchantments and isn't able to enchant items via anvil. I did the same thing with the enchanted book item and got the same result. All of the other forums on this haven't gotten an answer. Is there any way to give the player an enchanted book that is able to be used in an anvil?

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
/give @p enchanted_book…
Sat, 02/03/2024 - 14:57

/give @p enchanted_book{StoredEnchantments:[{id:insert_your_enchantment_here,lvl:insert_level_here}]}

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That works perfectly. How…
Sat, 02/03/2024 - 22:35

That works perfectly. How would I make it a random enchantment without way too many if else statements?