Giving players colored wool

Discussion in 'Plugin Development' started by EpicX112, Feb 24, 2012.

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

    EpicX112

    I am trying to give players different colored wool. I give other items with just their id, but because of the different colors, the data values are 35:1, 35:2 ....

    I tried changing my method of doing this by making the item stack i give them be initialized with the block material. This only gives white wool:

    PHP:
    Wool wool = new Wool(DyeColor.BROWN);
    Material blockMat wool.getItemType();
    ItemStack newItem = new ItemStack(blockMat10);
    Are there decimal values for colored wool, or is there a way to get the material equal to a colored wool?
     
  2. Offline

    Shamebot

    Code:
    ItemStack stack = new ItemStack(Material.WOOL, amount).setData(new Wool(DyeColor.BROWN));
     
  3. Offline

    EpicX112

    Thanks for the help but this gives me the error "cannot convert from void to itemstack". So I tried to do this:
    PHP:
    ItemStack newItem = new ItemStack(Material.WOOLbuyAMT);
    newItem.setData(new Wool(DyeColor.BROWN));
    This still just gives me white wool
     
  4. Offline

    Ice_Sword

    Wool color is determined by damage value I believe. Give them wool with a different damage value.
     
  5. Offline

    EpicX112

    Sorry, new to the API, how do you do that? Thanks for the tip though :)
     
  6. Offline

    Njol

    new ItemStack(Material.WOOL, buyAMT, 0, DyeColor.BROWN.getData());
     
  7. Offline

    Shamebot

    What color has the wool if you place it?
    Code:
    ItemStack newItem = new ItemStack(Material.WOOL, buyAMT);
    Wool wool = new Wool(DyeColor.BROWN);
    newItem.setDurability(wool.getData);
    But there seems to be an easier way:
    Code:
    Wool wool = new Wool(DyeColor.BROWN);
    ItemStack stack = wool.toItemStack(amount);
     
    legoman519 and EpicX112 like this.
  8. Offline

    EpicX112

    Works! Thank you very much
     
Thread Status:
Not open for further replies.

Share This Page