Advertisement
Guest User

Untitled

a guest
Sep 12th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. package mymod.armor;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.minecraft.client.renderer.texture.IconRegister;
  6. import net.minecraft.creativetab.CreativeTabs;
  7. import net.minecraft.entity.Entity;
  8. import net.minecraft.item.EnumArmorMaterial;
  9. import net.minecraft.item.ItemArmor;
  10. import net.minecraft.item.ItemStack;
  11.  
  12. public class MyArmor extends ItemArmor{
  13.  
  14. private String texturePath = "mymod:textures/armor/";
  15. private String iconPath = "mymod:";
  16.  
  17. public MyArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4, String myArmorName) {
  18. super(par1, par2EnumArmorMaterial, par3, par4);
  19. this.setMaxStackSize(1);
  20. this.setCreativeTab(CreativeTabs.tabCombat);
  21. this.SetArmorType(myArmorName, par4);
  22. }
  23.  
  24.  
  25. private void SetArmorType(String myArmorName, int par4)
  26. {
  27. switch(par4)
  28. {
  29. case 0:
  30. this.setUnlocalizedName("MyHelmet_1");
  31. this.texturePath += myArmorName + "_1.png";
  32. this.iconPath += "MyHelmet_1";
  33. break;
  34. case 1:
  35. this.setUnlocalizedName("MyChest_1");
  36. this.texturePath += myArmorName + "_1.png";
  37. this.iconPath += "MyChest_1";
  38. break;
  39. case 2:
  40. this.setUnlocalizedName("MyLeggings_1");
  41. this.texturePath += myArmorName + "_2.png";
  42. this.iconPath += "MyLeggings_1";
  43. break;
  44. case 3:
  45. this.setUnlocalizedName("MyBoots_1");
  46. this.texturePath += myArmorName + "_1.png";
  47. this.iconPath += "MyBoots_1";
  48. break;
  49. }
  50. }
  51.  
  52. @SideOnly(Side.CLIENT)
  53. public void registerIcons(IconRegister reg)
  54. {
  55. this.itemIcon = reg.registerIcon(this.iconPath);
  56. }
  57.  
  58. public String getArmorTexture(ItemStack stack, Entity entity, int layer, int slot)
  59. {
  60. return this.texturePath;
  61. }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement