Guest User

Mystic Armor

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