Making custom recipe with customized items

Discussion in 'Spigot Plugin Development' started by Arest, Jul 14, 2015.

  1. So i tried to make a Custom Recipe with Customized Items like the recipes are :
    Snowball with the Name : "Legend Ball"
    And Stick with the name : "Legend Stick"
    So i readed ( not really gud at English ) a thread on google someone said :
    ItemStack helm = inv.getMatrix()[4]
    So can anyone explain what is matrix:
    And also can somone help me for the first step of reparing making own recipe cause i really dont know what should i do first ( I dont really know much about CraftingItemEvent and PrepareItemCraftEvent)
     
  2. And the matrix is getting the 4 armour slots that specific one I belive is getting the helmet in the players inventory, but remember that it can equal null
     
  3. I used to get Error once
     
  4. You used to get error? That doesn't matter, try adding custom recipe and then tell us what errors you do have
     
  5. Ok tks
     
  6. Here is the error :
    Code (Text):
    public void precipe() {
            ItemStack Fdp = new ItemStack(Material.DIAMOND_PICKAXE);
            ItemMeta fdpmeta = Fdp.getItemMeta();
            fdpmeta.setDisplayName(ChatColor.GOLD+"["+ ChatColor.AQUA + "FD" + ChatColor.GOLD + "]" + ChatColor.AQUA + "Diamond Pickaxe");
            Fdp.setItemMeta(fdpmeta);
         
            ItemStack s = new ItemStack(Material.SNOW_BALL);
            ItemMeta sm = s.getItemMeta();
            sm.setDisplayName(ChatColor.GRAY.BOLD + "Legendary Ball");
            sm.addEnchant(Enchantment.DURABILITY, 2, true);
            s.setItemMeta(sm);
         
            ItemStack stick = new ItemStack(Material.STICK);
            ItemMeta stm = stick.getItemMeta();
            stm.setDisplayName(ChatColor.GOLD.BOLD + "Golden Stick");
            stm.addEnchant(Enchantment.DURABILITY, 2, true);
            stick.setItemMeta(stm);
         
            ShapedRecipe pickrecipe = new ShapedRecipe(Fdp);
            pickrecipe.shape("AAA","1S1","1S1");
            pickrecipe.setIngredient('A', s);
            pickrecipe.setIngredient('S', stick);
        }

    }
     
    It happens when i use setIngredient at "s" and "stick" ( Legendary Ball , Golden Stick )
     
  7. What's the error? This is code..I can't see any errors
     
  8. Focus on pickrecipe.setIngredient('A',s); and pickrecipe.setIngredient('S', stick);
    upload_2015-7-14_8-42-7.png
     
  9. Just use Material.SNOW_BALL and Material.STICK instead of ItemStacks
     
  10. No !!! I want to add custom Enchantment and Name to the recipe of SNOW BALL AND STICK !!!
     
  11. Make a new thread