Advertisement
Guest User

Potion Effect While Wearing Armor

a guest
Jul 24th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. package com.josh.joshsmod.items;
  2.  
  3. import com.josh.joshsmod.JoshsMod;
  4.  
  5. import net.minecraft.client.renderer.texture.IIconRegister;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.item.ItemArmor;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.potion.Potion;
  11. import net.minecraft.potion.PotionEffect;
  12. import net.minecraft.world.World;
  13.  
  14. public class JoshsArmor extends ItemArmor {
  15.  
  16. public JoshsArmor(ArmorMaterial material, int renderIndex,
  17. int armorSlot) {
  18. super(material, renderIndex, armorSlot);
  19. }
  20. @Override
  21. public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer)
  22. {
  23. if(stack.getItem().equals(JoshsMod.superBoots)||
  24. stack.getItem().equals(JoshsMod.superChestplate)||
  25. stack.getItem().equals(JoshsMod.superHelmet)){
  26. return "joshsmod:textures/models/armor/diamond_layer_1 copy.png";
  27. }
  28.  
  29. if(stack.getItem().equals(JoshsMod.superLeggings)){
  30. return "joshsmod:textures/models/armor/diamond_layer_2 copy.png";
  31. }
  32.  
  33. else return null;
  34. }
  35. Put code right here!
  36. }
  37. }
  38.  
  39.  
  40. @Override
  41. public void registerIcons(IIconRegister reg){
  42. if(this == JoshsMod.superHelmet)
  43. this.itemIcon = reg.registerIcon(JoshsMod.modid + ":" + "diamond_helmet copy");
  44. if(this == JoshsMod.superChestplate)
  45. this.itemIcon = reg.registerIcon(JoshsMod.modid + ":" + "diamond_chestplate copy");
  46. if(this == JoshsMod.superLeggings)
  47. this.itemIcon = reg.registerIcon(JoshsMod.modid + ":" + "diamond_leggings copy");
  48. if(this == JoshsMod.superBoots)
  49. this.itemIcon = reg.registerIcon(JoshsMod.modid + ":" + "diamond_boots copy");
  50. }
  51. }
  52.  
  53. Code:
  54.  
  55. public void onArmorTick(World world, EntityPlayer player, ItemStack ItemStack)
  56. {
  57. if(player.getCurrentArmor(3) != null){
  58. ItemStack helmet = player.getCurrentArmor(3);
  59. if(helmet.getItem() == examplemod.armorpiece){
  60. player.addPotionEffect(new PotionEffect(Potion.potionName.getId(), -1, 255));
  61. //player.addPotionEffect(new PotionEffect(Potion.potionName.getId(), -1 (infinite) , level));
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement