Solved Recipe not working

Discussion in 'Plugin Development' started by Rprrr, Jan 16, 2013.

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

    Rprrr

    Hi,

    I'm creating a recipe that will give you a renamed staff. I've made the renamed staff and made the recipe, but when I try to craft it in game nothing shows up in the crafting window..

    My code:
    Code:
        public static void addRecipes(){
            ItemStack sstaff = new ItemStack(Material.STICK, 1,(short) 40); //Simple Staff
         
            ItemMeta smeta = sstaff.getItemMeta();
     
            smeta.setDisplayName(ChatColor.GOLD + "Simple Staff");
     
            List<String> slr = Arrays.asList("Simple staff that does nothing.");
            smeta.setLore(slr);
     
            sstaff.setItemMeta(smeta);
     
            ShapelessRecipe sr = new ShapelessRecipe(sstaff);
     
            sr.addIngredient(3, Material.DIAMOND);
            sr.addIngredient(3, Material.EXP_BOTTLE);
            sr.addIngredient(1, Material.STICK);
     
            Bukkit.getServer().addRecipe(sr);
      }
    I call this method in my onEnable().

    Does anyone know what to do? Thanks in advance!
     
  2. Offline

    Craftiii4

    Well, on a quick look it appears that your setting diamond and exp bottles to the same slot?
     
  3. Offline

    fireblast709

    The code works fine for me. Are you sure the code is getting called?
    Its a ShapelessRecipe, in which case the first integer is the amount, not the slot
     
    Craftiii4 likes this.
  4. Offline

    Rprrr

    Well, thanks for the suggestion though Craftiii. :p
    Anyway, I just saw that I've made some mistakes in making other crafting recipies (I tried to add more than 9 ingredients), and that blocked this ingredient from being added to the server.. so yeah, the code was right, it was just another thing that was causing this problem.

    Sorry for wasting your time!
     
  5. Offline

    Craftiii4

    Ah okay, I have never added a recipe before, well not recently any ways. Thanks :p
     
Thread Status:
Not open for further replies.

Share This Page