Jump to content

How to give player enchanted book

Casa Nuestra

Recommended Posts

Hello there, I have been trying to give the player an enchanted book but I realized that if I enchant the book, it is technically not an enchanted book so it does not work in an anvil. I am kind of new to forge modding so if anyone can please explain how to enchant an enchanted book so that it works in an anvil, that would be great!


ItemStack unbreak = new ItemStack(Items.ENCHANTED_BOOK);
unbreak.enchant(Enchantments.UNBREAKING, 2);


Link to comment
Share on other sites

6 hours ago, MFMods said:

i have no idea how you have an enchanted book that isn't and enchanted book.

By that I mean I have an "enchanted_book" item that has the enchantment as if it were the weapon instead of the item containing the enchantment. ex: a sharpness 5 "enchanted_book" would normally be able to enchant a sword but instead it just does more damageif you attack using the book.


6 hours ago, MFMods said:

anyway, there are mods that show you item's nbt. use one in creative mode to see what you want and compare it to what you have.

Alright, I will try that, thanks

Edited by Casa Nuestra
Link to comment
Share on other sites

well, i learned something about minecraft today.

anyway, just use EnchantedBookItem.addEnchantment() for books.

how am i so incredibly knowledgeable? well i just placed a cursor on Items.ENCHANTED_BOOK, hit alt+F7 (search for references) and found one occurrence with the answer.

edit: oh and start with book book, not the enchanted book.

Edited by MFMods
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.