Get Full Item ID From ItemStack? Ex. 35:10

Discussion in 'Plugin Development' started by NerdsWBNerds, Dec 28, 2011.

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

    NerdsWBNerds

    So I'm trying to make a plugin and it requires the full ItemID so that I can, for example, tell what color wool it is!

    How can I return the full ItemID such as 35:10 (Purple Wool)
    Where as right now it just returns 35 (Wool)

    Please help.
     
  2. Offline

    tomjw64

    getItemId should provide the 35 part and getData for ItemStack should return the 10 part if I'm not mistaken.
     
  3. Offline

    NerdsWBNerds

  4. Offline

    tomjw64

    No problem! :D
     
  5. Offline

    skore87

    the .getData() will return a byte value i believe, so you might want to convert that into an Int, depending how you're using it.
     
  6. Offline

    bergerkiller

    Actually, getData returns a MaterialData class. You need to use getData() on that again the get the byte data type.
    But, since getData() can return null (I've seen it happening), you may need to add some checks too.

    Also, item.getDurability() returns this ID as well, as it reflects the getData() if used with things like wool.
     
Thread Status:
Not open for further replies.

Share This Page