Solved creating a custom recipe

Discussion in 'Plugin Development' started by rhunter, Oct 14, 2016.

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

    rhunter

    Why doesn't this work?
    Code:
    public ItemStack cocaine(ItemStack material, String name, List<String> lore) {
        //COCAINE
            ItemStack cocaine = new ItemStack(Material.SUGAR);
            ItemMeta cocaineMeta = cocaine.getItemMeta();
            cocaineMeta.setDisplayName("Cocaine");
            ArrayList<String> cocaineLore = new ArrayList<String>();
            cocaineLore.add("Drug");
            cocaineLore.add("Shift right-click to use");
            cocaineMeta.setLore(cocaineLore);
            ShapedRecipe cocaineRecipe = new ShapedRecipe(cocaine);
            cocaineRecipe.shape(new String[] { "1" }).setIngredient('1', Material.SUGAR);
            Bukkit.getServer().addRecipe(cocaineRecipe);
            return cocaine;
        }
     
  2. Offline

    Zombie_Striker

    @rhunter
    We don't know. You never told us what is wrong.

    A few tips though:
    1. "lore" is never used. Remove it.
    2. If you want to add the ability to turn sugar into cocain just by placing sugar anywhere, use ShapeLessRecipe
     
  3. Offline

    rhunter

    There are no errors, just nothing happens when i put sugar into a crafting table.
     
  4. Offline

    Zombie_Striker

    @rhunter
    Try the shapeless recipe. That may fix your issue.
     
Thread Status:
Not open for further replies.

Share This Page