Program: 117151
Project: 117151
Buggy source:
@Override public void onUpdate(){
  this.prevPosX=this.posX;
  this.prevPosY=this.posY;
  this.prevPosZ=this.posZ;
  if (!worldObj.isRemote) {
    updateStage();
  }
  if (getStage() == Stage.POSITION) {
    LogHelper.dev(noClip);
    this.moveEntity(this.motionX,this.motionY,this.motionZ);
  }
 else {
    setPosition(0.5,67.5,0.5);
    motionX=motionY=motionZ=0;
  }
  if (!worldObj.isRemote) {
    if (dragon != null) {
      dragon.setAttackTarget(null);
      if (!dragon.isEntityAlive()) {
        dragon=null;
        LogHelper.dev("String_Node_Str");
        List<EntityDragon> list=worldObj.getEntities(EntityDragon.class,EntitySelectors.IS_ALIVE);
        for (        EntityDragon listItem : list) {
          if (dragon == null || listItem.getDistance(0,67,0) < dragon.getDistance(0,67,0)) {
            dragon=listItem;
          }
        }
        if (dragon == null) {
          cancel();
          return;
        }
      }
      if (getStage() != Stage.EXTRACT) {
        IPhase phase=dragon.getPhaseManager().getCurrentPhase();
        if (phase instanceof PhaseLandingApproach || phase instanceof PhaseLanding || phase instanceof PhaseSittingBase) {
          dragon.getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN);
        }
      }
 else       if (stageTime < 300) {
        IPhase phase=dragon.getPhaseManager().getCurrentPhase();
        if (phase instanceof PhaseTakeoff) {
          dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING);
        }
 else         if (!(phase instanceof PhaseLandingApproach || phase instanceof PhaseLanding || phase instanceof PhaseSittingBase|| phase instanceof PhaseHover)) {
          dragon.getPhaseManager().setPhase(PhaseList.LANDING);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onUpdate(){
  this.prevPosX=this.posX;
  this.prevPosY=this.posY;
  this.prevPosZ=this.posZ;
  if (exitPortalLocation == null) {
    for (exitPortalLocation=new BlockPos(0,100,0); worldObj.getBlockState(this.exitPortalLocation).getBlock() != Blocks.BEDROCK && exitPortalLocation.getY() > 30; this.exitPortalLocation=this.exitPortalLocation.down())     ;
    if (exitPortalLocation.getY() <= 30) {
      cancel();
      return;
    }
    LogHelper.dev(exitPortalLocation);
    exitPortalLocation=exitPortalLocation.up(1);
  }
  if (!worldObj.isRemote) {
    updateStage();
  }
  if (getStage() == Stage.POSITION) {
    this.moveEntity(this.motionX,this.motionY,this.motionZ);
  }
 else {
    setPosition(0.5,exitPortalLocation.getY() + 0.5,0.5);
    motionX=motionY=motionZ=0;
  }
  if (!worldObj.isRemote) {
    if (dragon != null) {
      dragon.setAttackTarget(null);
      if (!dragon.isEntityAlive()) {
        dragon=null;
        LogHelper.dev("String_Node_Str");
        List<EntityDragon> list=worldObj.getEntities(EntityDragon.class,EntitySelectors.IS_ALIVE);
        for (        EntityDragon listItem : list) {
          if (dragon == null || listItem.getDistance(0,exitPortalLocation.getY() + 0.5,0) < dragon.getDistance(0,exitPortalLocation.getY() + 0.5,0)) {
            dragon=listItem;
          }
        }
        if (dragon == null) {
          cancel();
          return;
        }
      }
      if (getStage() != Stage.EXTRACT) {
        IPhase phase=dragon.getPhaseManager().getCurrentPhase();
        if (phase instanceof PhaseLandingApproach || phase instanceof PhaseLanding || phase instanceof PhaseSittingBase) {
          dragon.getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN);
        }
      }
 else       if (stageTime < 300) {
        IPhase phase=dragon.getPhaseManager().getCurrentPhase();
        if (phase instanceof PhaseTakeoff) {
          dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING);
        }
 else         if (!(phase instanceof PhaseLandingApproach || phase instanceof PhaseLanding || phase instanceof PhaseSittingBase|| phase instanceof PhaseHover)) {
          dragon.getPhaseManager().setPhase(PhaseList.LANDING);
        }
      }
    }
  }
}