Advertisement
Guest User

Divine Armor

a guest
Jun 29th, 2014
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.09 KB | None | 0 0
  1. package vayper.morePowerCraft.armors;
  2.  
  3. import java.util.List;
  4.  
  5. import vayper.morePowerCraft.MorePowerCraft;
  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.item.ItemArmor.ArmorMaterial;
  11. import net.minecraft.potion.Potion;
  12. import net.minecraft.potion.PotionEffect;
  13. import net.minecraft.world.World;
  14.  
  15. public class DivineArmor extends ItemArmor
  16.     {  
  17.         //Constructeur
  18.         public DivineArmor(ArmorMaterial material, int type)
  19.         {
  20.             super(material, 0, type);
  21.             this.setCreativeTab(MorePowerCraft.combatTab);
  22.         }
  23.        
  24.         //Textures sur le personnage
  25.         public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
  26.         {
  27.             if(slot == 2)
  28.             {
  29.                 return MorePowerCraft.MODID + ":textures/armors/divine_2.png";
  30.             }
  31.             return MorePowerCraft.MODID + ":textures/armors/divine_1.png";
  32.         }
  33.        
  34.         //Infos supp. sur l'armure   || 0 = heaume || 1 = plastron || 2 = jambières || 3 = Bottes
  35.         public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par2List, boolean par4)
  36.         {
  37.         par2List.add("\u00A71\u00A76\u00A7l" + "Devenez un Dieu !");
  38.         par2List.add("\u00A71\u00A7b" + "Fatal si le set est complet");
  39.         }
  40.        
  41.         // Particule enchantées
  42.         @Override
  43.         public boolean hasEffect(ItemStack par1ItemStack)
  44.         {
  45.             return true;
  46.         }
  47.          
  48.         // Réparable : Oui
  49.         public boolean getIsRepairable(ItemStack input, ItemStack repair)
  50.         {
  51.             if(repair.getItem() == MorePowerCraft.divineGem)
  52.             {
  53.                 return true;
  54.             }
  55.             return false;
  56.         }
  57.        
  58.         // Effets de l'armures (potions etc...)
  59.         public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
  60.         {
  61.             ItemStack boots = player.getEquipmentInSlot(1);
  62.             ItemStack leggings = player.getEquipmentInSlot(2);
  63.             ItemStack chestPlate = player.getEquipmentInSlot(3);
  64.             ItemStack helmet = player.getEquipmentInSlot(4);
  65.            
  66.             if(helmet != null && helmet.getItem() == MorePowerCraft.divineHelmet)
  67.                     {
  68.                       player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 50, 0));
  69.                       player.addPotionEffect(new PotionEffect(Potion.waterBreathing.getId(), 2, 0));
  70.                     }    
  71.            
  72.             if(boots != null && boots.getItem() == MorePowerCraft.divineBoots)
  73.                     {
  74.                         if(player.isSprinting())
  75.                         {
  76.                             player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 2, 3));
  77.                            
  78.                         }
  79.  
  80.                 player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 2, 0));
  81.                
  82.                     }
  83.             if(boots != null &&boots.getItem() == MorePowerCraft.divineBoots && helmet != null && helmet.getItem() == MorePowerCraft.divineHelmet && chestPlate != null &&
  84.                chestPlate.getItem() == MorePowerCraft.divineBody && leggings != null && leggings.getItem() == MorePowerCraft.divineLegs )
  85.             {
  86.                 player.setInvisible(true);
  87.                 player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 2, 4));
  88.                 player.addPotionEffect(new PotionEffect(Potion.digSpeed.getId(), 2, 1));   
  89.             }
  90.         }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement