Ejemplo n.º 1
0
  private void checkNearbyBlocks(SSEntityScriptedSurvivor ess) {
    int i = MathHelper.floor_double(ess.posX);
    int j = MathHelper.floor_double(ess.boundingBox.minY);
    int k = MathHelper.floor_double(ess.posZ);
    boolean flag = true;
    if (isTargetBlock(ess, i, j - 1, k)) {
      j--;
    } else if (isTargetBlock(ess, i, j + 2, k)) {
      j += 2;
    } else if (isTargetBlock(ess, i - 1, j, k)) {
      i--;
    } else if (isTargetBlock(ess, i, j, k - 1)) {
      k--;
    } else if (isTargetBlock(ess, i + 1, j, k)) {
      i++;
    } else if (isTargetBlock(ess, i, j, k + 1)) {
      k++;
    } else flag = false;

    if (flag) {
      ess.coords = new int[3];
      ess.coords[0] = i;
      ess.coords[1] = j;
      ess.coords[2] = k;
      ess.path = ess.worldObj.getEntityPathToXYZ(ess, i, j, k, 12F);
    }
  }
Ejemplo n.º 2
0
 public void exitAction(SSEntityScriptedSurvivor ess, boolean actionCanceled) {
   ess.actionTimer = -1;
   if (actionCanceled) {
     ess.coords = null;
     ess.setPathToEntity(null);
   }
 }
Ejemplo n.º 3
0
  public void exitAction(SSEntityScriptedSurvivor ess, boolean actionCanceled) {
    if (actionCanceled) return;

    if (nearCoords(ess))
      ess.currentAction = succeedActions[ess.getRNG().nextInt(succeedActions.length)] - 2;
    else ess.currentAction = failActions[ess.getRNG().nextInt(failActions.length)] - 2;
  }
Ejemplo n.º 4
0
  private void setNewWayPoint(SSEntityScriptedSurvivor ess) {
    boolean flag = false;
    int j = -1;
    int k = -1;
    int l = -1;
    float f2 = -99999F;
    ess.coords = null;
    for (int i1 = 0; i1 < 10; i1++) {
      int j1 = MathHelper.floor_double((ess.posX + (double) ess.getRNG().nextInt(21)) - 10D);
      int k1 = MathHelper.floor_double((ess.posY + (double) ess.getRNG().nextInt(7)) - 3D);
      int l1 = MathHelper.floor_double((ess.posZ + (double) ess.getRNG().nextInt(21)) - 10D);
      float f3 = isTargetBlock(ess, j1, k1, l1) ? 1000F : (float) ess.getDistance(j1, k1, l1);
      if (f3 == 1000F) {
        j = j1;
        k = k1;
        l = l1;
        ess.coords = new int[3];
        ess.coords[0] = j;
        ess.coords[1] = k;
        ess.coords[2] = l;
        flag = true;
        break;
      } else if (f3 > f2) {
        f2 = f3;
        j = j1;
        k = k1;
        l = l1;
        flag = true;
      }
    }

    if (flag) {
      ess.path = ess.worldObj.getEntityPathToXYZ(ess, j, k, l, 18F);
    }
  }
Ejemplo n.º 5
0
 public boolean isActionComplete(SSEntityScriptedSurvivor ess) {
   if (ess.coords != null && ess.getDistance(ess.coords[0], ess.coords[1], ess.coords[2]) < 2D)
     return true;
   return ess.actionTimer >= maxTicksToLook;
 }
Ejemplo n.º 6
0
 public void doAction(SSEntityScriptedSurvivor ess) {
   if (ess.actionTimer == -1 || ess.path == null || ess.getRNG().nextFloat() < 0.001F)
     setNewWayPoint(ess);
   if (ess.actionTimer % 10 == 0) checkNearbyBlocks(ess);
   ess.actionTimer++;
 }
Ejemplo n.º 7
0
 private boolean nearCoords(SSEntityScriptedSurvivor ess) {
   if (ess.coords == null || ess.getDistance(ess.coords[0], ess.coords[1], ess.coords[2]) > range)
     return false;
   return true;
 }