001 package net.minecraft.src; 002 003 public class ItemArmor extends Item 004 { 005 /** Holds the 'base' maxDamage that each armorType have. */ 006 private static final int[] maxDamageArray = new int[] {11, 16, 15, 13}; 007 008 /** 009 * Stores the armor type: 0 is helmet, 1 is plate, 2 is legs and 3 is boots 010 */ 011 public final int armorType; 012 013 /** Holds the amount of damage that the armor reduces at full durability. */ 014 public final int damageReduceAmount; 015 016 /** 017 * Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is 018 * iron, 3 is diamond and 4 is gold. 019 */ 020 public final int renderIndex; 021 022 /** The EnumArmorMaterial used for this ItemArmor */ 023 private final EnumArmorMaterial material; 024 025 public ItemArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) 026 { 027 super(par1); 028 this.material = par2EnumArmorMaterial; 029 this.armorType = par4; 030 this.renderIndex = par3; 031 this.damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4); 032 this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4)); 033 this.maxStackSize = 1; 034 this.setCreativeTab(CreativeTabs.tabCombat); 035 } 036 037 /** 038 * Return the enchantability factor of the item, most of the time is based on material. 039 */ 040 public int getItemEnchantability() 041 { 042 return this.material.getEnchantability(); 043 } 044 045 /** 046 * Returns the 'max damage' factor array for the armor, each piece of armor have a durability factor (that gets 047 * multiplied by armor material factor) 048 */ 049 static int[] getMaxDamageArray() 050 { 051 return maxDamageArray; 052 } 053 }