Ejemplo n.º 1
0
  public boolean b(double d1, double d2, double d3) {
    AxisAlignedBB axisalignedbb = z.c(d1, d2, d3);
    List list = l.a(this, axisalignedbb);

    if (list.size() > 0) {
      return false;
    }
    return !l.b(axisalignedbb);
  }
Ejemplo n.º 2
0
  public void a(double d1, double d2, double d3) {
    p = d1;
    q = d2;
    r = d3;
    float f1 = I / 2.0F;
    float f2 = J;

    z.c(
        d1 - (double) f1,
        (d2 - (double) H) + (double) R,
        d3 - (double) f1,
        d1 + (double) f1,
        (d2 - (double) H) + (double) R + (double) f2,
        d3 + (double) f1);
  }
Ejemplo n.º 3
0
  public void move(double d0, double d1, double d2) {
    if (this.T) {
      this.a(this.getBoundingBox().c(d0, d1, d2));
      this.recalcPosition();
    } else {
      this.world.methodProfiler.a("move");
      double d3 = this.locX;
      double d4 = this.locY;
      double d5 = this.locZ;

      if (this.H) {
        this.H = false;
        d0 *= 0.25D;
        d1 *= 0.05000000074505806D;
        d2 *= 0.25D;
        this.motX = 0.0D;
        this.motY = 0.0D;
        this.motZ = 0.0D;
      }

      double d6 = d0;
      double d7 = d1;
      double d8 = d2;
      boolean flag = this.onGround && this.isSneaking() && this instanceof EntityHuman;

      if (flag) {
        double d9;

        for (d9 = 0.05D;
            d0 != 0.0D
                && this.world.getCubes(this, this.getBoundingBox().c(d0, -1.0D, 0.0D)).isEmpty();
            d6 = d0) {
          if (d0 < d9 && d0 >= -d9) {
            d0 = 0.0D;
          } else if (d0 > 0.0D) {
            d0 -= d9;
          } else {
            d0 += d9;
          }
        }

        for (;
            d2 != 0.0D
                && this.world.getCubes(this, this.getBoundingBox().c(0.0D, -1.0D, d2)).isEmpty();
            d8 = d2) {
          if (d2 < d9 && d2 >= -d9) {
            d2 = 0.0D;
          } else if (d2 > 0.0D) {
            d2 -= d9;
          } else {
            d2 += d9;
          }
        }

        for (;
            d0 != 0.0D
                && d2 != 0.0D
                && this.world.getCubes(this, this.getBoundingBox().c(d0, -1.0D, d2)).isEmpty();
            d8 = d2) {
          if (d0 < d9 && d0 >= -d9) {
            d0 = 0.0D;
          } else if (d0 > 0.0D) {
            d0 -= d9;
          } else {
            d0 += d9;
          }

          d6 = d0;
          if (d2 < d9 && d2 >= -d9) {
            d2 = 0.0D;
          } else if (d2 > 0.0D) {
            d2 -= d9;
          } else {
            d2 += d9;
          }
        }
      }

      List list = this.world.getCubes(this, this.getBoundingBox().a(d0, d1, d2));
      AxisAlignedBB axisalignedbb = this.getBoundingBox();

      AxisAlignedBB axisalignedbb1;

      for (Iterator iterator = list.iterator();
          iterator.hasNext();
          d1 = axisalignedbb1.b(this.getBoundingBox(), d1)) {
        axisalignedbb1 = (AxisAlignedBB) iterator.next();
      }

      this.a(this.getBoundingBox().c(0.0D, d1, 0.0D));
      boolean flag1 = this.onGround || d7 != d1 && d7 < 0.0D;

      AxisAlignedBB axisalignedbb2;
      Iterator iterator1;

      for (iterator1 = list.iterator();
          iterator1.hasNext();
          d0 = axisalignedbb2.a(this.getBoundingBox(), d0)) {
        axisalignedbb2 = (AxisAlignedBB) iterator1.next();
      }

      this.a(this.getBoundingBox().c(d0, 0.0D, 0.0D));

      for (iterator1 = list.iterator();
          iterator1.hasNext();
          d2 = axisalignedbb2.c(this.getBoundingBox(), d2)) {
        axisalignedbb2 = (AxisAlignedBB) iterator1.next();
      }

      this.a(this.getBoundingBox().c(0.0D, 0.0D, d2));
      if (this.S > 0.0F && flag1 && (d6 != d0 || d8 != d2)) {
        double d10 = d0;
        double d11 = d1;
        double d12 = d2;
        AxisAlignedBB axisalignedbb3 = this.getBoundingBox();

        this.a(axisalignedbb);
        d1 = (double) this.S;
        List list1 = this.world.getCubes(this, this.getBoundingBox().a(d6, d1, d8));
        AxisAlignedBB axisalignedbb4 = this.getBoundingBox();
        AxisAlignedBB axisalignedbb5 = axisalignedbb4.a(d6, 0.0D, d8);
        double d13 = d1;

        AxisAlignedBB axisalignedbb6;

        for (Iterator iterator2 = list1.iterator();
            iterator2.hasNext();
            d13 = axisalignedbb6.b(axisalignedbb5, d13)) {
          axisalignedbb6 = (AxisAlignedBB) iterator2.next();
        }

        axisalignedbb4 = axisalignedbb4.c(0.0D, d13, 0.0D);
        double d14 = d6;

        AxisAlignedBB axisalignedbb7;

        for (Iterator iterator3 = list1.iterator();
            iterator3.hasNext();
            d14 = axisalignedbb7.a(axisalignedbb4, d14)) {
          axisalignedbb7 = (AxisAlignedBB) iterator3.next();
        }

        axisalignedbb4 = axisalignedbb4.c(d14, 0.0D, 0.0D);
        double d15 = d8;

        AxisAlignedBB axisalignedbb8;

        for (Iterator iterator4 = list1.iterator();
            iterator4.hasNext();
            d15 = axisalignedbb8.c(axisalignedbb4, d15)) {
          axisalignedbb8 = (AxisAlignedBB) iterator4.next();
        }

        axisalignedbb4 = axisalignedbb4.c(0.0D, 0.0D, d15);
        AxisAlignedBB axisalignedbb9 = this.getBoundingBox();
        double d16 = d1;

        AxisAlignedBB axisalignedbb10;

        for (Iterator iterator5 = list1.iterator();
            iterator5.hasNext();
            d16 = axisalignedbb10.b(axisalignedbb9, d16)) {
          axisalignedbb10 = (AxisAlignedBB) iterator5.next();
        }

        axisalignedbb9 = axisalignedbb9.c(0.0D, d16, 0.0D);
        double d17 = d6;

        AxisAlignedBB axisalignedbb11;

        for (Iterator iterator6 = list1.iterator();
            iterator6.hasNext();
            d17 = axisalignedbb11.a(axisalignedbb9, d17)) {
          axisalignedbb11 = (AxisAlignedBB) iterator6.next();
        }

        axisalignedbb9 = axisalignedbb9.c(d17, 0.0D, 0.0D);
        double d18 = d8;

        AxisAlignedBB axisalignedbb12;

        for (Iterator iterator7 = list1.iterator();
            iterator7.hasNext();
            d18 = axisalignedbb12.c(axisalignedbb9, d18)) {
          axisalignedbb12 = (AxisAlignedBB) iterator7.next();
        }

        axisalignedbb9 = axisalignedbb9.c(0.0D, 0.0D, d18);
        double d19 = d14 * d14 + d15 * d15;
        double d20 = d17 * d17 + d18 * d18;

        if (d19 > d20) {
          d0 = d14;
          d2 = d15;
          this.a(axisalignedbb4);
        } else {
          d0 = d17;
          d2 = d18;
          this.a(axisalignedbb9);
        }

        d1 = (double) (-this.S);

        AxisAlignedBB axisalignedbb13;

        for (Iterator iterator8 = list1.iterator();
            iterator8.hasNext();
            d1 = axisalignedbb13.b(this.getBoundingBox(), d1)) {
          axisalignedbb13 = (AxisAlignedBB) iterator8.next();
        }

        this.a(this.getBoundingBox().c(0.0D, d1, 0.0D));
        if (d10 * d10 + d12 * d12 >= d0 * d0 + d2 * d2) {
          d0 = d10;
          d1 = d11;
          d2 = d12;
          this.a(axisalignedbb3);
        }
      }

      this.world.methodProfiler.b();
      this.world.methodProfiler.a("rest");
      this.recalcPosition();
      this.positionChanged = d6 != d0 || d8 != d2;
      this.E = d7 != d1;
      this.onGround = this.E && d7 < 0.0D;
      this.F = this.positionChanged || this.E;
      int i = MathHelper.floor(this.locX);
      int j = MathHelper.floor(this.locY - 0.20000000298023224D);
      int k = MathHelper.floor(this.locZ);
      BlockPosition blockposition = new BlockPosition(i, j, k);
      Block block = this.world.getType(blockposition).getBlock();

      if (block.getMaterial() == Material.AIR) {
        Block block1 = this.world.getType(blockposition.down()).getBlock();

        if (block1 instanceof BlockFence
            || block1 instanceof BlockCobbleWall
            || block1 instanceof BlockFenceGate) {
          block = block1;
          blockposition = blockposition.down();
        }
      }

      this.a(d1, this.onGround, block, blockposition);
      if (d6 != d0) {
        this.motX = 0.0D;
      }

      if (d8 != d2) {
        this.motZ = 0.0D;
      }

      if (d7 != d1) {
        block.a(this.world, this);
      }

      if (this.r_() && !flag && this.vehicle == null) {
        double d21 = this.locX - d3;
        double d22 = this.locY - d4;
        double d23 = this.locZ - d5;

        if (block != Blocks.LADDER) {
          d22 = 0.0D;
        }

        if (block != null && this.onGround) {
          block.a(this.world, blockposition, this);
        }

        this.M = (float) ((double) this.M + (double) MathHelper.sqrt(d21 * d21 + d23 * d23) * 0.6D);
        this.N =
            (float)
                ((double) this.N
                    + (double) MathHelper.sqrt(d21 * d21 + d22 * d22 + d23 * d23) * 0.6D);
        if (this.N > (float) this.h && block.getMaterial() != Material.AIR) {
          this.h = (int) this.N + 1;
          if (this.V()) {
            float f =
                MathHelper.sqrt(
                        this.motX * this.motX * 0.20000000298023224D
                            + this.motY * this.motY
                            + this.motZ * this.motZ * 0.20000000298023224D)
                    * 0.35F;

            if (f > 1.0F) {
              f = 1.0F;
            }

            this.makeSound(
                this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
          }

          this.a(blockposition, block);
        }
      }

      try {
        this.checkBlockCollisions();
      } catch (Throwable throwable) {
        CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
        CrashReportSystemDetails crashreportsystemdetails =
            crashreport.a("Entity being checked for collision");

        this.appendEntityCrashDetails(crashreportsystemdetails);
        throw new ReportedException(crashreport);
      }

      boolean flag2 = this.U();

      if (this.world.e(this.getBoundingBox().shrink(0.001D, 0.001D, 0.001D))) {
        this.burn(1);
        if (!flag2) {
          ++this.fireTicks;
          if (this.fireTicks == 0) {
            this.setOnFire(8);
          }
        }
      } else if (this.fireTicks <= 0) {
        this.fireTicks = -this.maxFireTicks;
      }

      if (flag2 && this.fireTicks > 0) {
        this.makeSound(
            "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
        this.fireTicks = -this.maxFireTicks;
      }

      this.world.methodProfiler.b();
    }
  }
Ejemplo n.º 4
0
  public void c(double d1, double d2, double d3) {
    if (T) {
      z.d(d1, d2, d3);
      p = (z.a + z.d) / 2D;
      q = (z.b + (double) H) - (double) R;
      r = (z.c + z.f) / 2D;
      return;
    }
    double d4 = p;
    double d5 = r;
    double d6 = d1;
    double d7 = d2;
    double d8 = d3;
    AxisAlignedBB axisalignedbb = z.b();
    boolean flag = A && p();

    if (flag) {
      double d9 = 0.050000000000000003D;

      for (; d1 != 0.0D && l.a(this, z.c(d1, -1D, 0.0D)).size() == 0; d6 = d1) {
        if (d1 < d9 && d1 >= -d9) {
          d1 = 0.0D;
          continue;
        }
        if (d1 > 0.0D) {
          d1 -= d9;
        } else {
          d1 += d9;
        }
      }

      for (; d3 != 0.0D && l.a(this, z.c(0.0D, -1D, d3)).size() == 0; d8 = d3) {
        if (d3 < d9 && d3 >= -d9) {
          d3 = 0.0D;
          continue;
        }
        if (d3 > 0.0D) {
          d3 -= d9;
        } else {
          d3 += d9;
        }
      }
    }
    List list = l.a(this, z.a(d1, d2, d3));

    for (int i1 = 0; i1 < list.size(); i1++) {
      d2 = ((AxisAlignedBB) list.get(i1)).b(z, d2);
    }

    z.d(0.0D, d2, 0.0D);
    if (!F && d7 != d2) {
      d1 = d2 = d3 = 0.0D;
    }
    boolean flag1 = A || d7 != d2 && d7 < 0.0D;

    for (int j1 = 0; j1 < list.size(); j1++) {
      d1 = ((AxisAlignedBB) list.get(j1)).a(z, d1);
    }

    z.d(d1, 0.0D, 0.0D);
    if (!F && d6 != d1) {
      d1 = d2 = d3 = 0.0D;
    }
    for (int k1 = 0; k1 < list.size(); k1++) {
      d3 = ((AxisAlignedBB) list.get(k1)).c(z, d3);
    }

    z.d(0.0D, 0.0D, d3);
    if (!F && d8 != d3) {
      d1 = d2 = d3 = 0.0D;
    }
    if (S > 0.0F && flag1 && R < 0.05F && (d6 != d1 || d8 != d3)) {
      double d10 = d1;
      double d12 = d2;
      double d14 = d3;

      d1 = d6;
      d2 = S;
      d3 = d8;
      AxisAlignedBB axisalignedbb1 = z.b();

      z.b(axisalignedbb);
      List list1 = l.a(this, z.a(d1, d2, d3));

      for (int j2 = 0; j2 < list1.size(); j2++) {
        d2 = ((AxisAlignedBB) list1.get(j2)).b(z, d2);
      }

      z.d(0.0D, d2, 0.0D);
      if (!F && d7 != d2) {
        d1 = d2 = d3 = 0.0D;
      }
      for (int k2 = 0; k2 < list1.size(); k2++) {
        d1 = ((AxisAlignedBB) list1.get(k2)).a(z, d1);
      }

      z.d(d1, 0.0D, 0.0D);
      if (!F && d6 != d1) {
        d1 = d2 = d3 = 0.0D;
      }
      for (int l2 = 0; l2 < list1.size(); l2++) {
        d3 = ((AxisAlignedBB) list1.get(l2)).c(z, d3);
      }

      z.d(0.0D, 0.0D, d3);
      if (!F && d8 != d3) {
        d1 = d2 = d3 = 0.0D;
      }
      if (d10 * d10 + d14 * d14 >= d1 * d1 + d3 * d3) {
        d1 = d10;
        d2 = d12;
        d3 = d14;
        z.b(axisalignedbb1);
      } else {
        R += 0.5D;
      }
    }
    p = (z.a + z.d) / 2D;
    q = (z.b + (double) H) - (double) R;
    r = (z.c + z.f) / 2D;
    B = d6 != d1 || d8 != d3;
    C = d7 != d2;
    A = d7 != d2 && d7 < 0.0D;
    D = B || C;
    a(d2, A);
    if (d6 != d1) {
      s = 0.0D;
    }
    if (d7 != d2) {
      t = 0.0D;
    }
    if (d8 != d3) {
      u = 0.0D;
    }
    double d11 = p - d4;
    double d13 = r - d5;

    if (M && !flag) {
      L += (double) MathHelper.a(d11 * d11 + d13 * d13) * 0.59999999999999998D;
      int k3 = MathHelper.b(p);
      int i4 = MathHelper.b(q - 0.20000000298023224D - (double) H);
      int l1 = MathHelper.b(r);
      int i3 = l.a(k3, i4, l1);

      if (L > (float) b && i3 > 0) {
        b++;
        StepSound stepsound = Block.m[i3].bq;

        if (l.a(k3, i4 + 1, l1) == Block.aS.bh) {
          stepsound = Block.aS.bq;
          l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b());
        } else if (!Block.m[i3].bs.d()) {
          l.a(this, stepsound.c(), stepsound.a() * 0.15F, stepsound.b());
        }
        Block.m[i3].b(l, k3, i4, l1, this);
      }
    }
    int l3 = MathHelper.b(z.a);
    int j4 = MathHelper.b(z.b);
    int i2 = MathHelper.b(z.c);
    int j3 = MathHelper.b(z.d);
    int k4 = MathHelper.b(z.e);
    int l4 = MathHelper.b(z.f);

    for (int i5 = l3; i5 <= j3; i5++) {
      for (int j5 = j4; j5 <= k4; j5++) {
        for (int k5 = i2; k5 <= l4; k5++) {
          int l5 = l.a(i5, j5, k5);

          if (l5 > 0) {
            Block.m[l5].a(l, i5, j5, k5, this);
          }
        }
      }
    }

    R *= 0.4F;
    boolean flag2 = r();

    if (l.c(z)) {
      b(1);
      if (!flag2) {
        Z++;
        if (Z == 0) {
          Z = 300;
        }
      }
    } else if (Z <= 0) {
      Z = -Y;
    }
    if (flag2 && Z > 0) {
      l.a(this, "random.fizz", 0.7F, 1.6F + (W.nextFloat() - W.nextFloat()) * 0.4F);
      Z = -Y;
    }
  }