package net.Ethereal.armor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.Ethereal.main.ClientProxy; import net.Ethereal.main.EtherealMain; import net.Ethereal.main.EtherealStrings; import net.lucrecious.tutorialmod.proxy.ProxyClient; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class EtherealArmor extends ItemArmor { public EtherealArmor(ArmorMaterial material,int id, int armorPlacement) { super(material, id, armorPlacement); setCreativeTab(EtherealMain.EtherealTabCombat); if(armorPlacement == 0){ this.setTextureName(EtherealStrings.modid + ":" + "EtherealHelm"); }else if(armorPlacement == 1){ this.setTextureName(EtherealStrings.modid + ":" + "EtherealChestplate"); }else if(armorPlacement == 2){ this.setTextureName(EtherealStrings.modid + ":" + "EtherealPants"); }else if(armorPlacement == 3){ this.setTextureName(EtherealStrings.modid + ":" + "EtherealBoots"); } } public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if (stack.getItem() == EtherealMain.itemEtherealHelm || stack.getItem() == EtherealMain.itemEtherealChestplate || stack.getItem() == EtherealMain.itemEtherealBoots) { return EtherealStrings.modid + ":textures/armor/Ethereal_1.png"; }else if (stack.getItem() == EtherealMain.itemEtherealPants) { return EtherealStrings.modid + ":textures/armor/Ethereal_2.png"; }else{ return null; } } @SideOnly(Side.CLIENT) public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot){ ModelBiped armorModel = ClientProxy.armorModels.get(this); if(armorModel != null){ armorModel.bipedHead.showModel = armorSlot == 0; armorModel.bipedHeadwear.showModel = false; armorModel.bipedBody.showModel = armorSlot == 1 || armorSlot == 2; armorModel.bipedRightArm.showModel = armorSlot == 1; armorModel.bipedLeftArm.showModel = armorSlot == 1; armorModel.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3; armorModel.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3; armorModel.isSneak = entityLiving.isSneaking(); armorModel.isRiding = entityLiving.isRiding(); armorModel.isChild = entityLiving.isChild(); armorModel.heldItemRight = 0; armorModel.aimedBow = false; EntityPlayer player = (EntityPlayer)entityLiving; ItemStack held_item = player.getEquipmentInSlot(0); if (held_item != null){ armorModel.heldItemRight = 1; if (player.getItemInUseCount() > 0){ EnumAction enumaction = held_item.getItemUseAction(); if (enumaction == EnumAction.bow){ armorModel.aimedBow = true; }else if (enumaction == EnumAction.block){ armorModel.heldItemRight = 3; } } } } return armorModel; } public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack){ if (player.getCurrentArmor(3) != null){ ItemStack helmet = player.getCurrentArmor(3); if (helmet.getItem() == EtherealMain.itemEtherealHelm) player.addPotionEffect(new PotionEffect (Potion.nightVision.getId(), 1000)); if (player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null){ ItemStack helmet1 = player.getCurrentArmor(3); ItemStack chestplate = player.getCurrentArmor(2); ItemStack pants = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if (helmet1.getItem() == EtherealMain.itemEtherealHelm && chestplate.getItem() == EtherealMain.itemEtherealChestplate && pants.getItem() == EtherealMain.itemEtherealPants && boots.getItem() == EtherealMain.itemEtherealBoots){ player.addPotionEffect(new PotionEffect (Potion.fireResistance.getId(), 1000)); player.addPotionEffect(new PotionEffect (Potion.resistance.getId(), 1000)); player.addPotionEffect(new PotionEffect (Potion.damageBoost.getId(), 1000)); player.addPotionEffect(new PotionEffect (Potion.waterBreathing.getId(), 1000)); player.addPotionEffect(new PotionEffect (Potion.regeneration.getId(), 1000)); } } } } }