Custom Enchantment ID on Book That Can Be Combined In An Anvil?

Custom Enchantment ID on Book That Can Be Combined In An Anvil? - From above of crop unrecognizable female soothsayer with magic ball near tarot cards and candles during divination process in house

I have a command block system which checks if the user is holding a diamond pickaxe with a custom enchantment, and if so, performs some actions. I'm using a custom enchantment ID of 98 simply because unlike names, it can't be faked by a player without cheats, and because Minecraft ignores any non-standard properties rather than storing them. This part all works fine, and holding a diamond pick with enchantment 98 does what it's supposed to do.

Now, I'd like to give the player a way to actually obtain Enchantment 98. Obviously, it can't be added to the enchanting table's list (can it?), so instead, I'm making it a "treasure enchantment", obtainable in enchanted book form in loot chests. But that's become a problem. I can easily create an enchanted book with a StoredEnchantments ID of 98, but if I try to combine it with a pickaxe in an anvil, it won't let me combine it.

So how can I make an enchanted book that stores a custom enchantment ID (such as 98) but which can still be combined with tools in an anvil to apply that enchantment to it?



Best Answer

Here's an option. Make the enchanted books have an enchant that is applicable to the tool you want, but a high level that is possible to obtain in vanilla (i.e unbreaking 7), then after it's combined, check for any tool in a players hand with that enchant, and replace it with your 98.




Pictures about "Custom Enchantment ID on Book That Can Be Combined In An Anvil?"

Custom Enchantment ID on Book That Can Be Combined In An Anvil? - Crop anonymous female soothsayer with magic ball near shiny candle during divination process at home
Custom Enchantment ID on Book That Can Be Combined In An Anvil? - Crop fortune teller reading magic book at table with candles
Custom Enchantment ID on Book That Can Be Combined In An Anvil? - From above back view of crop unrecognizable female soothsayer with magic book at table with tarot cards at home



Can you combine enchantments with anvil?

Combining items. The anvil can be used to combine two items of the same type and material, or an item with an enchanted book. This applies only to items with durability: weapons, shields, tools, and armor, as well as enchanted books.

Can enchantment books be combined?

Enchanted books themselves can be combined to create a single book with increased or multiple enchantments, similar to combining tools or weapons. When combining items, the compatible enchantments from the book in the second slot are transferred to the item from the first slot, keeping the highest level of any type.

Can you combine an enchanted book with an enchanted item?

Combining Enchantments Once an item is enchanted, it can't be further enchanted using an Enchanting Table. However, you can combine two enchanted items, or add a second enchantment from an enchanted book, using anAnvil. You can also combine the enchantments from two books together into a new double-enchanted book.

How do you combine enchanted books with different enchantments?

Steps to Increase the Level of an Enchanted Book
  • Place the Anvil. Once you have two enchanted books that are the same and an anvil, add the anvil to your hotbar so that it is an item that you can use. ...
  • Use the Anvil. ...
  • Combine the Enchanted Books. ...
  • Move the Enchanted Item to Inventory.




  • Minecraft Enchanting: You use Anvils WRONG :(




    More answers regarding custom Enchantment ID on Book That Can Be Combined In An Anvil?

    Answer 2

    I know of two ways to achieve this. Both make use of a Command Block.

    The easiest way: You can give the enchanted pickaxe to the players

    /give @p diamond_pickaxe 1 0 {ench:[{id:98,lvl:1}]}
    

    or if they have (hold!) a normal pickaxe you can enchant it directly

    /enchant @p 98 1
    

    The 2nd way would require a separate /testfor command, though. Otherwise you could even enchant a bone. This is testable, too...

    There are probably better ways for this, but this should do the trick.

    /testfor @p {Inventory:[{Slot:0b,id:"minecraft:diamond_pickaxe"}],SelectedItemSlot:0}
    

    (this would require to have a diamond pickaxe in your first item slot and also hold it.)

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Anete Lusina, Anete Lusina, Anete Lusina, Anete Lusina