001package net.minecraft.item;
002
003import net.minecraft.block.Block;
004
005public enum EnumToolMaterial
006{
007    WOOD(0, 59, 2.0F, 0, 15),
008    STONE(1, 131, 4.0F, 1, 5),
009    IRON(2, 250, 6.0F, 2, 14),
010    EMERALD(3, 1561, 8.0F, 3, 10),
011    GOLD(0, 32, 12.0F, 0, 22);
012
013    /**
014     * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
015     */
016    private final int harvestLevel;
017
018    /**
019     * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
020     */
021    private final int maxUses;
022
023    /**
024     * The strength of this tool material against blocks which it is effective against.
025     */
026    private final float efficiencyOnProperMaterial;
027
028    /** Damage versus entities. */
029    private final int damageVsEntity;
030
031    /** Defines the natural enchantability factor of the material. */
032    private final int enchantability;
033
034    //Added by forge for custom Armor materials.
035    public Item customCraftingMaterial = null;
036
037    private EnumToolMaterial(int par3, int par4, float par5, int par6, int par7)
038    {
039        this.harvestLevel = par3;
040        this.maxUses = par4;
041        this.efficiencyOnProperMaterial = par5;
042        this.damageVsEntity = par6;
043        this.enchantability = par7;
044    }
045
046    /**
047     * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
048     */
049    public int getMaxUses()
050    {
051        return this.maxUses;
052    }
053
054    /**
055     * The strength of this tool material against blocks which it is effective against.
056     */
057    public float getEfficiencyOnProperMaterial()
058    {
059        return this.efficiencyOnProperMaterial;
060    }
061
062    /**
063     * Damage versus entities.
064     */
065    public int getDamageVsEntity()
066    {
067        return this.damageVsEntity;
068    }
069
070    /**
071     * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
072     */
073    public int getHarvestLevel()
074    {
075        return this.harvestLevel;
076    }
077
078    /**
079     * Return the natural enchantability factor of the material.
080     */
081    public int getEnchantability()
082    {
083        return this.enchantability;
084    }
085
086    /**
087     * Return the crafting material for this tool material, used to determine the item that can be used to repair a tool
088     * with an anvil
089     */
090    public int getToolCraftingMaterial()
091    {
092        switch (this)
093        {
094            case WOOD:    return Block.planks.blockID;
095            case STONE:   return Block.cobblestone.blockID;
096            case GOLD:    return Item.ingotGold.itemID;
097            case IRON:    return Item.ingotIron.itemID;
098            case EMERALD: return Item.diamond.itemID;
099            default:      return (customCraftingMaterial == null ? 0 : customCraftingMaterial.itemID);
100        }
101    }
102}