/**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    if (this.flyToggleTimer > 0) {
      --this.flyToggleTimer;
    }

    if (this.worldObj.difficultySetting == 0
        && this.getHealth() < this.getMaxHealth()
        && this.ticksExisted % 20 * 12 == 0) {
      this.heal(1);
    }

    this.inventory.decrementAnimations();
    this.prevCameraYaw = this.cameraYaw;
    super.onLivingUpdate();
    this.landMovementFactor = this.speedOnGround;
    this.jumpMovementFactor = this.speedInAir;

    if (this.isSprinting()) {
      this.landMovementFactor =
          (float) ((double) this.landMovementFactor + (double) this.speedOnGround * 0.3D);
      this.jumpMovementFactor =
          (float) ((double) this.jumpMovementFactor + (double) this.speedInAir * 0.3D);
    }

    float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
    float var2 = (float) Math.atan(-this.motionY * 0.20000000298023224D) * 15.0F;

    if (var1 > 0.1F) {
      var1 = 0.1F;
    }

    if (!this.onGround || this.getHealth() <= 0) {
      var1 = 0.0F;
    }

    if (this.onGround || this.getHealth() <= 0) {
      var2 = 0.0F;
    }

    this.cameraYaw += (var1 - this.cameraYaw) * 0.4F;
    this.cameraPitch += (var2 - this.cameraPitch) * 0.8F;

    if (this.getHealth() > 0) {
      List var3 =
          this.worldObj.getEntitiesWithinAABBExcludingEntity(
              this, this.boundingBox.expand(1.0D, 0.0D, 1.0D));

      if (var3 != null) {
        for (int var4 = 0; var4 < var3.size(); ++var4) {
          Entity var5 = (Entity) var3.get(var4);

          if (!var5.isDead) {
            this.collideWithPlayer(var5);
          }
        }
      }
    }
  }
 public void onUpdate() {
   decayFlash();
   super.onUpdate();
   onLivingUpdate();
   double d = posX - prevPosX;
   double d1 = posZ - prevPosZ;
   float f = MathHelper.sqrt_double(d * d + d1 * d1);
   float f1 = renderYawOffset;
   float f2 = 0.0F;
   field_9362_u = field_9361_v;
   float f3 = 0.0F;
   if (f > 0.05F) {
     f3 = 1.0F;
     f2 = f * 3F;
     f1 = ((float) Math.atan2(d1, d) * 180F) / 3.141593F - 90F;
   }
   if (swingProgress > 0.0F) {
     f1 = rotationYaw;
   }
   if (!onGround) {
     f3 = 0.0F;
   }
   field_9361_v = field_9361_v + (f3 - field_9361_v) * 0.3F;
   float f4;
   for (f4 = f1 - renderYawOffset; f4 < -180F; f4 += 360F) {}
   for (; f4 >= 180F; f4 -= 360F) {}
   renderYawOffset += f4 * 0.3F;
   float f5;
   for (f5 = rotationYaw - renderYawOffset; f5 < -180F; f5 += 360F) {}
   for (; f5 >= 180F; f5 -= 360F) {}
   boolean flag = f5 < -90F || f5 >= 90F;
   if (f5 < -75F) {
     f5 = -75F;
   }
   if (f5 >= 75F) {
     f5 = 75F;
   }
   renderYawOffset = rotationYaw - f5;
   if (f5 * f5 > 2500F) {
     renderYawOffset += f5 * 0.2F;
   }
   if (flag) {
     f2 *= -1F;
   }
   for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) {}
   for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) {}
   for (; renderYawOffset - prevRenderYawOffset < -180F; prevRenderYawOffset -= 360F) {}
   for (; renderYawOffset - prevRenderYawOffset >= 180F; prevRenderYawOffset += 360F) {}
   for (; rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) {}
   for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) {}
   field_9360_w += f2;
 }
 public void onLivingUpdate() {
   if (flyToggleTimer > 0) {
     flyToggleTimer--;
   }
   if (worldObj.difficultySetting == 0
       && getEntityHealth() < getMaxHealth()
       && (ticksExisted % 20) * 12 == 0) {
     heal(1);
   }
   inventory.decrementAnimations();
   prevCameraYaw = cameraYaw;
   super.onLivingUpdate();
   landMovementFactor = speedOnGround;
   jumpMovementFactor = speedInAir;
   if (isSprinting()) {
     landMovementFactor += (double) speedOnGround * 0.29999999999999999D;
     jumpMovementFactor += (double) speedInAir * 0.29999999999999999D;
   }
   float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
   float f1 = (float) Math.atan(-motionY * 0.20000000298023224D) * 15F;
   if (f > 0.1F) {
     f = 0.1F;
   }
   if (!onGround || getEntityHealth() <= 0) {
     f = 0.0F;
   }
   if (onGround || getEntityHealth() <= 0) {
     f1 = 0.0F;
   }
   cameraYaw += (f - cameraYaw) * 0.4F;
   cameraPitch += (f1 - cameraPitch) * 0.8F;
   if (getEntityHealth() > 0) {
     List list =
         worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(1.0D, 0.0D, 1.0D));
     if (list != null) {
       for (int i = 0; i < list.size(); i++) {
         Entity entity = (Entity) list.get(i);
         if (!entity.isDead) {
           collideWithPlayer(entity);
         }
       }
     }
   }
 }