Crafting recipe with colored wool?

Discussion in 'Plugin Development' started by PauleFaule, Dec 12, 2013.

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

    PauleFaule

    Dear Community,

    i've already spent a couple of days searching without any result. Could you help me with my problem?

    I created some crafting recipes on my own bukkit-server and one of these is a horse barding. But my problem is the colored wool, because all of these codes like
    ItemStack redwool = new ItemStack( Material.WOOL, 1, (byte)4 )
    don't work within a crafting recipe.

    My code for the diamond_barding is:

    ItemStack Item2 = new ItemStack(Material.DIAMOND_BARDING);
    ItemMeta meta2 = Item2.getItemMeta();
    Item2.setItemMeta(meta2);
    ShapedRecipe recipe2 = new ShapedRecipe(Item2);
    recipe2.shape("00D", "BWD", "BBB");
    recipe2.setIngredient('D', Material.DIAMOND);
    recipe2.setIngredient('W', Material.WOOL);
    recipe2.setIngredient('B', Material.DIAMOND_BLOCK);
    Bukkit.addRecipe(recipe2);


    I would like to replace the usual wool with a blue wool, so it will look more ralistic.
    If you know any solution, PLEASE HELP!

    Thanks inn advance,
    PauleFaule
     
  2. Offline

    np98765

    Moved to Plugin Development.
     
  3. Offline

    AoH_Ruthless

    PauleFaule
    Code:java
    1. recipe2.setIngredient('W', Material.WOOL, 11);

    It's deprecated, but I'm pretty sure it will accept blue wool (Damage 11) and not any other color.
     
  4. Offline

    JRL1004

    PauleFaule I'm not is if the works or not (if it doesn't then just do with AoH_Ruthless 's thing):
    Code:java
    1. public ItemStack ColouredWool(DyeColor color, int amount) {
    2. ItemStack wool = new Wool(color).toItemStack(amount);
    3. return wool;
    4. }
     
  5. Offline

    AoH_Ruthless

    JRL1004
    I don't think it will work because ItemStacks aren't usable for Crafting recipes (has to be Materials only)
     
    JRL1004 likes this.
  6. Offline

    JRL1004

  7. Offline

    PolarCraft

    JRL1004 Why not do a metadata value.
     
  8. Offline

    JRL1004

    PolarCraft I suck at metadata so I tend to avoid it
     
  9. Offline

    PolarCraft

    JRL1004 Do this.
    Code:java
    1. short data = DATAVALUE(#);
    2. ItemStack NAME = new ItemStack(Material.WOOL);
    3. NAME.setDurability(data);
     
  10. Offline

    JRL1004

    PolarCraft Umm, I'm not the thread creator, PauleFaule is (assuming you want the thread creator to do that).
     
  11. Offline

    PolarCraft

    JRL1004 Oops yeah lel. But still that should work ^^
     
  12. Offline

    AoH_Ruthless

    PolarCraft
    Again, that won't work for the issue at hand because crafting recipe uses Material, not ItemStack.
     
  13. Offline

    PolarCraft

    AoH_Ruthless You wold do NAME.getdata() instead of Material.WHATEVER()
     
  14. Offline

    AoH_Ruthless

    PolarCraft
    Ahh I see what you are saying now.
    That might be better than what I suggested because your way isn't deprecated :)
     
  15. Offline

    PauleFaule

    AoH_Ruthless & everyone else who replied:

    THANK YOU!

    I always thought that deprecated stuff wouldn't work, but it does. I thought this was too easy...

    Now I got a second question about potions within craftingrecipes. Shall I open another thread?

    EDIT: The potion-problem is solvable the same way, so thank you again AoH_Ruthless
     
Thread Status:
Not open for further replies.

Share This Page