001package net.minecraft.enchantment; 002 003import net.minecraft.item.Item; 004import net.minecraft.item.ItemArmor; 005import net.minecraft.item.ItemBow; 006import net.minecraft.item.ItemSword; 007import net.minecraft.item.ItemTool; 008 009public 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 itemarmor = (ItemArmor)par1Item; 039 return itemarmor.armorType == 0 ? this == armor_head : (itemarmor.armorType == 2 ? this == armor_legs : (itemarmor.armorType == 1 ? this == armor_torso : (itemarmor.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}