Posted June 24, 20232 yr 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! Code: ItemStack unbreak = new ItemStack(Items.ENCHANTED_BOOK); unbreak.enchant(Enchantments.UNBREAKING, 2); player.addItem(unbreak); Thanks
June 25, 20232 yr i have no idea how you have an enchanted book that isn't and enchanted book. 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.
June 25, 20232 yr Author 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 June 25, 20232 yr by Casa Nuestra
June 25, 20232 yr 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 June 25, 20232 yr by MFMods
June 26, 20232 yr You have effectively enchanted the already enchanted book instead of adding the enchantment.
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.