public boolean shouldExecute() {
    if (theDigimon.riddenByEntity == null
        || !(theDigimon.riddenByEntity instanceof EntityPlayer)
        || !theDigimon.canBeRided((EntityPlayer) theDigimon.riddenByEntity)) {
      return false;
    }

    rider = (EntityPlayer) theDigimon.riddenByEntity;
    return true;
  }
  public void updateTask() {
    if (!theDigimon.worldObj.isRemote
        && theDigimon.riddenByEntity != null
        && theDigimon.riddenByEntity instanceof EntityPlayer) {
      rider = (EntityPlayer) theDigimon.riddenByEntity;
      theDigimon.moveForward = 0.0F;
      theDigimon.moveStrafing = 0.0F;
      theDigimon.isJumping = false;
      theDigimon.running = false;
      rider.fallDistance = 0.0F;
      theDigimon.prevRotationYaw =
          theDigimon.rotationYaw = theDigimon.rotationYawHead = rider.rotationYaw;
      float f = (float) Math.PI;
      float f1 = f / 180F;

      if (rider.moveForward > 0.1F) {
        float f2 = rider.rotationYaw * f1;
        theDigimon.motionX += (double) rider.moveForward * -Math.sin(f2) * spd;
        theDigimon.motionZ += (double) rider.moveForward * Math.cos(f2) * spd;
        theDigimon.running = true;

        if (!rider.isJumping && canFly) {
          theDigimon.motionY = -0.05D;
        }
      } else if (rider.moveForward < -0.1F) {
        float f3 = rider.rotationYaw * f1;
        theDigimon.motionX += (double) rider.moveForward * -Math.sin(f3) * spd;
        theDigimon.motionZ += (double) rider.moveForward * Math.cos(f3) * spd;
        theDigimon.running = true;

        if (!rider.isJumping && canFly) {
          theDigimon.motionY = -0.05D;
        }
      }

      theDigimon.rotationYaw -= rider.moveStrafing * 5F;

      if (theDigimon.deepness() != 0) {
        theDigimon.motionY = 0.5D;
      }

      if (canFly) {
        if (rider.isJumping && theDigimon.posY < worldMax) {
          theDigimon.motionY = motion;
        }

        if (--timer < 0) {
          theDigimon.motionY -= 0.1D;
        }

        if (theDigimon.toGround() < minDis) {
          theDigimon.motionY = 0.2D;
        }

        if (theDigimon.onGround || theDigimon.toGround() == minDis) {
          timer = maxTime;
        }
      } else if (rider.isJumping && theDigimon.onGround) {
        theDigimon.motionY = motion;
      }

      double d =
          Math.abs(
              Math.sqrt(
                  theDigimon.motionX * theDigimon.motionX
                      + theDigimon.motionZ * theDigimon.motionZ));

      if (d > 0.375D) {
        double d1 = 0.375D / d;
        theDigimon.motionX = theDigimon.motionX * d1;
        theDigimon.motionZ = theDigimon.motionZ * d1;
      }
    }
  }
 public void startExecuting() {
   timer = maxTime;
   theDigimon.getNavigator().clearPathEntity();
 }
 public boolean continueExecuting() {
   return theDigimon.isEntityAlive()
       && theDigimon.riddenByEntity != null
       && theDigimon.canBeRided(rider);
 }