How do i get item/block sub id? (eg. Colored Wools Color No.s)

Discussion in 'Plugin Development' started by EvilPeanut, Oct 15, 2011.

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

    EvilPeanut

    How do i get the sub id of an item from an item stack eg.
    Wool (colored)
    Sapplings
    Dyes

    And then how would i let the user spawn, lets say 50 green wool?

    Thanks,
    EvilPeanut
     
  2. Offline

    coldandtired

    Code:
    ItemStack stack = new ItemStack(code, amount, damage);
    player.getInventory().addItem(stack);
    Where code is the data value (35 for wool, I believe), amount the number of items to spawn, and damage is the value which decides the colour/type of tree, etc.
     
  3. Offline

    EvilPeanut

    Ok ty,
    How do i get damage from an item stack?
     
  4. Offline

    coldandtired

    Call the getDurability() method on an Itemstack.

    By the way, the damage must be a Short, not an Integer.
     
Thread Status:
Not open for further replies.

Share This Page