Ejemplo n.º 1
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.º 2
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);
    }
  }