Custom recipe with custom default damage

Discussion in 'Spigot Plugin Development' started by Strum, May 26, 2018.

  1. Hi so I made a custom recipe for a diamond axe and I was wondering if there a way to change the default attack damage of the diamond axe to 7 default damage (like a diamond sword).
    Thanks for the help

    Strum.
     
  2. Praya

    Benefactor

    change the NBT "generic.attackDamage" to 7
     
  3. I have never worked with NBT editing but I tried setting it up but it's not working for me:



    Code (Java):
    ItemStack Axe = new ItemStack(Material.DIAMOND_AXE);
           
                    NBTItem nbti = new NBTItem(Axe);
                    NBTList attribute = nbti.getList("AttributeModifiers", NBTType.NBTTagCompound);
                    NBTListCompound attr = attribute.addCompound();
                   
                   
                   
                   
                    ShapedRecipe Recipee = new ShapedRecipe(Axe);
                   
                    //1
               
                    Recipee.shape("%% ","%& "," & ");
               
               
                   
                    Recipee.setIngredient('%', Material.DIAMOND_BLOCK);
                    Recipee.setIngredient('&', Material.STICK);
                   
                   
                    this.getServer().addRecipe(Recipee);    
     
  4. anyone have an idea or can teach how it works please?
     
  5. Can someone please help meeeee.