Adding recipes, and overriding an existing one.

Discussion in 'Plugin Development' started by MrCyberMonkey, Feb 19, 2013.

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

    MrCyberMonkey

    Hello, I've recently begun working on a plugin for a project, and I need to overwrite an existing recipe, in this example I'll use the IRON_LEGGINGS changed to CHAINMAIL_LEGGINGS .
    Code:
    @Override
    public void onEnable() {
     
    ShapedRecipe cPants = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
    cPants.shape("III", "I I", "I I");
    cPants.setIngredient('I', Material.IRON_INGOT);
    getServer().addRecipe(cPants);
     
    }
    Now, when I go into the server and craft my wonderful pair of CHAINMAIL_LEGGINGS the result is still a pair of CHAINMAIL_LEGGINGS.
     
  2. Offline

    ZachBora

    Have you tried to use
    Iterator<Recipe> it = getServer().recipeIterator();
    to check for the existing recipes with it.next()? then use it.remove();

    I haven't tried it, just throwing this out there.
     
Thread Status:
Not open for further replies.

Share This Page