コード例 #1
0
 @Override
 public boolean shouldExecute() {
   if (cooldownTicks-- > 0 || host.getCurrentAction() != BossActions.IDLE) return false;
   EntityLivingBase AITarget = host.getAttackTarget();
   if (AITarget == null || AITarget.isDead) return false;
   this.target = AITarget;
   return true;
 }
コード例 #2
0
 @Override
 public boolean continueExecuting() {
   EntityLivingBase AITarget = host.getAttackTarget();
   if (AITarget == null
       || AITarget.isDead
       || (host.getCurrentAction() == BossActions.THROWING_SICKLE
           && host.getTicksInCurrentAction() > host.getCurrentAction().getMaxActionTime())) {
     host.setCurrentAction(BossActions.IDLE);
     cooldownTicks = 50;
     return false;
   }
   return true;
 }
コード例 #3
0
  @Override
  public void updateTask() {
    host.getLookHelper().setLookPositionWithEntity(target, 30, 30);
    if (host.getDistanceSqToEntity(target) > 100) {
      host.getNavigator().tryMoveToEntityLiving(target, moveSpeed);
    } else {
      host.getNavigator().clearPathEntity();
      if (host.getCurrentAction() != BossActions.THROWING_SICKLE)
        host.setCurrentAction(BossActions.THROWING_SICKLE);

      if (host.getTicksInCurrentAction() == 12) {
        host.faceEntity(target, 180, 180);
        if (!host.worldObj.isRemote) {
          EntityThrownSickle projectile = new EntityThrownSickle(host.worldObj, host, 2.0f);
          projectile.setThrowingEntity(host);
          projectile.setProjectileSpeed(2.0);
          host.worldObj.spawnEntityInWorld(projectile);
        }
      }
    }
  }