コード例 #1
0
  public Vec3D k(double var1, double var3, double var5) {
    int var7 = MathHelper.floor(var1);
    int var8 = MathHelper.floor(var3);
    int var9 = MathHelper.floor(var5);
    if (BlockMinecartTrackAbstract.e(this.world, new BlockPosition(var7, var8 - 1, var9))) {
      --var8;
    }

    IBlockData var10 = this.world.getType(new BlockPosition(var7, var8, var9));
    if (BlockMinecartTrackAbstract.d(var10)) {
      BlockMinecartTrackAbstract.EnumTrackPosition var11 =
          (BlockMinecartTrackAbstract.EnumTrackPosition)
              var10.get(((BlockMinecartTrackAbstract) var10.getBlock()).n());
      int[][] var12 = matrix[var11.a()];
      double var13 = 0.0D;
      double var15 = (double) var7 + 0.5D + (double) var12[0][0] * 0.5D;
      double var17 = (double) var8 + 0.0625D + (double) var12[0][1] * 0.5D;
      double var19 = (double) var9 + 0.5D + (double) var12[0][2] * 0.5D;
      double var21 = (double) var7 + 0.5D + (double) var12[1][0] * 0.5D;
      double var23 = (double) var8 + 0.0625D + (double) var12[1][1] * 0.5D;
      double var25 = (double) var9 + 0.5D + (double) var12[1][2] * 0.5D;
      double var27 = var21 - var15;
      double var29 = (var23 - var17) * 2.0D;
      double var31 = var25 - var19;
      if (var27 == 0.0D) {
        var1 = (double) var7 + 0.5D;
        var13 = var5 - (double) var9;
      } else if (var31 == 0.0D) {
        var5 = (double) var9 + 0.5D;
        var13 = var1 - (double) var7;
      } else {
        double var33 = var1 - var15;
        double var35 = var5 - var19;
        var13 = (var33 * var27 + var35 * var31) * 2.0D;
      }

      var1 = var15 + var27 * var13;
      var3 = var17 + var29 * var13;
      var5 = var19 + var31 * var13;
      if (var29 < 0.0D) {
        ++var3;
      }

      if (var29 > 0.0D) {
        var3 += 0.5D;
      }

      return new Vec3D(var1, var3, var5);
    } else {
      return null;
    }
  }
コード例 #2
0
  protected void a(BlockPosition var1, IBlockData var2) {
    this.fallDistance = 0.0F;
    Vec3D var3 = this.k(this.locX, this.locY, this.locZ);
    this.locY = (double) var1.getY();
    boolean var4 = false;
    boolean var5 = false;
    BlockMinecartTrackAbstract var6 = (BlockMinecartTrackAbstract) var2.getBlock();
    if (var6 == Blocks.GOLDEN_RAIL) {
      var4 = ((Boolean) var2.get(BlockPoweredRail.POWERED)).booleanValue();
      var5 = !var4;
    }

    double var7 = 0.0078125D;
    BlockMinecartTrackAbstract.EnumTrackPosition var9 =
        (BlockMinecartTrackAbstract.EnumTrackPosition) var2.get(var6.n());
    switch (EntityMinecartAbstract.SyntheticClass_1.b[var9.ordinal()]) {
      case 1:
        this.motX -= 0.0078125D;
        ++this.locY;
        break;
      case 2:
        this.motX += 0.0078125D;
        ++this.locY;
        break;
      case 3:
        this.motZ += 0.0078125D;
        ++this.locY;
        break;
      case 4:
        this.motZ -= 0.0078125D;
        ++this.locY;
    }

    int[][] var10 = matrix[var9.a()];
    double var11 = (double) (var10[1][0] - var10[0][0]);
    double var13 = (double) (var10[1][2] - var10[0][2]);
    double var15 = Math.sqrt(var11 * var11 + var13 * var13);
    double var17 = this.motX * var11 + this.motZ * var13;
    if (var17 < 0.0D) {
      var11 = -var11;
      var13 = -var13;
    }

    double var19 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
    if (var19 > 2.0D) {
      var19 = 2.0D;
    }

    this.motX = var19 * var11 / var15;
    this.motZ = var19 * var13 / var15;
    double var21;
    double var23;
    double var25;
    double var27;
    if (this.passenger instanceof EntityLiving) {
      var21 = (double) ((EntityLiving) this.passenger).ba;
      if (var21 > 0.0D) {
        var23 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F));
        var25 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F));
        var27 = this.motX * this.motX + this.motZ * this.motZ;
        if (var27 < 0.01D) {
          this.motX += var23 * 0.1D;
          this.motZ += var25 * 0.1D;
          var5 = false;
        }
      }
    }

    if (var5) {
      var21 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
      if (var21 < 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;
      }
    }

    var21 = 0.0D;
    var23 = (double) var1.getX() + 0.5D + (double) var10[0][0] * 0.5D;
    var25 = (double) var1.getZ() + 0.5D + (double) var10[0][2] * 0.5D;
    var27 = (double) var1.getX() + 0.5D + (double) var10[1][0] * 0.5D;
    double var29 = (double) var1.getZ() + 0.5D + (double) var10[1][2] * 0.5D;
    var11 = var27 - var23;
    var13 = var29 - var25;
    double var31;
    double var33;
    if (var11 == 0.0D) {
      this.locX = (double) var1.getX() + 0.5D;
      var21 = this.locZ - (double) var1.getZ();
    } else if (var13 == 0.0D) {
      this.locZ = (double) var1.getZ() + 0.5D;
      var21 = this.locX - (double) var1.getX();
    } else {
      var31 = this.locX - var23;
      var33 = this.locZ - var25;
      var21 = (var31 * var11 + var33 * var13) * 2.0D;
    }

    this.locX = var23 + var11 * var21;
    this.locZ = var25 + var13 * var21;
    this.setPosition(this.locX, this.locY, this.locZ);
    var31 = this.motX;
    var33 = this.motZ;
    if (this.passenger != null) {
      var31 *= 0.75D;
      var33 *= 0.75D;
    }

    double var35 = this.m();
    var31 = MathHelper.a(var31, -var35, var35);
    var33 = MathHelper.a(var33, -var35, var35);
    this.move(var31, 0.0D, var33);
    if (var10[0][1] != 0
        && MathHelper.floor(this.locX) - var1.getX() == var10[0][0]
        && MathHelper.floor(this.locZ) - var1.getZ() == var10[0][2]) {
      this.setPosition(this.locX, this.locY + (double) var10[0][1], this.locZ);
    } else if (var10[1][1] != 0
        && MathHelper.floor(this.locX) - var1.getX() == var10[1][0]
        && MathHelper.floor(this.locZ) - var1.getZ() == var10[1][2]) {
      this.setPosition(this.locX, this.locY + (double) var10[1][1], this.locZ);
    }

    this.o();
    Vec3D var37 = this.k(this.locX, this.locY, this.locZ);
    if (var37 != null && var3 != null) {
      double var38 = (var3.b - var37.b) * 0.05D;
      var19 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
      if (var19 > 0.0D) {
        this.motX = this.motX / var19 * (var19 + var38);
        this.motZ = this.motZ / var19 * (var19 + var38);
      }

      this.setPosition(this.locX, var37.b, this.locZ);
    }

    int var44 = MathHelper.floor(this.locX);
    int var39 = MathHelper.floor(this.locZ);
    if (var44 != var1.getX() || var39 != var1.getZ()) {
      var19 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
      this.motX = var19 * (double) (var44 - var1.getX());
      this.motZ = var19 * (double) (var39 - var1.getZ());
    }

    if (var4) {
      double var40 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
      if (var40 > 0.01D) {
        double var42 = 0.06D;
        this.motX += this.motX / var40 * var42;
        this.motZ += this.motZ / var40 * var42;
      } else if (var9 == BlockMinecartTrackAbstract.EnumTrackPosition.EAST_WEST) {
        if (this.world.getType(var1.west()).getBlock().isOccluding()) {
          this.motX = 0.02D;
        } else if (this.world.getType(var1.east()).getBlock().isOccluding()) {
          this.motX = -0.02D;
        }
      } else if (var9 == BlockMinecartTrackAbstract.EnumTrackPosition.NORTH_SOUTH) {
        if (this.world.getType(var1.north()).getBlock().isOccluding()) {
          this.motZ = 0.02D;
        } else if (this.world.getType(var1.south()).getBlock().isOccluding()) {
          this.motZ = -0.02D;
        }
      }
    }
  }
コード例 #3
0
  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();
    }
  }