Using Enchantment nbt tag in json recipe

//ads -- adsterra.com -- native banner
?>
I'm making a mod in 1.12.2 and I want to create a recipe when a sword + an enchanted book makes the same type of sword but with the enchants of the enchanted books. (diamond sword + an enchanted book of sharpness level 4 or 5 makes an diamond sword enchanted sharpness 6)
{
"type": "minecraft:crafting_shaped",
"group": "enchanted_swords",
"pattern": [
"P",
"B"
],
"key": {
"P": [
{
"type": "minecraft:item_nbt",
"item": "minecraft:enchanted_book",
"nbt": {
"StoredEnchantments":
"id": 16
"level": 4
}
},
{
"type": "minecraft:item_nbt",
"item": "minecraft:enchanted_book",
"nbt": {
"StoredEnchantments":
"id": 16
"level": 5
}
}
],
"B": {
"item": "minecraft:water_bucket"
}
},
"result": {
"type": "minecraft:item_nbt",
"item": "minecraft:water_bucket",
"nbt": {
"StoredEnchantments":
"id": 16
"level": 6
"count": 1
}
}
I tried to use this link but it only showed for potions so I had to try using the enchanted book wiki but it showed the patern in words not in code so I need help please
Pictures about "Using Enchantment nbt tag in json recipe"



How do you use NBT tags in Minecraft?
NBT tags are used in game commands such as: /summon, /data, /give, /fill, /setblock. The NBT tag is always surrounded in {} such as {NoAI:1}. If there is more than one NBT tag used in a command, the NBT tags are separated by a comma such as {NoAI:1, IsBaby:1}. Each entity (or mob) has its own unique set of NBT tags.How do you show NBT tags in Minecraft?
Item NBT. To see an Item NBT tag just activate the advanced tooltips by pressing F3+H, the tag will appear inside the tooltip. Longer tags will be presented in an auto scrolling view, the scroll speed can be controlled with SHIFT, to pause scrolling, and ALT, to speed it up.How do you give enchanted items?
How to enchant items in MinecraftSources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: EKATERINA BOLOVTSOVA, Nur Andi Ravsanjani Gusma, Ono Kosuki, Ono Kosuki