Guest User

Shadow's Armor

a guest
Jun 29th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.83 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 ShadowArmor extends ItemArmor
  16.     {  
  17.         //Constructeur
  18.         public ShadowArmor(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/shadow_2.png";
  30.             }
  31.             return MorePowerCraft.MODID + ":textures/armors/shadow_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\u00A7b" + "Furtif si le set est complet");
  38.         }
  39.        
  40.         // Particule enchantées
  41.         @Override
  42.         public boolean hasEffect(ItemStack par1ItemStack)
  43.         {
  44.             return false;
  45.         }
  46.          
  47.         // Réparable : Oui
  48.         public boolean getIsRepairable(ItemStack input, ItemStack repair)
  49.         {
  50.             if(repair.getItem() == MorePowerCraft.shadowGem)
  51.             {
  52.                 return true;
  53.             }
  54.             return false;
  55.         }
  56.        
  57.         // Effets de l'armures (potions etc...)
  58.         public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
  59.         {
  60.             if(!world.isRemote)
  61.             {
  62.             ItemStack boots = player.getEquipmentInSlot(1);
  63.             ItemStack leggings = player.getEquipmentInSlot(2);
  64.             ItemStack chestPlate = player.getEquipmentInSlot(3);
  65.             ItemStack helmet = player.getEquipmentInSlot(4);
  66.            
  67.             if(helmet != null && helmet.getItem() == MorePowerCraft.shadowHelmet)
  68.                     {
  69.                       player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 11, 0));
  70.                       player.addPotionEffect(new PotionEffect(Potion.waterBreathing.getId(), 2, 0));
  71.                     }          
  72.             if(boots != null && boots.getItem() == MorePowerCraft.shadowBoots && player.isSprinting())
  73.                     {
  74.                 player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 2, 1));
  75.                     }
  76.             if(boots != null &&boots.getItem() == MorePowerCraft.shadowBoots && helmet != null && helmet.getItem() == MorePowerCraft.shadowHelmet && chestPlate != null &&
  77.                chestPlate.getItem() == MorePowerCraft.shadowBody && leggings != null && leggings.getItem() == MorePowerCraft.shadowLegs )
  78.             {
  79.                 player.setInvisible(true);
  80.                 player.addPotionEffect(new PotionEffect(Potion.digSpeed.getId(), 50, 0));
  81.             }          
  82.         }
  83.         }
  84.     }
Advertisement
Add Comment
Please, Sign In to add comment