Advertisement
drackiseries

New Armor

Jun 24th, 2012
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.01 KB | None | 0 0
  1. MOD_FILE CONTENTS:
  2.  
  3.  
  4. package net.minecraft.src;
  5.  
  6. import java.util.Random;
  7.  
  8. public class mod_tutorial extends BaseMod
  9. {
  10.    
  11.     //Blocks
  12.    
  13.     //Items
  14.    
  15.     public static final Item RHelmet = (new ItemArmorRedstone(1012,EnumArmorMaterial.DIAMOND, ModLoader.addArmor("redstone"), 0).setItemName("RHelmet"));
  16.     public static final Item RChestplate = (new ItemArmorRedstone(1013,EnumArmorMaterial.DIAMOND, ModLoader.addArmor("redstone"), 1).setItemName("RChestplate"));
  17.     public static final Item RLeggings = (new ItemArmorRedstone(1014,EnumArmorMaterial.DIAMOND, ModLoader.addArmor("redstone"), 2).setItemName("RLeggings"));
  18.     public static final Item RBoots = (new ItemArmorRedstone(1015,EnumArmorMaterial.DIAMOND, ModLoader.addArmor("redstone"), 3).setItemName("RBoots"));
  19.    
  20.    
  21.    
  22.  
  23.     public void load()
  24.     {
  25.        
  26.         RHelmet.iconIndex = ModLoader.addOverride("/gui/items.png","/Items/redstonehelmet.png");
  27.         RChestplate.iconIndex = ModLoader.addOverride("/gui/items.png","/Items/redstonechestplate.png");
  28.         RLeggings.iconIndex = ModLoader.addOverride("/gui/items.png","/Items/redstoneleggings.png");
  29.         RBoots.iconIndex = ModLoader.addOverride("/gui/items.png","/Items/redstoneboots.png");
  30.    
  31.         //Registering
  32.        
  33.         //Adding names
  34.    
  35.         ModLoader.addName(RHelmet, "Redstone Helmet");
  36.         ModLoader.addName(RChestplate, "Redstone Chestplate");
  37.         ModLoader.addName(RLeggings, "Redstone Leggings");
  38.         ModLoader.addName(RBoots, "Redstone Boots");
  39.        
  40.         //Crafting Recipes
  41.        
  42.         //Smelting Recipes
  43.        
  44.         //Shapeless Recipes
  45.        
  46.         ModLoader.addShapelessRecipe(new ItemStack(mod_tutorial.RHelmet, 1), new Object[]
  47.                 {
  48.                     Item.seeds          //Crafting Line
  49.                 });
  50.         ModLoader.addShapelessRecipe(new ItemStack(mod_tutorial.RChestplate, 1), new Object[]
  51.                 {
  52.                     Item.seeds,Item.seeds           //Crafting Line
  53.                 });
  54.         ModLoader.addShapelessRecipe(new ItemStack(mod_tutorial.RLeggings, 1), new Object[]
  55.                 {
  56.                     Item.seeds,Item.seeds,Item.seeds            //Crafting Line
  57.                 });
  58.         ModLoader.addShapelessRecipe(new ItemStack(mod_tutorial.RBoots, 1), new Object[]
  59.                 {
  60.                     Item.seeds,Item.seeds,Item.seeds,Item.seeds         //Crafting Line
  61.                 });
  62.        
  63.        
  64.     }
  65.    
  66.    
  67.     public String getVersion()
  68.     {
  69.         return "1.2.5";
  70.     }
  71. }
  72.  
  73. ITEMARMORREDSTONE FILE CONTENTS:
  74.  
  75.  
  76. package net.minecraft.src;
  77.  
  78. public class ItemArmorRedstone extends ItemArmor
  79. {
  80.     private static final int maxDamageArray[] =
  81.     {
  82.         11, 16, 15, 13
  83.     };
  84.  
  85.     /**
  86.      * Stores the armor type: 0 is helmet, 1 is plate, 2 is legs and 3 is boots
  87.      */
  88.     public final int armorType;
  89.  
  90.     /** Holds the amount of damage that the armor reduces at full durability. */
  91.     public final int damageReduceAmount;
  92.  
  93.     /**
  94.      * Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is
  95.      * iron, 3 is diamond and 4 is gold.
  96.      */
  97.     public final int renderIndex;
  98.  
  99.     /** The EnumArmorMaterial used for this ItemArmor */
  100.     private final EnumArmorMaterial material;
  101.  
  102.     public ItemArmorRedstone(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4)
  103.     {
  104.         super(par1,par2EnumArmorMaterial,par3,par4);
  105.         material = par2EnumArmorMaterial;
  106.         armorType = par4;
  107.         renderIndex = par3;
  108.         damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4);
  109.         setMaxDamage(par2EnumArmorMaterial.getDurability(par4));
  110.         maxStackSize = 1;
  111.     }
  112.  
  113.     /**
  114.      * Return the enchantability factor of the item, most of the time is based on material.
  115.      */
  116.     public int getItemEnchantability()
  117.     {
  118.         return material.getEnchantability();
  119.     }
  120.  
  121.     /**
  122.      * Returns the 'max damage' factor array for the armor, each piece of armor have a durability factor (that gets
  123.      * multiplied by armor material factor)
  124.      */
  125.     static int[] getMaxDamageArray()
  126.     {
  127.         return maxDamageArray;
  128.     }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement