protected void damageEntity(DamageSource damagesource, int i) {
   if (!damagesource.isUnblockable() && isBlocking()) {
     i = 1 + i >> 1;
   }
   i = applyArmorCalculations(damagesource, i);
   i = applyPotionDamageCalculations(damagesource, i);
   addExhaustion(damagesource.getHungerDamage());
   health -= i;
 }
Example #2
0
  /**
   * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first
   * and then health second with the reduced value. Args: damageAmount
   */
  protected void damageEntity(DamageSource par1DamageSource, int par2) {
    if (!par1DamageSource.isUnblockable() && this.isBlocking()) {
      par2 = 1 + par2 >> 1;
    }

    par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2);
    if (par2 <= 0) {
      return;
    }
    par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
    this.addExhaustion(par1DamageSource.getHungerDamage());
    this.health -= par2;
  }