Venom1987

armor

Apr 3rd, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. package com.github.venom1987.TutMod1.items;
  2.  
  3. import com.github.venom1987.TutMod1.help.Reference;
  4. import com.github.venom1987.TutMod1.tabs.ModTabs;
  5.  
  6. import net.minecraft.enchantment.Enchantment;
  7. import net.minecraft.entity.Entity;
  8. import net.minecraft.entity.player.EntityPlayer;
  9. import net.minecraft.entity.player.PlayerCapabilities;
  10. import net.minecraft.item.ItemArmor;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.potion.Potion;
  13. import net.minecraft.potion.PotionEffect;
  14. import net.minecraft.world.World;
  15.  
  16. public class ItemTutorialumArmor extends ItemArmor
  17. {
  18. public ItemTutorialumArmor(ArmorMaterial material, int ArmorType, String name)
  19. {
  20. super(material, 0, ArmorType);
  21. setUnlocalizedName(name);
  22. setTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5));
  23. setCreativeTab(ModTabs.tabTutorialMod);
  24. }
  25.  
  26. public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
  27. {
  28. if (stack.getItem() == Armory.tutorialumHelm || stack.getItem() == Armory.tutorialumPlate || stack.getItem() == Armory.tutorialumBoots)
  29. {
  30. return Reference.MODID + ":models/armor/tutorialum_layer1.png";
  31. }
  32. else if (stack.getItem() == Armory.tutorialumPants)
  33. {
  34. return Reference.MODID + ":models/armor/tutorialum_layer2.png";
  35. }
  36. else
  37. {
  38. return null;
  39. }
  40.  
  41.  
  42. }
  43. public PlayerCapabilities capabilities = new PlayerCapabilities();
  44. @Override
  45. public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
  46. {
  47. if (player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem().equals(Armory.tutorialumBoots)
  48. && player.getCurrentArmor(1) != null && player.getCurrentArmor(1).getItem().equals(Armory.tutorialumPants)
  49. && player.getCurrentArmor(2) != null && player.getCurrentArmor(2).getItem().equals(Armory.tutorialumPlate)
  50. && player.getCurrentArmor(3) != null && player.getCurrentArmor(3).getItem().equals(Armory.tutorialumHelm))
  51. {
  52. player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20*1, 2));
  53. player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 20*1, 1));
  54. player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 20*1));
  55. player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 20*1));
  56. player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 20*1, 1));
  57. player.fallDistance=0F;
  58. player.capabilities.allowFlying=true;
  59. }
  60. else
  61. player.capabilities.allowFlying=false;
  62. player.capabilities.isFlying=false;
  63. }
  64.  
  65. public void onCreated(ItemStack stack, World world, EntityPlayer player)
  66. {
  67. stack.addEnchantment(Enchantment.unbreaking, 3);
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment