Solved Adding recipes with a display name

Discussion in 'Plugin Development' started by iliasdewachter, May 10, 2013.

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

    iliasdewachter

    Hi all,

    I created a new recipe that creates "Jungle Sticks":
    Code:
    ItemStack is = new ItemStack(Material.STICK, 4);
    ItemMeta im = is.getItemMeta();
    im.setDisplayName("Jungle Stick");
    is.setItemMeta(im);
    Shaped Recipe recipe = new ShapedRecipe(is);
    Material Data md = new MaterialData(5, (byte) 3);
    recipe.shape(new String[] {"W","W"});
    recipe.setIngredient('W', md);
    getServer().addRecipe(recipe);
    But how can I create a new recipe with reagents with a display name?
    This is what I've tried:
    Code:
    im.setDisplayName("AAApple");
    is.setType(Material.APPLE);
    is.setItemMeta(im);
    recipe = new ShapedRecipe(is);
    im.setDisplayName("Jungle Stick");
    is.setItemMeta(im);
    is.setType(Material.STICK);
    md = is.getData();
    recipe.shape(new String[] {"W","W"});
    recipe.setIngredient('W', md);
    getServer().addRecipe(recipe);
    Any idea's?
     
  2. Offline

    Me4502

    To do this you need to check on CraftItemEvent, and check if the 2 recipes are the same, if they are... Then you set the display name at this stage.
     
  3. Offline

    iliasdewachter

    It works, thanks mate :)
     
Thread Status:
Not open for further replies.

Share This Page