Guest User

Fallen Armor

a guest
Jun 29th, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.91 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 FallenArmor extends ItemArmor
  16. {
  17.         //Constructeur
  18.         public FallenArmor(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/fallen_2.png";
  30.             }
  31.             return MorePowerCraft.MODID + ":textures/armors/fallen_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" + "L'Armure du Démon !");
  38.             par2List.add("\u00A71\u00A7b" + "Dévastateur 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.sataniteGem)
  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.fallenHelmet)
  67.                     {
  68.                       player.addPotionEffect(new PotionEffect(Potion.waterBreathing.getId(), 2, 0));
  69.                     }
  70.            
  71.             if(boots != null && boots.getItem() == MorePowerCraft.fallenBoots)
  72.                     {
  73.                       player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 2, 0));
  74.                     }
  75.            
  76.             if(boots != null &&boots.getItem() == MorePowerCraft.fallenBoots && helmet != null && helmet.getItem() == MorePowerCraft.fallenHelmet && chestPlate != null &&
  77.                        chestPlate.getItem() == MorePowerCraft.fallenBody && leggings != null && leggings.getItem() == MorePowerCraft.fallenLegs)
  78.             {
  79.                 player.addPotionEffect(new PotionEffect(Potion.harm.getId(), 2, 0));
  80.                 player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 20, 2));                        
  81.                 player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 2, 1));
  82.  
  83.             }
  84.         }
  85.     }
Advertisement
Add Comment
Please, Sign In to add comment