    001    package net.minecraft.src;
    002
    003    public enum EnumArmorMaterial
    004    {
    005        CLOTH(5, new int[]{1, 3, 2, 1}, 15),
    006        CHAIN(15, new int[]{2, 5, 4, 1}, 12),
    007        IRON(15, new int[]{2, 6, 5, 2}, 9),
    008        GOLD(7, new int[]{2, 5, 3, 1}, 25),
    009        DIAMOND(33, new int[]{3, 8, 6, 3}, 10);
    010
    011        /**
    012         * Holds the maximum damage factor (each piece multiply this by it's own value) of the material, this is the item
    013         * damage (how much can absorb before breaks)
    014         */
    015        private int maxDamageFactor;
    016
    017        /**
    018         * Holds the damage reduction (each 1 points is half a shield on gui) of each piece of armor (helmet, plate, legs
    019         * and boots)
    020         */
    021        private int[] damageReductionAmountArray;
    022
    023        /** Return the enchantability factor of the material */
    024        private int enchantability;
    025
    026        private EnumArmorMaterial(int par3, int[] par4ArrayOfInteger, int par5)
    027        {
    028            this.maxDamageFactor = par3;
    029            this.damageReductionAmountArray = par4ArrayOfInteger;
    030            this.enchantability = par5;
    031        }
    032
    033        /**
    034         * Returns the durability for a armor slot of for this type.
    035         */
    036        public int getDurability(int par1)
    037        {
    038            return ItemArmor.getMaxDamageArray()[par1] * this.maxDamageFactor;
    039        }
    040
    041        /**
    042         * Return the damage reduction (each 1 point is a half a shield on gui) of the piece index passed (0 = helmet, 1 =
    043         * plate, 2 = legs and 3 = boots)
    044         */
    045        public int getDamageReductionAmount(int par1)
    046        {
    047            return this.damageReductionAmountArray[par1];
    048        }
    049
    050        /**
    051         * Return the enchantability factor of the material.
    052         */
    053        public int getEnchantability()
    054        {
    055            return this.enchantability;
    056        }
    057
    058        /**
    059         * Return the crafting material for this armor material, used to determine the item that can be used to repair an
    060         * armor piece with an anvil
    061         */
    062        public int getArmorCraftingMaterial()
    063        {
    064            return this == CLOTH ? Item.leather.shiftedIndex : (this == CHAIN ? Item.ingotIron.shiftedIndex : (this == GOLD ? Item.ingotGold.shiftedIndex : (this == IRON ? Item.ingotIron.shiftedIndex : (this == DIAMOND ? Item.diamond.shiftedIndex : 0))));
    065        }
    066    }