New to java, need help with shaped recipes

Discussion in 'Plugin Development' started by hoticecube, Apr 1, 2012.

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

    hoticecube

    I've looked at the javadoc for it, but I still don't understand how to define what items go in which rows in a recipe. If someone could help/provide example with little to no comment on my lack of programming skills I would be very grateful.
     
  2. Offline

    surtic

    Here a bit of code :)

    PHP:
    // Recipe
            
    ShapedRecipe goldenApple = new ShapedRecipe( new ItemStack(Material.GOLDEN_APPLE1)).shape(new String[] { "ggg""gag""ggg" }).setIngredient('g'Material.GOLD_INGOT).setIngredient('a'Material.APPLE);
            
    plugin.getServer().addRecipe(goldenApple);
    You can set a Material for a letter.
     
    ferrybig likes this.
  3. Offline

    hoticecube

    Thank you very much :) that was very helpful.

    I'm now trying to set up a command so when you type in /recipe it'll say what recipes are loaded with this plugin, I have the code:

    but when I load the plugin and type in "/recipe" it returns only:
    /recipe

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  4. Did you add it to the plugin.yml?
     
  5. Offline

    hoticecube

  6. Offline

    koekie_save

    I want my players to be able to make sponge using 8 yellow wool and a bucket but how can I make ik so that they can only use yellow wool? Here is my code
    Code:java
    1. ShapedRecipe sponge = new ShapedRecipe(new ItemStack(Material.SPONGE))
    2. .shape("***", "*%*", "***")
    3. .setIngredient('*', Material.WOOL)
    4. .setIngredient('%', Material.BUCKET);
     
Thread Status:
Not open for further replies.

Share This Page