Ignore Ingredient Data Value in Shaped Recipe

Discussion in 'Plugin Development' started by GeekIWG, Jul 13, 2014.

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

    GeekIWG

    I am trying to write a plugin which adds a custom recipe (for sponge), using wool as one of the ingredients.
    The problem is I can only get it to use one color of wool. I need it to be able to accept all colors of wool.
    How can I get it to ignore the data value of the wool?
    Is it possible to accomplish this with the Bukkit API?

    Here is my current code:
    Code:java
    1. ShapedRecipe spongeRecipe = new ShapedRecipe(new ItemStack(Material.SPONGE));
    2.  
    3. spongeRecipe.shape("WsW", "sWs", "WsW")
    4. .setIngredient('W', new Wool(DyeColor.YELLOW)) //FIXME: accept any color
    5. .setIngredient('s', Material.STRING);
    6.  
    7. this.getServer().addRecipe(spongeRecipe);


    Thanks for any help you can give!
     
  2. Offline

    icewhisker

    having same kinda problem for different reason. I will tell u if i come up with a fix

    GeekIWG ok i fixed it

    Code:
    for (DyeColor color: DyeColor.values()) {
                ShapedRecipe spongeRecipe = new ShapedRecipe(new ItemStack(Material.SPONGE));
               
                spongeRecipe.shape("WsW", "sWs", "WsW")
                .setIngredient('W', new Wool(color))
                .setIngredient('s', Material.STRING);
               
                this.getServer().addRecipe(spongeRecipe);
            }
        }
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  3. Offline

    unon1100

  4. Offline

    icewhisker

    unon1100 im still kinda new to plugins so this is the best i could come up with
     
    bennie3211 likes this.
Thread Status:
Not open for further replies.

Share This Page