Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DECLERATIONS IN MOD_ FILE:
- public static final Item RHelmet = (new ItemArmorRedstone(1012,EnumArmorMaterial.REDSTONE, ModLoader.addArmor("redstone"), 0).setItemName("RHelmet"));
- public static final Item RChestplate = (new ItemArmorRedstone(1013,EnumArmorMaterial.REDSTONE, ModLoader.addArmor("redstone"), 1).setItemName("RChestplate"));
- public static final Item RLeggings = (new ItemArmorRedstone(1014,EnumArmorMaterial.REDSTONE, ModLoader.addArmor("redstone"), 2).setItemName("RLeggings"));
- public static final Item RBoots = (new ItemArmorRedstone(1015,EnumArmorMaterial.REDSTONE, ModLoader.addArmor("redstone"), 3).setItemName("RBoots"));
- // CONTENTS OF ITEMARMORREDSTONE
- package net.minecraft.src;
- public class ItemArmorRedstone extends ItemArmor
- {
- private static final int maxDamageArray[] =
- {
- 11, 16, 15, 13
- };
- /**
- * Stores the armor type: 0 is helmet, 1 is plate, 2 is legs and 3 is boots
- */
- public final int armorType;
- /** Holds the amount of damage that the armor reduces at full durability. */
- public final int damageReduceAmount;
- /**
- * Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is
- * iron, 3 is diamond and 4 is gold.
- */
- public final int renderIndex;
- /** The EnumArmorMaterial used for this ItemArmor */
- private final EnumArmorMaterial material;
- public ItemArmorRedstone(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4)
- {
- super(par1,par2EnumArmorMaterial,par3,par4);
- material = par2EnumArmorMaterial;
- armorType = par4;
- renderIndex = par3;
- damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4);
- setMaxDamage(par2EnumArmorMaterial.getDurability(par4));
- maxStackSize = 1;
- }
- /**
- * Return the enchantability factor of the item, most of the time is based on material.
- */
- public int getItemEnchantability()
- {
- return material.getEnchantability();
- }
- /**
- * Returns the 'max damage' factor array for the armor, each piece of armor have a durability factor (that gets
- * multiplied by armor material factor)
- */
- static int[] getMaxDamageArray()
- {
- return maxDamageArray;
- }
- }
- // CONTENTS OF ENUMARMORMATERIAL
- package net.minecraft.src;
- public enum EnumArmorMaterial
- {
- CLOTH(5, new int[] {
- 1, 3, 2, 1
- }, 15),
- CHAIN(15, new int[] {
- 2, 5, 4, 1
- }, 12),
- IRON(15, new int[] {
- 2, 6, 5, 2
- }, 9),
- GOLD(7, new int[] {
- 2, 5, 3, 1
- }, 25),
- DIAMOND(33, new int[] {
- 3, 8, 6, 3
- }, 10),
- REDSTONE(27, new int[] {
- 2, 7, 5, 3
- }, 25);
- /**
- * Holds the maximum damage factor (each piece multiply this by it's own value) of the material, this is the item
- * damage (how much can absorb before breaks)
- */
- private int maxDamageFactor;
- private int damageReductionAmountArray[];
- /** Return the enchantability factor of the material */
- private int enchantability;
- private EnumArmorMaterial(int par3, int par4ArrayOfInteger[], int par5)
- {
- maxDamageFactor = par3;
- damageReductionAmountArray = par4ArrayOfInteger;
- enchantability = par5;
- }
- /**
- * Returns the durability for a armor slot of for this type.
- */
- public int getDurability(int par1)
- {
- return ItemArmor.getMaxDamageArray()[par1] * maxDamageFactor;
- }
- /**
- * Return the damage reduction (each 1 point is a half a shield on gui) of the piece index passed (0 = helmet, 1 =
- * plate, 2 = legs and 3 = boots)
- */
- public int getDamageReductionAmount(int par1)
- {
- return damageReductionAmountArray[par1];
- }
- /**
- * Return the enchantability factor of the material.
- */
- public int getEnchantability()
- {
- return enchantability;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment