コード例 #1
0
  public int findPathOptions(
      PathPoint[] pathOptions,
      Entity entityIn,
      PathPoint currentPoint,
      PathPoint targetPoint,
      float maxDistance) {
    int i = 0;

    for (EnumFacing enumfacing : EnumFacing.values()) {
      PathPoint pathpoint =
          this.getSafePoint(
              entityIn,
              currentPoint.xCoord + enumfacing.getFrontOffsetX(),
              currentPoint.yCoord + enumfacing.getFrontOffsetY(),
              currentPoint.zCoord + enumfacing.getFrontOffsetZ());

      if (pathpoint != null
          && !pathpoint.visited
          && pathpoint.distanceTo(targetPoint) < maxDistance) {
        pathOptions[i++] = pathpoint;
      }
    }

    return i;
  }
コード例 #2
0
ファイル: Path.java プロジェクト: JenkinsT/Minecraft-DeNovo
  public PathPoint func_75844_c() {
    PathPoint var1 = this.field_75852_a[0];
    this.field_75852_a[0] = this.field_75852_a[--this.field_75851_b];
    this.field_75852_a[this.field_75851_b] = null;
    if (this.field_75851_b > 0) {
      this.func_75846_b(0);
    }

    var1.field_75835_d = -1;
    return var1;
  }
コード例 #3
0
  private boolean isRunningAway() {

    if (runningAwayTo == null) {
      return false;
    }
    if (getNavigator().noPath()) {
      runningAwayTo = null;
      return false;
    }
    PathPoint dest = getNavigator().getPath().getFinalPathPoint();
    return dest.equals(runningAwayTo);
  }
コード例 #4
0
ファイル: Path.java プロジェクト: JenkinsT/Minecraft-DeNovo
  private void func_75847_a(int p_75847_1_) {
    PathPoint var2 = this.field_75852_a[p_75847_1_];

    int var4;
    for (float var3 = var2.field_75834_g; p_75847_1_ > 0; p_75847_1_ = var4) {
      var4 = p_75847_1_ - 1 >> 1;
      PathPoint var5 = this.field_75852_a[var4];
      if (var3 >= var5.field_75834_g) {
        break;
      }

      this.field_75852_a[p_75847_1_] = var5;
      var5.field_75835_d = p_75847_1_;
    }

    this.field_75852_a[p_75847_1_] = var2;
    var2.field_75835_d = p_75847_1_;
  }
コード例 #5
0
ファイル: Path.java プロジェクト: JenkinsT/Minecraft-DeNovo
 public void func_75850_a(PathPoint p_75850_1_, float p_75850_2_) {
   float var3 = p_75850_1_.field_75834_g;
   p_75850_1_.field_75834_g = p_75850_2_;
   if (p_75850_2_ < var3) {
     this.func_75847_a(p_75850_1_.field_75835_d);
   } else {
     this.func_75846_b(p_75850_1_.field_75835_d);
   }
 }
コード例 #6
0
  private final PathPoint func_75854_a(int p_75854_1_, int p_75854_2_, int p_75854_3_) {
    int var4 = PathPoint.func_75830_a(p_75854_1_, p_75854_2_, p_75854_3_);
    PathPoint var5 = (PathPoint) this.field_75867_c.func_76041_a(var4);
    if (var5 == null) {
      var5 = new PathPoint(p_75854_1_, p_75854_2_, p_75854_3_);
      this.field_75867_c.func_76038_a(var4, var5);
    }

    return var5;
  }
コード例 #7
0
ファイル: Path.java プロジェクト: JenkinsT/Minecraft-DeNovo
  public PathPoint func_75849_a(PathPoint p_75849_1_) {
    if (p_75849_1_.field_75835_d >= 0) {
      throw new IllegalStateException("OW KNOWS!");
    } else {
      if (this.field_75851_b == this.field_75852_a.length) {
        PathPoint[] var2 = new PathPoint[this.field_75851_b << 1];
        System.arraycopy(this.field_75852_a, 0, var2, 0, this.field_75851_b);
        this.field_75852_a = var2;
      }

      this.field_75852_a[this.field_75851_b] = p_75849_1_;
      p_75849_1_.field_75835_d = this.field_75851_b;
      this.func_75847_a(this.field_75851_b++);
      return p_75849_1_;
    }
  }
コード例 #8
0
ファイル: Path.java プロジェクト: JenkinsT/Minecraft-DeNovo
  private void func_75846_b(int p_75846_1_) {
    PathPoint var2 = this.field_75852_a[p_75846_1_];
    float var3 = var2.field_75834_g;

    while (true) {
      int var4 = 1 + (p_75846_1_ << 1);
      int var5 = var4 + 1;
      if (var4 >= this.field_75851_b) {
        break;
      }

      PathPoint var6 = this.field_75852_a[var4];
      float var7 = var6.field_75834_g;
      PathPoint var8;
      float var9;
      if (var5 >= this.field_75851_b) {
        var8 = null;
        var9 = Float.POSITIVE_INFINITY;
      } else {
        var8 = this.field_75852_a[var5];
        var9 = var8.field_75834_g;
      }

      if (var7 < var9) {
        if (var7 >= var3) {
          break;
        }

        this.field_75852_a[p_75846_1_] = var6;
        var6.field_75835_d = p_75846_1_;
        p_75846_1_ = var4;
      } else {
        if (var9 >= var3) {
          break;
        }

        this.field_75852_a[p_75846_1_] = var8;
        var8.field_75835_d = p_75846_1_;
        p_75846_1_ = var5;
      }
    }

    this.field_75852_a[p_75846_1_] = var2;
    var2.field_75835_d = p_75846_1_;
  }
コード例 #9
0
  private int func_75860_b(
      Entity p_75860_1_,
      PathPoint p_75860_2_,
      PathPoint p_75860_3_,
      PathPoint p_75860_4_,
      float p_75860_5_) {
    int var6 = 0;
    byte var7 = 0;
    if (this.func_75855_a(
            p_75860_1_,
            p_75860_2_.field_75839_a,
            p_75860_2_.field_75837_b + 1,
            p_75860_2_.field_75838_c,
            p_75860_3_)
        == 1) {
      var7 = 1;
    }

    PathPoint var8 =
        this.func_75858_a(
            p_75860_1_,
            p_75860_2_.field_75839_a,
            p_75860_2_.field_75837_b,
            p_75860_2_.field_75838_c + 1,
            p_75860_3_,
            var7);
    PathPoint var9 =
        this.func_75858_a(
            p_75860_1_,
            p_75860_2_.field_75839_a - 1,
            p_75860_2_.field_75837_b,
            p_75860_2_.field_75838_c,
            p_75860_3_,
            var7);
    PathPoint var10 =
        this.func_75858_a(
            p_75860_1_,
            p_75860_2_.field_75839_a + 1,
            p_75860_2_.field_75837_b,
            p_75860_2_.field_75838_c,
            p_75860_3_,
            var7);
    PathPoint var11 =
        this.func_75858_a(
            p_75860_1_,
            p_75860_2_.field_75839_a,
            p_75860_2_.field_75837_b,
            p_75860_2_.field_75838_c - 1,
            p_75860_3_,
            var7);
    if (var8 != null && !var8.field_75842_i && var8.func_75829_a(p_75860_4_) < p_75860_5_) {
      this.field_75864_d[var6++] = var8;
    }

    if (var9 != null && !var9.field_75842_i && var9.func_75829_a(p_75860_4_) < p_75860_5_) {
      this.field_75864_d[var6++] = var9;
    }

    if (var10 != null && !var10.field_75842_i && var10.func_75829_a(p_75860_4_) < p_75860_5_) {
      this.field_75864_d[var6++] = var10;
    }

    if (var11 != null && !var11.field_75842_i && var11.func_75829_a(p_75860_4_) < p_75860_5_) {
      this.field_75864_d[var6++] = var11;
    }

    return var6;
  }
コード例 #10
0
  private PathEntity func_75861_a(
      Entity p_75861_1_,
      PathPoint p_75861_2_,
      PathPoint p_75861_3_,
      PathPoint p_75861_4_,
      float p_75861_5_) {
    p_75861_2_.field_75836_e = 0.0F;
    p_75861_2_.field_75833_f = p_75861_2_.func_75832_b(p_75861_3_);
    p_75861_2_.field_75834_g = p_75861_2_.field_75833_f;
    this.field_75866_b.func_75848_a();
    this.field_75866_b.func_75849_a(p_75861_2_);
    PathPoint var6 = p_75861_2_;

    while (!this.field_75866_b.func_75845_e()) {
      PathPoint var7 = this.field_75866_b.func_75844_c();
      if (var7.equals(p_75861_3_)) {
        return this.func_75853_a(p_75861_2_, p_75861_3_);
      }

      if (var7.func_75832_b(p_75861_3_) < var6.func_75832_b(p_75861_3_)) {
        var6 = var7;
      }

      var7.field_75842_i = true;
      int var8 = this.func_75860_b(p_75861_1_, var7, p_75861_4_, p_75861_3_, p_75861_5_);

      for (int var9 = 0; var9 < var8; ++var9) {
        PathPoint var10 = this.field_75864_d[var9];
        float var11 = var7.field_75836_e + var7.func_75832_b(var10);
        if (!var10.func_75831_a() || var11 < var10.field_75836_e) {
          var10.field_75841_h = var7;
          var10.field_75836_e = var11;
          var10.field_75833_f = var10.func_75832_b(p_75861_3_);
          if (var10.func_75831_a()) {
            this.field_75866_b.func_75850_a(var10, var10.field_75836_e + var10.field_75833_f);
          } else {
            var10.field_75834_g = var10.field_75836_e + var10.field_75833_f;
            this.field_75866_b.func_75849_a(var10);
          }
        }
      }
    }

    if (var6 == p_75861_2_) {
      return null;
    } else {
      return this.func_75853_a(p_75861_2_, var6);
    }
  }