public static void func_151385_b(EntityLivingBase p_151385_0_, Entity p_151385_1_) {
    field_151389_e.field_151366_a = p_151385_0_;
    field_151389_e.field_151365_b = p_151385_1_;
    applyEnchantmentModifierArray(field_151389_e, p_151385_0_.getLastActiveItems());

    if (p_151385_0_ instanceof EntityPlayer) {
      applyEnchantmentModifier(field_151389_e, p_151385_0_.getHeldItem());
    }
  }
  public static ItemStack func_92099_a(Enchantment p_92099_0_, EntityLivingBase p_92099_1_) {
    ItemStack[] aitemstack = p_92099_1_.getLastActiveItems();
    int i = aitemstack.length;

    for (int j = 0; j < i; ++j) {
      ItemStack itemstack = aitemstack[j];

      if (itemstack != null && getEnchantmentLevel(p_92099_0_.effectId, itemstack) > 0) {
        return itemstack;
      }
    }

    return null;
  }
 /** Returns the aqua affinity status of enchantments on current equipped item of player. */
 public static boolean getAquaAffinityModifier(EntityLivingBase p_77510_0_) {
   /** Returns the biggest level of the enchantment on the array of ItemStack passed. */
   return getMaxEnchantmentLevel(
           Enchantment.aquaAffinity.effectId, p_77510_0_.getLastActiveItems())
       > 0;
 }
 /** Returns the 'Water Breathing' modifier of enchantments on player equipped armors. */
 public static int getRespiration(EntityLivingBase p_77501_0_) {
   /** Returns the biggest level of the enchantment on the array of ItemStack passed. */
   return getMaxEnchantmentLevel(
       Enchantment.respiration.effectId, p_77501_0_.getLastActiveItems());
 }
  protected int applyArmorCalculations(
      EntityLivingBase entity, DamageSource source, float originalDamage) {
    ItemStack[] armor = entity.getLastActiveItems();
    int pierceRating = 0;
    int slashRating = 0;
    int crushRating = 0;

    EntityArmorCalcEvent eventPre =
        new EntityArmorCalcEvent(entity, originalDamage, EntityArmorCalcEvent.EventType.PRE);
    MinecraftForge.EVENT_BUS.post(eventPre);
    float damage = eventPre.incomingDamage;

    if (!source.isUnblockable() && armor != null) {
      // 1. Get Random Hit Location
      int location = getRandomSlot(entity.getRNG());

      // 2. Get Armor Rating for armor in hit Location
      if (armor[location] != null && armor[location].getItem() instanceof ItemTFCArmor) {
        pierceRating = ((ItemTFCArmor) armor[location].getItem()).armorTypeTFC.getPiercingAR();
        slashRating = ((ItemTFCArmor) armor[location].getItem()).armorTypeTFC.getSlashingAR();
        crushRating = ((ItemTFCArmor) armor[location].getItem()).armorTypeTFC.getCrushingAR();
        if (entity instanceof IInnateArmor) {
          pierceRating += ((IInnateArmor) entity).getPierceArmor();
          slashRating += ((IInnateArmor) entity).getSlashArmor();
          crushRating += ((IInnateArmor) entity).getCrushArmor();
        }

        // 3. Convert the armor rating to % damage reduction
        float pierceMult = getDamageReduction(pierceRating);
        float slashMult = getDamageReduction(slashRating);
        float crushMult = getDamageReduction(crushRating);

        // 4. Reduce incoming damage
        damage = processDamageSource(source, damage, pierceMult, slashMult, crushMult);

        // 5. Damage the armor that was hit
        armor[location].damageItem((int) processArmorDamage(armor[location], damage), entity);
      } else if (armor[location] == null
          || armor[location] != null && !(armor[location].getItem() instanceof ItemTFCArmor)) {
        if (entity instanceof IInnateArmor) {
          pierceRating += ((IInnateArmor) entity).getPierceArmor();
          slashRating += ((IInnateArmor) entity).getSlashArmor();
          crushRating += ((IInnateArmor) entity).getCrushArmor();
        }
        // 1. Convert the armor rating to % damage reduction
        float pierceMult = getDamageReduction(pierceRating);
        float slashMult = getDamageReduction(slashRating);
        float crushMult = getDamageReduction(crushRating);
        // 4. Reduce incoming damage
        damage = processDamageSource(source, damage, pierceMult, slashMult, crushMult);

        // a. If the attack hits an unprotected head, it does 75% more damage
        // b. If the attack hits unprotected feet, it applies a slow to the player
        if (location == 3) damage *= 1.75f;
        else if (location == 0)
          entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 100, 1));
      }
      // 6. Apply the damage to the player
      EntityArmorCalcEvent eventPost =
          new EntityArmorCalcEvent(entity, damage, EntityArmorCalcEvent.EventType.POST);
      MinecraftForge.EVENT_BUS.post(eventPost);
      // TerraFirmaCraft.log.info(entity.getClass()+", "+eventPre.incomingDamage+",
      // "+eventPost.incomingDamage);
      float hasHealth = entity.getHealth();
      entity.setHealth(entity.getHealth() - eventPost.incomingDamage);
      entity.func_110142_aN().func_94547_a(source, hasHealth, eventPost.incomingDamage);
    }
    return 0;
  }
 public static int func_92098_i(EntityLivingBase par0EntityLivingBase) {
   return getMaxEnchantmentLevel(
       Enchantment.thorns.effectId, par0EntityLivingBase.getLastActiveItems());
 }
 /** Returns the aqua affinity status of enchantments on current equipped item of player. */
 public static boolean getAquaAffinityModifier(EntityLivingBase par0EntityLivingBase) {
   return getMaxEnchantmentLevel(
           Enchantment.aquaAffinity.effectId, par0EntityLivingBase.getLastActiveItems())
       > 0;
 }
 /** Returns the 'Water Breathing' modifier of enchantments on player equipped armors. */
 public static int getRespiration(EntityLivingBase par0EntityLivingBase) {
   return getMaxEnchantmentLevel(
       Enchantment.respiration.effectId, par0EntityLivingBase.getLastActiveItems());
 }