Posted May 23, 201411 yr Is there any way of getting which armorType a player's held item is? As in, helmet, body, legs, boots.
May 23, 201411 yr 1. Refer to the ItemStack of player with getHeldItem() 2. Use getItem() 3. Check instanceof ItemArmor 4. Cast to ItemArmor and use the armorType property -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
May 23, 201411 yr Author That's what I tried, all of it works except for the final step. Can't get the armorType variable.
May 23, 201411 yr That's what I tried, all of it works except for the final step. Can't get the armorType variable. Then you didn't do the cast in step 4: (ItemArmor)item -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
May 23, 201411 yr ALSO, make sure your casting format it either ItemArmor armor=(ItemArmor)item; int type=armor.armorType; Or int type=((ItemArmor)Item).armorType;
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.