MrDood_Modding

ItemGodArmor.java

Feb 3rd, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.44 KB | None | 0 0
  1. package com.josh.gomc.armor;
  2.  
  3. import com.josh.gomc.Main;
  4.  
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.item.ItemArmor;
  8. import net.minecraft.item.ItemStack;
  9. import net.minecraft.potion.Potion;
  10. import net.minecraft.potion.PotionEffect;
  11. import net.minecraft.world.World;
  12.  
  13. public class ItemGodArmor extends ItemArmor{
  14.  
  15.     private String textureName;
  16.     public ItemGodArmor(ArmorMaterial material, int type, String textureName) {
  17.         super(material, 0, type);
  18.         this.textureName = textureName;
  19.        
  20.     }
  21.     @Override
  22.     public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
  23.     {
  24.         return "gomc:textures/models/armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png";
  25.     }
  26.     @Override
  27.     public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
  28.     if (itemStack.getItem().equals(Main.itemGodHelmet))
  29.         player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 300));
  30.         player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300));
  31.     if (itemStack.getItem().equals(Main.itemGodLeggings))
  32.         player.addPotionEffect(new PotionEffect(Potion.jump.id, 40, 3));
  33.     if (itemStack.getItem().equals(Main.itemGodChestplate))
  34.         player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 40, 10));
  35.         player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 40, 2));
  36.     if (itemStack.getItem().equals(Main.itemGodBoots))
  37.         player.addPotionEffect(new PotionEffect(Potion.resistance.id, 40, 9));
  38.         player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 40, 2));
  39.    
  40.     if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null){
  41.         ItemStack helmet = player.getCurrentArmor(3);
  42.         ItemStack chestplate = player.getCurrentArmor(2);
  43.         ItemStack leggings = player.getCurrentArmor(1);
  44.         ItemStack boots = player.getCurrentArmor(0);
  45.  
  46.         if(helmet.getItem() == Main.itemGodHelmet && chestplate.getItem() == Main.itemGodChestplate && leggings.getItem() == Main.itemGodLeggings && boots.getItem() == Main.itemGodBoots) {
  47.             player.capabilities.allowFlying = true;
  48.             player.fallDistance = 0.0f;    
  49.         }else {
  50.             player.capabilities.allowFlying = false;
  51.             player.capabilities.isFlying = false;
  52.             }
  53.         }else{
  54.             player.capabilities.allowFlying = false;
  55.             player.capabilities.isFlying = false;
  56.         }
  57.     }
  58.    
  59. }
Advertisement
Add Comment
Please, Sign In to add comment