Ejemplo n.º 1
0
  protected float f(float f, float f1) {
    float f2 = MathHelper.g(f - this.aN);

    this.aN += f2 * 0.3F;
    float f3 = MathHelper.g(this.yaw - this.aN);
    boolean flag = f3 < -90.0F || f3 >= 90.0F;

    if (f3 < -75.0F) {
      f3 = -75.0F;
    }

    if (f3 >= 75.0F) {
      f3 = 75.0F;
    }

    this.aN = this.yaw - f3;
    if (f3 * f3 > 2500.0F) {
      this.aN += f3 * 0.2F;
    }

    if (flag) {
      f1 *= -1.0F;
    }

    return f1;
  }
Ejemplo n.º 2
0
  public void a() {
    this.a.pitch = 0.0F;
    if (this.d) {
      this.d = false;
      double d0 = this.e - this.a.locX;
      double d1 = this.f - (this.a.locY + (double) this.a.getHeadHeight());
      double d2 = this.g - this.a.locZ;
      double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
      // CraftBukkit start - Math -> TrigMath
      float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
      float f1 = (float) (-(TrigMath.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
      // CraftBukkit end

      this.a.pitch = this.a(this.a.pitch, f1, this.c);
      this.a.as = this.a(this.a.as, f, this.b);
    } else {
      this.a.as = this.a(this.a.as, this.a.aq, 10.0F);
    }

    float f2 = MathHelper.g(this.a.as - this.a.aq);

    if (!this.a.getNavigation().f()) {
      if (f2 < -75.0F) {
        this.a.as = this.a.aq - 75.0F;
      }

      if (f2 > 75.0F) {
        this.a.as = this.a.aq + 75.0F;
      }
    }
  }
Ejemplo n.º 3
0
  private float a(float f, float f1, float f2) {
    float f3 = MathHelper.g(f1 - f);

    if (f3 > f2) {
      f3 = f2;
    }

    if (f3 < -f2) {
      f3 = -f2;
    }

    return f + f3;
  }
Ejemplo n.º 4
0
  public void l_() {
    super.l_();
    if (this.e() > 0) {
      this.a(this.e() - 1);
    }

    if (this.getDamage() > 0.0F) {
      this.setDamage(this.getDamage() - 1.0F);
    }

    this.lastX = this.locX;
    this.lastY = this.locY;
    this.lastZ = this.locZ;
    byte b0 = 5;
    double d0 = 0.0D;

    for (int i = 0; i < b0; ++i) {
      double d1 =
          this.boundingBox.b
              + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 0) / (double) b0
              - 0.125D;
      double d2 =
          this.boundingBox.b
              + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 1) / (double) b0
              - 0.125D;
      AxisAlignedBB axisalignedbb =
          AxisAlignedBB.a()
              .a(
                  this.boundingBox.a,
                  d1,
                  this.boundingBox.c,
                  this.boundingBox.d,
                  d2,
                  this.boundingBox.f);

      if (this.world.b(axisalignedbb, Material.WATER)) {
        d0 += 1.0D / (double) b0;
      }
    }

    double d3 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
    double d4;
    double d5;

    if (d3 > 0.26249999999999996D) {
      d4 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
      d5 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);

      for (int j = 0; (double) j < 1.0D + d3 * 60.0D; ++j) {
        double d6 = (double) (this.random.nextFloat() * 2.0F - 1.0F);
        double d7 = (double) (this.random.nextInt(2) * 2 - 1) * 0.7D;
        double d8;
        double d9;

        if (this.random.nextBoolean()) {
          d8 = this.locX - d4 * d6 * 0.8D + d5 * d7;
          d9 = this.locZ - d5 * d6 * 0.8D - d4 * d7;
          this.world.addParticle(
              "splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
        } else {
          d8 = this.locX + d4 + d5 * d6 * 0.7D;
          d9 = this.locZ + d5 - d4 * d6 * 0.7D;
          this.world.addParticle(
              "splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
        }
      }
    }

    double d10;
    double d11;

    if (this.world.isStatic && this.a) {
      if (this.c > 0) {
        d4 = this.locX + (this.d - this.locX) / (double) this.c;
        d5 = this.locY + (this.e - this.locY) / (double) this.c;
        d10 = this.locZ + (this.f - this.locZ) / (double) this.c;
        d11 = MathHelper.g(this.g - (double) this.yaw);
        this.yaw = (float) ((double) this.yaw + d11 / (double) this.c);
        this.pitch =
            (float) ((double) this.pitch + (this.h - (double) this.pitch) / (double) this.c);
        --this.c;
        this.setPosition(d4, d5, d10);
        this.b(this.yaw, this.pitch);
      } else {
        d4 = this.locX + this.motX;
        d5 = this.locY + this.motY;
        d10 = this.locZ + this.motZ;
        this.setPosition(d4, d5, d10);
        if (this.onGround) {
          this.motX *= 0.5D;
          this.motY *= 0.5D;
          this.motZ *= 0.5D;
        }

        this.motX *= 0.9900000095367432D;
        this.motY *= 0.949999988079071D;
        this.motZ *= 0.9900000095367432D;
      }
    } else {
      if (d0 < 1.0D) {
        d4 = d0 * 2.0D - 1.0D;
        this.motY += 0.03999999910593033D * d4;
      } else {
        if (this.motY < 0.0D) {
          this.motY /= 2.0D;
        }

        this.motY += 0.007000000216066837D;
      }

      if (this.passenger != null && this.passenger instanceof EntityLiving) {
        d4 = (double) ((EntityLiving) this.passenger).bf;
        if (d4 > 0.0D) {
          d5 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F));
          d10 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F));
          this.motX += d5 * this.b * 0.05000000074505806D;
          this.motZ += d10 * this.b * 0.05000000074505806D;
        }
      }

      d4 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
      if (d4 > 0.35D) {
        d5 = 0.35D / d4;
        this.motX *= d5;
        this.motZ *= d5;
        d4 = 0.35D;
      }

      if (d4 > d3 && this.b < 0.35D) {
        this.b += (0.35D - this.b) / 35.0D;
        if (this.b > 0.35D) {
          this.b = 0.35D;
        }
      } else {
        this.b -= (this.b - 0.07D) / 35.0D;
        if (this.b < 0.07D) {
          this.b = 0.07D;
        }
      }

      if (this.onGround) {
        this.motX *= 0.5D;
        this.motY *= 0.5D;
        this.motZ *= 0.5D;
      }

      this.move(this.motX, this.motY, this.motZ);
      if (this.positionChanged && d3 > 0.2D) {
        if (!this.world.isStatic && !this.dead) {
          this.die();

          int k;

          for (k = 0; k < 3; ++k) {
            this.a(Block.WOOD.id, 1, 0.0F);
          }

          for (k = 0; k < 2; ++k) {
            this.a(Item.STICK.id, 1, 0.0F);
          }
        }
      } else {
        this.motX *= 0.9900000095367432D;
        this.motY *= 0.949999988079071D;
        this.motZ *= 0.9900000095367432D;
      }

      this.pitch = 0.0F;
      d5 = (double) this.yaw;
      d10 = this.lastX - this.locX;
      d11 = this.lastZ - this.locZ;
      if (d10 * d10 + d11 * d11 > 0.001D) {
        d5 = (double) ((float) (Math.atan2(d11, d10) * 180.0D / 3.141592653589793D));
      }

      double d12 = MathHelper.g(d5 - (double) this.yaw);

      if (d12 > 20.0D) {
        d12 = 20.0D;
      }

      if (d12 < -20.0D) {
        d12 = -20.0D;
      }

      this.yaw = (float) ((double) this.yaw + d12);
      this.b(this.yaw, this.pitch);
      if (!this.world.isStatic) {
        List list =
            this.world.getEntities(
                this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
        int l;

        if (list != null && !list.isEmpty()) {
          for (l = 0; l < list.size(); ++l) {
            Entity entity = (Entity) list.get(l);

            if (entity != this.passenger && entity.L() && entity instanceof EntityBoat) {
              entity.collide(this);
            }
          }
        }

        for (l = 0; l < 4; ++l) {
          int i1 = MathHelper.floor(this.locX + ((double) (l % 2) - 0.5D) * 0.8D);
          int j1 = MathHelper.floor(this.locZ + ((double) (l / 2) - 0.5D) * 0.8D);

          for (int k1 = 0; k1 < 2; ++k1) {
            int l1 = MathHelper.floor(this.locY) + k1;
            int i2 = this.world.getTypeId(i1, l1, j1);

            if (i2 == Block.SNOW.id) {
              this.world.setAir(i1, l1, j1);
            } else if (i2 == Block.WATER_LILY.id) {
              this.world.setAir(i1, l1, j1, true);
            }
          }
        }

        if (this.passenger != null && this.passenger.dead) {
          this.passenger = null;
        }
      }
    }
  }
  public void t_() {
    if (this.getType() > 0) {
      this.j(this.getType() - 1);
    }

    if (this.getDamage() > 0.0F) {
      this.setDamage(this.getDamage() - 1.0F);
    }

    if (this.locY < -64.0D) {
      this.O();
    }

    int var2;
    if (!this.world.isClientSide && this.world instanceof WorldServer) {
      this.world.methodProfiler.a("portal");
      MinecraftServer var1 = ((WorldServer) this.world).getMinecraftServer();
      var2 = this.L();
      if (this.ak) {
        if (var1.getAllowNether()) {
          if (this.vehicle == null && this.al++ >= var2) {
            this.al = var2;
            this.portalCooldown = this.aq();
            byte var3;
            if (this.world.worldProvider.getDimension() == -1) {
              var3 = 0;
            } else {
              var3 = -1;
            }

            this.c(var3);
          }

          this.ak = false;
        }
      } else {
        if (this.al > 0) {
          this.al -= 4;
        }

        if (this.al < 0) {
          this.al = 0;
        }
      }

      if (this.portalCooldown > 0) {
        --this.portalCooldown;
      }

      this.world.methodProfiler.b();
    }

    if (this.world.isClientSide) {
      if (this.d > 0) {
        double var15 = this.locX + (this.e - this.locX) / (double) this.d;
        double var17 = this.locY + (this.f - this.locY) / (double) this.d;
        double var18 = this.locZ + (this.g - this.locZ) / (double) this.d;
        double var7 = MathHelper.g(this.h - (double) this.yaw);
        this.yaw = (float) ((double) this.yaw + var7 / (double) this.d);
        this.pitch =
            (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d);
        --this.d;
        this.setPosition(var15, var17, var18);
        this.setYawPitch(this.yaw, this.pitch);
      } else {
        this.setPosition(this.locX, this.locY, this.locZ);
        this.setYawPitch(this.yaw, this.pitch);
      }

    } else {
      this.lastX = this.locX;
      this.lastY = this.locY;
      this.lastZ = this.locZ;
      this.motY -= 0.03999999910593033D;
      int var14 = MathHelper.floor(this.locX);
      var2 = MathHelper.floor(this.locY);
      int var16 = MathHelper.floor(this.locZ);
      if (BlockMinecartTrackAbstract.e(this.world, new BlockPosition(var14, var2 - 1, var16))) {
        --var2;
      }

      BlockPosition var4 = new BlockPosition(var14, var2, var16);
      IBlockData var5 = this.world.getType(var4);
      if (BlockMinecartTrackAbstract.d(var5)) {
        this.a(var4, var5);
        if (var5.getBlock() == Blocks.ACTIVATOR_RAIL) {
          this.a(var14, var2, var16, ((Boolean) var5.get(BlockPoweredRail.POWERED)).booleanValue());
        }
      } else {
        this.n();
      }

      this.checkBlockCollisions();
      this.pitch = 0.0F;
      double var6 = this.lastX - this.locX;
      double var8 = this.lastZ - this.locZ;
      if (var6 * var6 + var8 * var8 > 0.001D) {
        this.yaw = (float) (MathHelper.b(var8, var6) * 180.0D / 3.141592653589793D);
        if (this.a) {
          this.yaw += 180.0F;
        }
      }

      double var10 = (double) MathHelper.g(this.yaw - this.lastYaw);
      if (var10 < -170.0D || var10 >= 170.0D) {
        this.yaw += 180.0F;
        this.a = !this.a;
      }

      this.setYawPitch(this.yaw, this.pitch);
      Iterator var12 =
          this.world
              .getEntities(
                  this,
                  this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D))
              .iterator();

      while (var12.hasNext()) {
        Entity var13 = (Entity) var12.next();
        if (var13 != this.passenger && var13.ae() && var13 instanceof EntityMinecartAbstract) {
          var13.collide(this);
        }
      }

      if (this.passenger != null && this.passenger.dead) {
        if (this.passenger.vehicle == this) {
          this.passenger.vehicle = null;
        }

        this.passenger = null;
      }

      this.W();
    }
  }
Ejemplo n.º 6
0
  public void c() {
    if (this.bq > 0) {
      --this.bq;
    }

    if (this.bh > 0) {
      double d0 = this.locX + (this.bi - this.locX) / (double) this.bh;
      double d1 = this.locY + (this.bj - this.locY) / (double) this.bh;
      double d2 = this.locZ + (this.bk - this.locZ) / (double) this.bh;
      double d3 = MathHelper.g(this.bl - (double) this.yaw);

      this.yaw = (float) ((double) this.yaw + d3 / (double) this.bh);
      this.pitch =
          (float) ((double) this.pitch + (this.bm - (double) this.pitch) / (double) this.bh);
      --this.bh;
      this.setPosition(d0, d1, d2);
      this.b(this.yaw, this.pitch);
    } else if (!this.bm()) {
      this.motX *= 0.98D;
      this.motY *= 0.98D;
      this.motZ *= 0.98D;
    }

    if (Math.abs(this.motX) < 0.005D) {
      this.motX = 0.0D;
    }

    if (Math.abs(this.motY) < 0.005D) {
      this.motY = 0.0D;
    }

    if (Math.abs(this.motZ) < 0.005D) {
      this.motZ = 0.0D;
    }

    this.world.methodProfiler.a("ai");
    if (this.bc()) {
      this.bd = false;
      this.be = 0.0F;
      this.bf = 0.0F;
      this.bg = 0.0F;
    } else if (this.bm()) {
      if (this.bf()) {
        this.world.methodProfiler.a("newAi");
        this.bi();
        this.world.methodProfiler.b();
      } else {
        this.world.methodProfiler.a("oldAi");
        this.bl();
        this.world.methodProfiler.b();
        this.aP = this.yaw;
      }
    }

    this.world.methodProfiler.b();
    this.world.methodProfiler.a("jump");
    if (this.bd) {
      if (!this.H() && !this.J()) {
        if (this.onGround && this.bq == 0) {
          this.be();
          this.bq = 10;
        }
      } else {
        this.motY += 0.03999999910593033D;
      }
    } else {
      this.bq = 0;
    }

    this.world.methodProfiler.b();
    this.world.methodProfiler.a("travel");
    this.be *= 0.98F;
    this.bf *= 0.98F;
    this.bg *= 0.9F;
    this.e(this.be, this.bf);
    this.world.methodProfiler.b();
    this.world.methodProfiler.a("push");
    if (!this.world.isStatic) {
      this.bj();
    }

    this.world.methodProfiler.b();
  }
Ejemplo n.º 7
0
  public void j_() {
    if (this.g != null) {
      this.g.a();
    }

    if (this.j() > 0) {
      this.h(this.j() - 1);
    }

    if (this.getDamage() > 0) {
      this.setDamage(this.getDamage() - 1);
    }

    if (this.locY < -64.0D) {
      this.C();
    }

    if (this.h() && this.random.nextInt(4) == 0) {
      this.world.addParticle(
          "largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
    }

    if (this.world.isStatic) {
      if (this.j > 0) {
        double d0 = this.locX + (this.as - this.locX) / (double) this.j;
        double d1 = this.locY + (this.at - this.locY) / (double) this.j;
        double d2 = this.locZ + (this.au - this.locZ) / (double) this.j;
        double d3 = MathHelper.g(this.av - (double) this.yaw);

        this.yaw = (float) ((double) this.yaw + d3 / (double) this.j);
        this.pitch =
            (float) ((double) this.pitch + (this.aw - (double) this.pitch) / (double) this.j);
        --this.j;
        this.setPosition(d0, d1, d2);
        this.b(this.yaw, this.pitch);
      } else {
        this.setPosition(this.locX, this.locY, this.locZ);
        this.b(this.yaw, this.pitch);
      }
    } else {
      this.lastX = this.locX;
      this.lastY = this.locY;
      this.lastZ = this.locZ;
      this.motY -= 0.03999999910593033D;
      int i = MathHelper.floor(this.locX);
      int j = MathHelper.floor(this.locY);
      int k = MathHelper.floor(this.locZ);

      if (BlockMinecartTrack.e_(this.world, i, j - 1, k)) {
        --j;
      }

      double d4 = 0.4D;
      double d5 = 0.0078125D;
      int l = this.world.getTypeId(i, j, k);

      if (BlockMinecartTrack.d(l)) {
        this.fallDistance = 0.0F;
        Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
        int i1 = this.world.getData(i, j, k);

        this.locY = (double) j;
        boolean flag = false;
        boolean flag1 = false;

        if (l == Block.GOLDEN_RAIL.id) {
          flag = (i1 & 8) != 0;
          flag1 = !flag;
        }

        if (((BlockMinecartTrack) Block.byId[l]).p()) {
          i1 &= 7;
        }

        if (i1 >= 2 && i1 <= 5) {
          this.locY = (double) (j + 1);
        }

        if (i1 == 2) {
          this.motX -= d5;
        }

        if (i1 == 3) {
          this.motX += d5;
        }

        if (i1 == 4) {
          this.motZ += d5;
        }

        if (i1 == 5) {
          this.motZ -= d5;
        }

        int[][] aint = matrix[i1];
        double d6 = (double) (aint[1][0] - aint[0][0]);
        double d7 = (double) (aint[1][2] - aint[0][2]);
        double d8 = Math.sqrt(d6 * d6 + d7 * d7);
        double d9 = this.motX * d6 + this.motZ * d7;

        if (d9 < 0.0D) {
          d6 = -d6;
          d7 = -d7;
        }

        double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);

        this.motX = d10 * d6 / d8;
        this.motZ = d10 * d7 / d8;
        double d11;
        double d12;

        if (this.passenger != null) {
          d12 =
              this.passenger.motX * this.passenger.motX + this.passenger.motZ * this.passenger.motZ;
          d11 = this.motX * this.motX + this.motZ * this.motZ;
          if (d12 > 1.0E-4D && d11 < 0.01D) {
            this.motX += this.passenger.motX * 0.1D;
            this.motZ += this.passenger.motZ * 0.1D;
            flag1 = false;
          }
        }

        if (flag1) {
          d12 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
          if (d12 < 0.03D) {
            this.motX *= 0.0D;
            this.motY *= 0.0D;
            this.motZ *= 0.0D;
          } else {
            this.motX *= 0.5D;
            this.motY *= 0.0D;
            this.motZ *= 0.5D;
          }
        }

        d12 = 0.0D;
        d11 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
        double d13 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
        double d14 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
        double d15 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;

        d6 = d14 - d11;
        d7 = d15 - d13;
        double d16;
        double d17;

        if (d6 == 0.0D) {
          this.locX = (double) i + 0.5D;
          d12 = this.locZ - (double) k;
        } else if (d7 == 0.0D) {
          this.locZ = (double) k + 0.5D;
          d12 = this.locX - (double) i;
        } else {
          d16 = this.locX - d11;
          d17 = this.locZ - d13;
          d12 = (d16 * d6 + d17 * d7) * 2.0D;
        }

        this.locX = d11 + d6 * d12;
        this.locZ = d13 + d7 * d12;
        this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
        d16 = this.motX;
        d17 = this.motZ;
        if (this.passenger != null) {
          d16 *= 0.75D;
          d17 *= 0.75D;
        }

        if (d16 < -d4) {
          d16 = -d4;
        }

        if (d16 > d4) {
          d16 = d4;
        }

        if (d17 < -d4) {
          d17 = -d4;
        }

        if (d17 > d4) {
          d17 = d4;
        }

        this.move(d16, 0.0D, d17);
        if (aint[0][1] != 0
            && MathHelper.floor(this.locX) - i == aint[0][0]
            && MathHelper.floor(this.locZ) - k == aint[0][2]) {
          this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
        } else if (aint[1][1] != 0
            && MathHelper.floor(this.locX) - i == aint[1][0]
            && MathHelper.floor(this.locZ) - k == aint[1][2]) {
          this.setPosition(this.locX, this.locY + (double) aint[1][1], this.locZ);
        }

        if (this.passenger != null) {
          this.motX *= 0.996999979019165D;
          this.motY *= 0.0D;
          this.motZ *= 0.996999979019165D;
        } else {
          if (this.type == 2) {
            double d18 = this.b * this.b + this.c * this.c;

            if (d18 > 1.0E-4D) {
              d18 = (double) MathHelper.sqrt(d18);
              this.b /= d18;
              this.c /= d18;
              double d19 = 0.04D;

              this.motX *= 0.800000011920929D;
              this.motY *= 0.0D;
              this.motZ *= 0.800000011920929D;
              this.motX += this.b * d19;
              this.motZ += this.c * d19;
            } else {
              this.motX *= 0.8999999761581421D;
              this.motY *= 0.0D;
              this.motZ *= 0.8999999761581421D;
            }
          }

          this.motX *= 0.9599999785423279D;
          this.motY *= 0.0D;
          this.motZ *= 0.9599999785423279D;
        }

        Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);

        if (vec3d1 != null && vec3d != null) {
          double d20 = (vec3d.d - vec3d1.d) * 0.05D;

          d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
          if (d10 > 0.0D) {
            this.motX = this.motX / d10 * (d10 + d20);
            this.motZ = this.motZ / d10 * (d10 + d20);
          }

          this.setPosition(this.locX, vec3d1.d, this.locZ);
        }

        int j1 = MathHelper.floor(this.locX);
        int k1 = MathHelper.floor(this.locZ);

        if (j1 != i || k1 != k) {
          d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
          this.motX = d10 * (double) (j1 - i);
          this.motZ = d10 * (double) (k1 - k);
        }

        double d21;

        if (this.type == 2) {
          d21 = this.b * this.b + this.c * this.c;
          if (d21 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
            d21 = (double) MathHelper.sqrt(d21);
            this.b /= d21;
            this.c /= d21;
            if (this.b * this.motX + this.c * this.motZ < 0.0D) {
              this.b = 0.0D;
              this.c = 0.0D;
            } else {
              this.b = this.motX;
              this.c = this.motZ;
            }
          }
        }

        if (flag) {
          d21 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
          if (d21 > 0.01D) {
            double d22 = 0.06D;

            this.motX += this.motX / d21 * d22;
            this.motZ += this.motZ / d21 * d22;
          } else if (i1 == 1) {
            if (this.world.t(i - 1, j, k)) {
              this.motX = 0.02D;
            } else if (this.world.t(i + 1, j, k)) {
              this.motX = -0.02D;
            }
          } else if (i1 == 0) {
            if (this.world.t(i, j, k - 1)) {
              this.motZ = 0.02D;
            } else if (this.world.t(i, j, k + 1)) {
              this.motZ = -0.02D;
            }
          }
        }
      } else {
        if (this.motX < -d4) {
          this.motX = -d4;
        }

        if (this.motX > d4) {
          this.motX = d4;
        }

        if (this.motZ < -d4) {
          this.motZ = -d4;
        }

        if (this.motZ > d4) {
          this.motZ = d4;
        }

        if (this.onGround) {
          this.motX *= 0.5D;
          this.motY *= 0.5D;
          this.motZ *= 0.5D;
        }

        this.move(this.motX, this.motY, this.motZ);
        if (!this.onGround) {
          this.motX *= 0.949999988079071D;
          this.motY *= 0.949999988079071D;
          this.motZ *= 0.949999988079071D;
        }
      }

      this.D();
      this.pitch = 0.0F;
      double d23 = this.lastX - this.locX;
      double d24 = this.lastZ - this.locZ;

      if (d23 * d23 + d24 * d24 > 0.001D) {
        this.yaw = (float) (Math.atan2(d24, d23) * 180.0D / 3.141592653589793D);
        if (this.f) {
          this.yaw += 180.0F;
        }
      }

      double d25 = (double) MathHelper.g(this.yaw - this.lastYaw);

      if (d25 < -170.0D || d25 >= 170.0D) {
        this.yaw += 180.0F;
        this.f = !this.f;
      }

      this.b(this.yaw, this.pitch);
      List list =
          this.world.getEntities(
              this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));

      if (list != null && !list.isEmpty()) {
        for (int l1 = 0; l1 < list.size(); ++l1) {
          Entity entity = (Entity) list.get(l1);

          if (entity != this.passenger && entity.M() && entity instanceof EntityMinecart) {
            entity.collide(this);
          }
        }
      }

      if (this.passenger != null && this.passenger.dead) {
        if (this.passenger.vehicle == this) {
          this.passenger.vehicle = null;
        }

        this.passenger = null;
      }

      if (this.e > 0) {
        --this.e;
      }

      if (this.e <= 0) {
        this.b = this.c = 0.0D;
      }

      this.e(this.e > 0);
    }
  }