Ejemplo n.º 1
0
 public boolean attackEntityFrom(DamageSource damagesource, int i) {
   Entity entity = damagesource.getEntity();
   if (entity != null
       && entity != this
       && (entity instanceof EntityPlayer)
       && ((EntityPlayer) entity).username == getBotOwner()) {
     i = 20;
   }
   return super.attackEntityFrom(damagesource, i);
 }
 public void die(DamageSource damagesource) {
   if (village != null) {
     Entity entity = damagesource.getEntity();
     if (entity != null) {
       if (entity instanceof EntityHuman) village.a(entity.getName(), -2);
       else if (entity instanceof IMonster) village.h();
     } else if (entity == null) {
       EntityHuman entityhuman = world.findNearbyPlayer(this, 16D);
       if (entityhuman != null) village.h();
     }
   }
   super.die(damagesource);
 }
 public boolean attackEntityFrom(DamageSource damagesource, int i) {
   if (ticksOfInvuln > 0) {
     return false;
   }
   if (!mcServer.pvpOn && (damagesource instanceof EntityDamageSource)) {
     Entity entity = damagesource.getEntity();
     if (entity instanceof EntityPlayer) {
       return false;
     }
     if (entity instanceof EntityArrow) {
       EntityArrow entityarrow = (EntityArrow) entity;
       if (entityarrow.shootingEntity instanceof EntityPlayer) {
         return false;
       }
     }
   }
   return super.attackEntityFrom(damagesource, i);
 }
Ejemplo n.º 4
0
 public boolean attackEntityFrom(DamageSource damagesource, int i) {
   if (capabilities.disableDamage && !damagesource.canHarmInCreative()) {
     return false;
   }
   entityAge = 0;
   if (getEntityHealth() <= 0) {
     return false;
   }
   if (isPlayerSleeping() && !worldObj.multiplayerWorld) {
     wakeUpPlayer(true, true, false);
   }
   Entity entity = damagesource.getEntity();
   if ((entity instanceof EntityMob) || (entity instanceof EntityArrow)) {
     if (worldObj.difficultySetting == 0) {
       i = 0;
     }
     if (worldObj.difficultySetting == 1) {
       i = i / 2 + 1;
     }
     if (worldObj.difficultySetting == 3) {
       i = (i * 3) / 2;
     }
   }
   if (i == 0) {
     return false;
   }
   Entity entity1 = entity;
   if ((entity1 instanceof EntityArrow) && ((EntityArrow) entity1).shootingEntity != null) {
     entity1 = ((EntityArrow) entity1).shootingEntity;
   }
   if (entity1 instanceof EntityLiving) {
     alertWolves((EntityLiving) entity1, false);
   }
   addStat(StatList.damageTakenStat, i);
   return super.attackEntityFrom(damagesource, i);
 }