addIngrdient and (shorts)

Discussion in 'Plugin Development' started by JellyYods, Jul 6, 2014.

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

    JellyYods

    Alright I am making a plugin to where if you put a piece of coal and a raw piece of food it will give you a cooked piece of food, but the problem is I'm on my last food which is a raw salmon. I added it and it says "The method addIngredient(Material, int) in the type ShapelessRecipe is not applicable for the arguments (Material, int, short)". Before I get can I see your plugin.yml or is your stuff registered because it is I did it with ores and coal then started with the food. Heres the code.

    Code:java
    1. ItemStack salmon = new ItemStack(Material.COOKED_FISH, 1, (short) 1);
    2. ItemMeta cookedSalmon = (ItemMeta)salmon.getItemMeta();
    3. cookedSalmon.setDisplayName(ChatColor.RESET + "Cooked Salmon");
    4. salmon.setItemMeta(cookedSalmon);
    5.  
    6. ShapelessRecipe salmonRecipe = new ShapelessRecipe(salmon)
    7. .addIngredient(Material.COAL).
    8. addIngredient(Material.RAW_FISH, 1, (short) 1);
    9. Bukkit.addRecipe(salmonRecipe);
     
  2. Offline

    techboy291

    I'm guessing this is what you might want. That error basically just means that there's no method that takes those types in that order. Whenever you see that, just look at the javadoc to find the method that best suits what you want.
     
  3. Offline

    JellyYods

  4. Offline

    techboy291

    JellyYods What do you mean? Did you replace
    Code:
    addIngredient(Material.RAW_FISH, 1, (short) 1)
    with

    Code:
    addIngredient(1, Material.RAW_FISH, 1)
     
Thread Status:
Not open for further replies.

Share This Page