Esempio n. 1
0
  protected float c(DamageSource damagesource, float f) {
    if (damagesource.h()) {
      return f;
    } else {
      if (this instanceof EntityZombie) {
        f = f;
      }

      int i;
      int j;
      float f1;

      if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
        i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
        j = 25 - i;
        f1 = f * (float) j;
        f = f1 / 25.0F;
      }

      if (f <= 0.0F) {
        return 0.0F;
      } else {
        i = EnchantmentManager.a(this.getEquipment(), damagesource);
        if (i > 20) {
          i = 20;
        }

        if (i > 0 && i <= 20) {
          j = 25 - i;
          f1 = f * (float) j;
          f = f1 / 25.0F;
        }

        return f;
      }
    }
  }
Esempio n. 2
0
  public boolean damageEntity(DamageSource damagesource, float f) {
    if (this.isInvulnerable()) {
      return false;
    } else if (damagesource == DamageSource.DROWN) {
      return false;
    } else if (this.bU() > 0) {
      return false;
    } else {
      Entity entity;

      if (this.bV()) {
        entity = damagesource.h();
        if (entity instanceof EntityArrow) {
          return false;
        }
      }

      entity = damagesource.getEntity();
      if (entity != null
          && !(entity instanceof EntityHuman)
          && entity instanceof EntityLiving
          && ((EntityLiving) entity).getMonsterType() == this.getMonsterType()) {
        return false;
      } else {
        if (this.bv <= 0) {
          this.bv = 20;
        }

        for (int i = 0; i < this.bu.length; ++i) {
          this.bu[i] += 3;
        }

        return super.damageEntity(damagesource, f);
      }
    }
  }