Guest User

RubyArmor Code

a guest
Nov 23rd, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. package science.Ruby;
  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. import net.minecraft.potion.Potion;
  12. import net.minecraft.potion.PotionEffect;
  13.  
  14. public class RubyArmor extends ItemArmor{
  15.  
  16. private String texturePath = "random_mod:";
  17. private String iconPath = "random_mod:";
  18.  
  19. public RubyArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial,
  20. int par3, int par4, String type) {
  21. super(par1, par2EnumArmorMaterial, par3, par4);
  22.  
  23. this.setMaxStackSize(1);
  24. this.setCreativeTab(CreativeTabs.tabCombat);
  25. this.SetArmorType(type.toLowerCase(), par4);
  26.  
  27. }
  28.  
  29. // 0 = Helmet
  30. // 1 = Chest
  31. // 2 = Leggings
  32. // 3 = Boots
  33. private void SetArmorType(String type, int par4)
  34. {
  35. switch(par4)
  36. {
  37. case 0:
  38. this.setUnlocalizedName(type + "helmet");
  39. this.texturePath += type + "_layer_1.png";
  40. this.iconPath +=type + "_helmet";
  41. break;
  42. case 1:
  43. this.setUnlocalizedName(type + "chest");
  44. this.texturePath += type + "_layer_1.png";
  45. this.iconPath +=type + "_chest";
  46. break;
  47. case 2:
  48. this.setUnlocalizedName(type + "leggings");
  49. this.texturePath += type + "_layer_2.png";
  50. this.iconPath +=type + "_leggings";
  51. break;
  52. case 3:
  53. this.setUnlocalizedName(type + "boots");
  54. this.texturePath += type + "_layer_2.png";
  55. this.iconPath +=type + "_boots";
  56. break;
  57. }
  58.  
  59. }
  60.  
  61. @SideOnly(Side.CLIENT)
  62. public void registerIcons(IconRegister reg)
  63. {
  64. this.itemIcon = reg.registerIcon(this.iconPath);
  65. }
  66.  
  67. @SideOnly(Side.CLIENT)
  68. public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
  69. {
  70. return this.texturePath;
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment