001 package net.minecraft.enchantment;
002
003 import net.minecraft.item.Item;
004 import net.minecraft.item.ItemArmor;
005 import net.minecraft.item.ItemBow;
006 import net.minecraft.item.ItemSword;
007 import net.minecraft.item.ItemTool;
008
009 public enum EnumEnchantmentType
010 {
011 all,
012 armor,
013 armor_feet,
014 armor_legs,
015 armor_torso,
016 armor_head,
017 weapon,
018 digger,
019 bow;
020
021 /**
022 * Return true if the item passed can be enchanted by a enchantment of this type.
023 */
024 public boolean canEnchantItem(Item par1Item)
025 {
026 if (this == all)
027 {
028 return true;
029 }
030 else if (par1Item instanceof ItemArmor)
031 {
032 if (this == armor)
033 {
034 return true;
035 }
036 else
037 {
038 ItemArmor var2 = (ItemArmor)par1Item;
039 return var2.armorType == 0 ? this == armor_head : (var2.armorType == 2 ? this == armor_legs : (var2.armorType == 1 ? this == armor_torso : (var2.armorType == 3 ? this == armor_feet : false)));
040 }
041 }
042 else
043 {
044 return par1Item instanceof ItemSword ? this == weapon : (par1Item instanceof ItemTool ? this == digger : (par1Item instanceof ItemBow ? this == bow : false));
045 }
046 }
047 }