How would I get the type of an ItemStack?
I want to check if an item that a player is holding is a sword. So far, I have this.
ItemStack sword = gameRegistry.createItemBuilder()
.itemType(ItemTypes.IRON_SWORD)
.build();
if (p.getItemInHand().equals(sword)) {
// do this
}
But the reason why I need an item type instead of an ItemStack is because if the player is holding an ENCHANTED sword, then “p.getItemInHand().equals(sword)” will return FALSE because a normal iron sword ItemStack does not equal an enchanted iron sword ItemStack.
I want to get the ItemType instead so a non-enchanted iron sword and enchanted iron CAN be equal.