Solved Custom Enchantment book recipe

Discussion in 'Plugin Development' started by ZderKi, Jun 14, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    ZderKi

    So i created this custom recipe for an enchantment book, but it doesnt work in anvil and i cant apply this enchantment book to any item throught the anvil... any help?

    heres my code
    Code:
    {
                ItemStack item1 = new ItemStack(Material.ENCHANTED_BOOK, 1);
                ItemMeta meta1 = item1.getItemMeta();
    
                meta1.setDisplayName("Book of Sharpening");
                ArrayList<String> lore1 = new ArrayList<String>();
                //lore.add(ChatColor.GOLD + "");
                //meta1.setLore(lore1);
                meta1.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
              
                item1.setItemMeta(meta1);
    
                ShapedRecipe sharpnessbook = new ShapedRecipe(item1);
    
                sharpnessbook.shape("*  "," BB"," B%");
    
                sharpnessbook.setIngredient('*', Material.FLINT);
                sharpnessbook.setIngredient('%', Material.IRON_SWORD);
                sharpnessbook.setIngredient('B', Material.PAPER);
    
                getServer().addRecipe(sharpnessbook);
            }
    
     
    Last edited: Jun 14, 2019
  2. Offline

    Kars

    I could be wrong but try making the type Material.ENCHANTED_BOOK. Other than that i can't help you. I have no experience with custom enchants and items.
     
  3. Offline

    ZderKi

    tried that

    nvm solved it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2019
Thread Status:
Not open for further replies.

Share This Page