Ejemplo n.º 1
0
  public void a(ItemStack itemstack) {
    this.makeSound("random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F);

    for (int i = 0; i < 5; ++i) {
      Vec3D vec3d =
          this.world
              .getVec3DPool()
              .create(
                  ((double) this.random.nextFloat() - 0.5D) * 0.1D,
                  Math.random() * 0.1D + 0.1D,
                  0.0D);

      vec3d.a(-this.pitch * 3.1415927F / 180.0F);
      vec3d.b(-this.yaw * 3.1415927F / 180.0F);
      Vec3D vec3d1 =
          this.world
              .getVec3DPool()
              .create(
                  ((double) this.random.nextFloat() - 0.5D) * 0.3D,
                  (double) (-this.random.nextFloat()) * 0.6D - 0.3D,
                  0.6D);

      vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
      vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
      vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
      this.world.addParticle(
          "iconcrack_" + itemstack.getItem().id,
          vec3d1.c,
          vec3d1.d,
          vec3d1.e,
          vec3d.c,
          vec3d.d + 0.05D,
          vec3d.e);
    }
  }
Ejemplo n.º 2
0
  protected boolean c(Entity entity) {
    Vec3D vec3d =
        Vec3D.a(
            this.locX - entity.locX,
            this.boundingBox.b
                + (double) (this.length / 2.0F)
                - entity.locY
                + (double) entity.getHeadHeight(),
            this.locZ - entity.locZ);

    vec3d = vec3d.a();
    double d0 = 16.0D;
    double d1 = this.locX + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.a * d0;
    double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.b * d0;
    double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;

    return this.k(d1, d2, d3);
  }
Ejemplo n.º 3
0
 private Vec3D f() {
   Random localRandom = this.a.au();
   for (int i = 0; i < 10; i++) {
     int j = MathHelper.floor(this.a.locX + localRandom.nextInt(20) - 10.0D);
     int k = MathHelper.floor(this.a.boundingBox.b + localRandom.nextInt(6) - 3.0D);
     int m = MathHelper.floor(this.a.locZ + localRandom.nextInt(20) - 10.0D);
     if ((!this.f.j(j, k, m)) && (this.a.a(j, k, m) < 0.0F)) return Vec3D.a().create(j, k, m);
   }
   return null;
 }
Ejemplo n.º 4
0
  protected void b(ItemStack itemstack, int i) {
    if (itemstack.m() == EnumAnimation.c) {
      this.world.makeSound(this, "random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
    }

    if (itemstack.m() == EnumAnimation.b) {
      for (int j = 0; j < i; ++j) {
        Vec3D vec3d =
            Vec3D.create(
                ((double) this.random.nextFloat() - 0.5D) * 0.1D,
                Math.random() * 0.1D + 0.1D,
                0.0D);

        vec3d.a(-this.pitch * 3.1415927F / 180.0F);
        vec3d.b(-this.yaw * 3.1415927F / 180.0F);
        Vec3D vec3d1 =
            Vec3D.create(
                ((double) this.random.nextFloat() - 0.5D) * 0.3D,
                (double) (-this.random.nextFloat()) * 0.6D - 0.3D,
                0.6D);

        vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
        vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
        vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
        this.world.a(
            "iconcrack_" + itemstack.getItem().id,
            vec3d1.a,
            vec3d1.b,
            vec3d1.c,
            vec3d.a,
            vec3d.b + 0.05D,
            vec3d.c);
      }

      this.world.makeSound(
          this,
          "random.eat",
          0.5F + 0.5F * (float) this.random.nextInt(2),
          (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
    }
  }
Ejemplo n.º 5
0
  private boolean f(EntityHuman entityhuman) {
    ItemStack itemstack = entityhuman.inventory.armor[3];

    if (itemstack != null && itemstack.getItem() == Item.getItemOf(Blocks.PUMPKIN)) {
      return false;
    } else {
      Vec3D vec3d = entityhuman.j(1.0F).a();
      Vec3D vec3d1 =
          Vec3D.a(
              this.locX - entityhuman.locX,
              this.boundingBox.b
                  + (double) (this.length / 2.0F)
                  - (entityhuman.locY + (double) entityhuman.getHeadHeight()),
              this.locZ - entityhuman.locZ);
      double d0 = vec3d1.b();

      vec3d1 = vec3d1.a();
      double d1 = vec3d.b(vec3d1);

      return d1 > 1.0D - 0.025D / d0 && entityhuman.hasLineOfSight(this);
    }
  }
Ejemplo n.º 6
0
  protected MovingObjectPosition a(World world, EntityHuman entityhuman, boolean flag) {
    float f = 1.0F;
    float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
    float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
    double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
    double d1 =
        entityhuman.lastY
            + (entityhuman.locY - entityhuman.lastY) * (double) f
            + 1.62D
            - (double) entityhuman.height;
    double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
    Vec3D vec3d = Vec3D.a(d0, d1, d2);
    float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
    float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
    float f5 = -MathHelper.cos(-f1 * 0.017453292F);
    float f6 = MathHelper.sin(-f1 * 0.017453292F);
    float f7 = f4 * f5;
    float f8 = f3 * f5;
    double d3 = 5.0D;
    Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);

    return world.rayTrace(vec3d, vec3d1, flag, !flag, false);
  }
Ejemplo n.º 7
0
  public void h() {
    super.h();
    if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
      float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);

      this.lastYaw =
          this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
      this.lastPitch =
          this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
    }

    Block block = this.world.getType(this.d, this.e, this.f);

    if (block.getMaterial() != Material.AIR) {
      block.updateShape(this.world, this.d, this.e, this.f);
      AxisAlignedBB axisalignedbb = block.a(this.world, this.d, this.e, this.f);

      if (axisalignedbb != null && axisalignedbb.a(Vec3D.a(this.locX, this.locY, this.locZ))) {
        this.inGround = true;
      }
    }

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

    if (this.inGround) {
      int i = this.world.getData(this.d, this.e, this.f);

      if (block == this.g && i == this.h) {
        ++this.at;
        if (this.at == 1200) {
          this.die();
        }
      } else {
        this.inGround = false;
        this.motX *= (double) (this.random.nextFloat() * 0.2F);
        this.motY *= (double) (this.random.nextFloat() * 0.2F);
        this.motZ *= (double) (this.random.nextFloat() * 0.2F);
        this.at = 0;
        this.au = 0;
      }
    } else {
      ++this.au;
      Vec3D vec3d = Vec3D.a(this.locX, this.locY, this.locZ);
      Vec3D vec3d1 = Vec3D.a(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
      MovingObjectPosition movingobjectposition =
          this.world.rayTrace(vec3d, vec3d1, false, true, false);

      vec3d = Vec3D.a(this.locX, this.locY, this.locZ);
      vec3d1 = Vec3D.a(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
      if (movingobjectposition != null) {
        vec3d1 =
            Vec3D.a(
                movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
      }

      Entity entity = null;
      List list =
          this.world.getEntities(
              this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
      double d0 = 0.0D;

      int j;
      float f1;

      for (j = 0; j < list.size(); ++j) {
        Entity entity1 = (Entity) list.get(j);

        if (entity1.Q() && (entity1 != this.shooter || this.au >= 5)) {
          f1 = 0.3F;
          AxisAlignedBB axisalignedbb1 =
              entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
          MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);

          if (movingobjectposition1 != null) {
            double d1 =
                vec3d.distanceSquared(
                    movingobjectposition1.pos); // CraftBukkit - distance efficiency

            if (d1 < d0 || d0 == 0.0D) {
              entity = entity1;
              d0 = d1;
            }
          }
        }
      }

      if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
      }

      if (movingobjectposition != null
          && movingobjectposition.entity != null
          && movingobjectposition.entity instanceof EntityHuman) {
        EntityHuman entityhuman = (EntityHuman) movingobjectposition.entity;

        if (entityhuman.abilities.isInvulnerable
            || this.shooter instanceof EntityHuman
                && !((EntityHuman) this.shooter).a(entityhuman)) {
          movingobjectposition = null;
        }
      }

      float f2;
      float f3;

      if (movingobjectposition != null) {
        org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(
            this); // CraftBukkit - Call event

        if (movingobjectposition.entity != null) {
          f2 =
              MathHelper.sqrt(
                  this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
          int k = MathHelper.f((double) f2 * this.damage);

          if (this.isCritical()) {
            k += this.random.nextInt(k / 2 + 2);
          }

          DamageSource damagesource = null;

          if (this.shooter == null) {
            damagesource = DamageSource.arrow(this, this);
          } else {
            damagesource = DamageSource.arrow(this, this.shooter);
          }

          // CraftBukkit start - Moved damage call
          if (movingobjectposition.entity.damageEntity(damagesource, k)) {
            if (this.isBurning()
                && !(movingobjectposition.entity instanceof EntityEnderman)
                && (!(movingobjectposition.entity instanceof EntityPlayer)
                    || !(this.shooter instanceof EntityPlayer)
                    || this.world
                        .pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a
                                     // player
              EntityCombustByEntityEvent combustEvent =
                  new EntityCombustByEntityEvent(
                      this.getBukkitEntity(), entity.getBukkitEntity(), 5);
              org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);

              if (!combustEvent.isCancelled()) {
                movingobjectposition.entity.setOnFire(combustEvent.getDuration());
              }
              // CraftBukkit end
            }

            // if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) { //
            // CraftBukkit - moved up
            if (movingobjectposition.entity instanceof EntityLiving) {
              EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;

              if (!this.world.isStatic) {
                entityliving.p(entityliving.aY() + 1);
              }

              if (this.knockbackStrength > 0) {
                f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
                if (f3 > 0.0F) {
                  movingobjectposition.entity.g(
                      this.motX
                          * (double) this.knockbackStrength
                          * 0.6000000238418579D
                          / (double) f3,
                      0.1D,
                      this.motZ
                          * (double) this.knockbackStrength
                          * 0.6000000238418579D
                          / (double) f3);
                }
              }

              if (this.shooter != null && this.shooter instanceof EntityLiving) {
                EnchantmentManager.a(entityliving, this.shooter);
                EnchantmentManager.b((EntityLiving) this.shooter, entityliving);
              }

              if (this.shooter != null
                  && movingobjectposition.entity != this.shooter
                  && movingobjectposition.entity instanceof EntityHuman
                  && this.shooter instanceof EntityPlayer) {
                ((EntityPlayer) this.shooter)
                    .playerConnection.sendPacket(new PacketPlayOutGameStateChange(6, 0.0F));
              }
            }

            this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
            if (!(movingobjectposition.entity instanceof EntityEnderman)) {
              this.die();
            }
          } else {
            this.motX *= -0.10000000149011612D;
            this.motY *= -0.10000000149011612D;
            this.motZ *= -0.10000000149011612D;
            this.yaw += 180.0F;
            this.lastYaw += 180.0F;
            this.au = 0;
          }
        } else {
          this.d = movingobjectposition.b;
          this.e = movingobjectposition.c;
          this.f = movingobjectposition.d;
          this.g = this.world.getType(d, e, f); // CraftBukkit - Get correct block for storage
          this.h = this.world.getData(this.d, this.e, this.f);
          this.motX = (double) ((float) (movingobjectposition.pos.a - this.locX));
          this.motY = (double) ((float) (movingobjectposition.pos.b - this.locY));
          this.motZ = (double) ((float) (movingobjectposition.pos.c - this.locZ));
          f2 =
              MathHelper.sqrt(
                  this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
          this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
          this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
          this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
          this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
          this.inGround = true;
          this.shake = 7;
          this.setCritical(false);
          if (this.g.getMaterial() != Material.AIR) {
            this.g.a(this.world, this.d, this.e, this.f, (Entity) this);
          }
        }
      }

      if (this.isCritical()) {
        for (j = 0; j < 4; ++j) {
          this.world.addParticle(
              "crit",
              this.locX + this.motX * (double) j / 4.0D,
              this.locY + this.motY * (double) j / 4.0D,
              this.locZ + this.motZ * (double) j / 4.0D,
              -this.motX,
              -this.motY + 0.2D,
              -this.motZ);
        }
      }

      this.locX += this.motX;
      this.locY += this.motY;
      this.locZ += this.motZ;
      f2 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
      this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);

      for (this.pitch = (float) (Math.atan2(this.motY, (double) f2) * 180.0D / 3.1415927410125732D);
          this.pitch - this.lastPitch < -180.0F;
          this.lastPitch -= 360.0F) {;
      }

      while (this.pitch - this.lastPitch >= 180.0F) {
        this.lastPitch += 360.0F;
      }

      while (this.yaw - this.lastYaw < -180.0F) {
        this.lastYaw -= 360.0F;
      }

      while (this.yaw - this.lastYaw >= 180.0F) {
        this.lastYaw += 360.0F;
      }

      this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
      this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
      float f4 = 0.99F;

      f1 = 0.05F;
      if (this.L()) {
        for (int l = 0; l < 4; ++l) {
          f3 = 0.25F;
          this.world.addParticle(
              "bubble",
              this.locX - this.motX * (double) f3,
              this.locY - this.motY * (double) f3,
              this.locZ - this.motZ * (double) f3,
              this.motX,
              this.motY,
              this.motZ);
        }

        f4 = 0.8F;
      }

      if (this.K()) {
        this.extinguish();
      }

      this.motX *= (double) f4;
      this.motY *= (double) f4;
      this.motZ *= (double) f4;
      this.motY -= (double) f1;
      this.setPosition(this.locX, this.locY, this.locZ);
      this.H();
    }
  }
  private void w() {
    long i = System.nanoTime();
    ArrayList arraylist = new ArrayList();
    Iterator iterator = trackerList.keySet().iterator();

    while (iterator.hasNext()) {
      String s = (String) iterator.next();
      int j = ((Integer) trackerList.get(s)).intValue();

      if (j > 0) {
        trackerList.put(s, Integer.valueOf(j - 1));
      } else {
        arraylist.add(s);
      }
    }

    int k;

    for (k = 0; k < arraylist.size(); ++k) {
      trackerList.remove(arraylist.get(k));
    }

    AxisAlignedBB.a();
    Vec3D.a();
    ++this.ticks;

    // CraftBukkit start - only send timeupdates to the people in that world

    ((org.bukkit.craftbukkit.scheduler.CraftScheduler) this.server.getScheduler())
        .mainThreadHeartbeat(this.ticks);

    // Send timeupdates to everyone, it will get the right time from the world the player is in.
    if (this.ticks % 20 == 0) {
      for (k = 0; k < this.serverConfigurationManager.players.size(); ++k) {
        EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(k);
        entityplayer.netServerHandler.sendPacket(
            new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time
      }
    }

    for (k = 0; k < this.worlds.size(); ++k) {
      long l = System.nanoTime();
      // if (k == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
      WorldServer worldserver = this.worlds.get(k);

      /* Drop global timeupdates
      if (this.ticks % 20 == 0) {
          this.serverConfigurationManager.a(new Packet4UpdateTime(worldserver.getTime()), worldserver.worldProvider.dimension);
      }
      // CraftBukkit end */

      worldserver.doTick();

      while (true) {
        if (!worldserver.updateLights()) {
          worldserver.tickEntities();
          break;
        }
      }
    }

    // this.g[k][this.ticks % 100] = System.nanoTime() - l; // CraftBukkit
    // } // CraftBukkit

    this.networkListenThread.a();
    this.serverConfigurationManager.tick();

    // CraftBukkit start
    for (k = 0; k < this.worlds.size(); ++k) {
      this.worlds.get(k).tracker.updatePlayers();
    }
    // CraftBukkit end

    for (k = 0; k < this.C.size(); ++k) {
      ((IUpdatePlayerListBox) this.C.get(k)).a();
    }

    try {
      this.b();
    } catch (Exception exception) {
      log.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
    }

    this.f[this.ticks % 100] = System.nanoTime() - i;
    this.u[this.ticks % 100] = Packet.n - this.E;
    this.E = Packet.n;
    this.v[this.ticks % 100] = Packet.o - this.F;
    this.F = Packet.o;
    this.w[this.ticks % 100] = Packet.l - this.G;
    this.G = Packet.l;
    this.x[this.ticks % 100] = Packet.m - this.H;
    this.H = Packet.m;
  }
Ejemplo n.º 9
0
  public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
    this.updateShape(world, i, j, k);
    vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k));
    vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k));
    Vec3D vec3d2 = vec3d.a(vec3d1, this.minX);
    Vec3D vec3d3 = vec3d.a(vec3d1, this.maxX);
    Vec3D vec3d4 = vec3d.b(vec3d1, this.minY);
    Vec3D vec3d5 = vec3d.b(vec3d1, this.maxY);
    Vec3D vec3d6 = vec3d.c(vec3d1, this.minZ);
    Vec3D vec3d7 = vec3d.c(vec3d1, this.maxZ);

    if (!this.a(vec3d2)) {
      vec3d2 = null;
    }

    if (!this.a(vec3d3)) {
      vec3d3 = null;
    }

    if (!this.b(vec3d4)) {
      vec3d4 = null;
    }

    if (!this.b(vec3d5)) {
      vec3d5 = null;
    }

    if (!this.c(vec3d6)) {
      vec3d6 = null;
    }

    if (!this.c(vec3d7)) {
      vec3d7 = null;
    }

    Vec3D vec3d8 = null;

    if (vec3d2 != null && (vec3d8 == null || vec3d.b(vec3d2) < vec3d.b(vec3d8))) {
      vec3d8 = vec3d2;
    }

    if (vec3d3 != null && (vec3d8 == null || vec3d.b(vec3d3) < vec3d.b(vec3d8))) {
      vec3d8 = vec3d3;
    }

    if (vec3d4 != null && (vec3d8 == null || vec3d.b(vec3d4) < vec3d.b(vec3d8))) {
      vec3d8 = vec3d4;
    }

    if (vec3d5 != null && (vec3d8 == null || vec3d.b(vec3d5) < vec3d.b(vec3d8))) {
      vec3d8 = vec3d5;
    }

    if (vec3d6 != null && (vec3d8 == null || vec3d.b(vec3d6) < vec3d.b(vec3d8))) {
      vec3d8 = vec3d6;
    }

    if (vec3d7 != null && (vec3d8 == null || vec3d.b(vec3d7) < vec3d.b(vec3d8))) {
      vec3d8 = vec3d7;
    }

    if (vec3d8 == null) {
      return null;
    } else {
      byte b0 = -1;

      if (vec3d8 == vec3d2) {
        b0 = 4;
      }

      if (vec3d8 == vec3d3) {
        b0 = 5;
      }

      if (vec3d8 == vec3d4) {
        b0 = 0;
      }

      if (vec3d8 == vec3d5) {
        b0 = 1;
      }

      if (vec3d8 == vec3d6) {
        b0 = 2;
      }

      if (vec3d8 == vec3d7) {
        b0 = 3;
      }

      return new MovingObjectPosition(i, j, k, b0, vec3d8.add((double) i, (double) j, (double) k));
    }
  }
Ejemplo n.º 10
0
  public void b_() {
    O = p;
    P = q;
    Q = r;
    super.b_();
    if (a > 0) {
      a--;
    }
    if (f) {
      int i = this.l.a(b, c, d);

      if (i != e) {
        f = false;
        s *= W.nextFloat() * 0.2F;
        t *= W.nextFloat() * 0.2F;
        u *= W.nextFloat() * 0.2F;
        al = 0;
        am = 0;
      } else {
        al++;
        if (al == 1200) {
          q();
        }
        return;
      }
    } else {
      am++;
    }
    Vec3D vec3d = Vec3D.b(p, q, r);
    Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u);
    MovingObjectPosition movingobjectposition = this.l.a(vec3d, vec3d1);

    vec3d = Vec3D.b(p, q, r);
    vec3d1 = Vec3D.b(p + s, q + t, r + u);
    if (movingobjectposition != null) {
      vec3d1 =
          Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
    }
    if (!this.l.z) {
      Entity entity = null;
      List list = this.l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D));
      double d1 = 0.0D;

      for (int l = 0; l < list.size(); l++) {
        Entity entity1 = (Entity) list.get(l);

        if (!entity1.c_() || entity1 == ak && am < 5) {
          continue;
        }
        float f4 = 0.3F;
        AxisAlignedBB axisalignedbb = entity1.z.b(f4, f4, f4);
        MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);

        if (movingobjectposition1 == null) {
          continue;
        }
        double d2 = vec3d.a(movingobjectposition1.f);

        if (d2 < d1 || d1 == 0.0D) {
          entity = entity1;
          d1 = d2;
        }
      }

      if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
      }
    }
    if (movingobjectposition != null) {
      if (movingobjectposition.g != null) {
        if (!movingobjectposition.g.a(((Entity) (ak)), 0)) {;
        }
      }
      if (!this.l.z && W.nextInt(8) == 0) {
        byte byte0 = 1;

        if (W.nextInt(32) == 0) {
          byte0 = 4;
        }
        for (int k = 0; k < byte0; k++) {
          EntityChicken entitychicken = new EntityChicken(this.l);

          entitychicken.c(p, q, r, v, 0.0F);
          this.l.a(((Entity) (entitychicken)));
        }
      }
      for (int j = 0; j < 8; j++) {
        this.l.a("snowballpoof", p, q, r, 0.0D, 0.0D, 0.0D);
      }

      q();
    }
    p += s;
    q += t;
    r += u;
    float f1 = MathHelper.a(s * s + u * u);

    v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D);
    for (w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D);
        w - y < -180F;
        y -= 360F) {;
    }
    for (; w - y >= 180F; y += 360F) {;
    }
    for (; v - x < -180F; x -= 360F) {;
    }
    for (; v - x >= 180F; x += 360F) {;
    }
    w = y + (w - y) * 0.2F;
    v = x + (v - x) * 0.2F;
    float f2 = 0.99F;
    float f5 = 0.03F;

    if (v()) {
      for (int i1 = 0; i1 < 4; i1++) {
        float f3 = 0.25F;

        this.l.a("bubble", p - s * (double) f3, q - t * (double) f3, r - u * (double) f3, s, t, u);
      }

      f2 = 0.8F;
    }
    s *= f2;
    t *= f2;
    u *= f2;
    t -= f5;
    a(p, q, r);
  }
Ejemplo n.º 11
0
  public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) {
    Vec3D vec3d2 = vec3d.a(vec3d1, this.a);
    Vec3D vec3d3 = vec3d.a(vec3d1, this.d);
    Vec3D vec3d4 = vec3d.b(vec3d1, this.b);
    Vec3D vec3d5 = vec3d.b(vec3d1, this.e);
    Vec3D vec3d6 = vec3d.c(vec3d1, this.c);
    Vec3D vec3d7 = vec3d.c(vec3d1, this.f);

    if (!this.b(vec3d2)) {
      vec3d2 = null;
    }

    if (!this.b(vec3d3)) {
      vec3d3 = null;
    }

    if (!this.c(vec3d4)) {
      vec3d4 = null;
    }

    if (!this.c(vec3d5)) {
      vec3d5 = null;
    }

    if (!this.d(vec3d6)) {
      vec3d6 = null;
    }

    if (!this.d(vec3d7)) {
      vec3d7 = null;
    }

    Vec3D vec3d8 = null;

    if (vec3d2 != null
        && (vec3d8 == null || vec3d.distanceSquared(vec3d2) < vec3d.distanceSquared(vec3d8))) {
      vec3d8 = vec3d2;
    }

    if (vec3d3 != null
        && (vec3d8 == null || vec3d.distanceSquared(vec3d3) < vec3d.distanceSquared(vec3d8))) {
      vec3d8 = vec3d3;
    }

    if (vec3d4 != null
        && (vec3d8 == null || vec3d.distanceSquared(vec3d4) < vec3d.distanceSquared(vec3d8))) {
      vec3d8 = vec3d4;
    }

    if (vec3d5 != null
        && (vec3d8 == null || vec3d.distanceSquared(vec3d5) < vec3d.distanceSquared(vec3d8))) {
      vec3d8 = vec3d5;
    }

    if (vec3d6 != null
        && (vec3d8 == null || vec3d.distanceSquared(vec3d6) < vec3d.distanceSquared(vec3d8))) {
      vec3d8 = vec3d6;
    }

    if (vec3d7 != null
        && (vec3d8 == null || vec3d.distanceSquared(vec3d7) < vec3d.distanceSquared(vec3d8))) {
      vec3d8 = vec3d7;
    }

    if (vec3d8 == null) {
      return null;
    } else {
      byte b0 = -1;

      if (vec3d8 == vec3d2) {
        b0 = 4;
      }

      if (vec3d8 == vec3d3) {
        b0 = 5;
      }

      if (vec3d8 == vec3d4) {
        b0 = 0;
      }

      if (vec3d8 == vec3d5) {
        b0 = 1;
      }

      if (vec3d8 == vec3d6) {
        b0 = 2;
      }

      if (vec3d8 == vec3d7) {
        b0 = 3;
      }

      return new MovingObjectPosition(0, 0, 0, b0, vec3d8);
    }
  }
Ejemplo n.º 12
0
  private void w() {
    long i = System.nanoTime();
    ArrayList arraylist = new ArrayList();
    Iterator iterator = trackerList.keySet().iterator();

    while (iterator.hasNext()) {
      String s = (String) iterator.next();
      int j = ((Integer) trackerList.get(s)).intValue();

      if (j > 0) {
        trackerList.put(s, Integer.valueOf(j - 1));
      } else {
        arraylist.add(s);
      }
    }

    int k;

    for (k = 0; k < arraylist.size(); ++k) {
      trackerList.remove(arraylist.get(k));
    }

    AxisAlignedBB.a();
    Vec3D.a();
    ++this.ticks;

    for (k = 0; k < this.worldServer.length; ++k) {
      long l = System.nanoTime();

      if (k == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
        WorldServer worldserver = this.worldServer[k];

        if (this.ticks % 20 == 0) {
          this.serverConfigurationManager.a(
              new Packet4UpdateTime(worldserver.getTime()), worldserver.worldProvider.dimension);
        }

        worldserver.doTick();

        while (true) {
          if (!worldserver.updateLights()) {
            worldserver.tickEntities();
            break;
          }
        }
      }

      this.g[k][this.ticks % 100] = System.nanoTime() - l;
    }

    this.networkListenThread.a();
    this.serverConfigurationManager.tick();

    for (k = 0; k < this.tracker.length; ++k) {
      this.tracker[k].updatePlayers();
    }

    for (k = 0; k < this.C.size(); ++k) {
      ((IUpdatePlayerListBox) this.C.get(k)).a();
    }

    try {
      this.b();
    } catch (Exception exception) {
      log.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
    }

    this.f[this.ticks % 100] = System.nanoTime() - i;
    this.u[this.ticks % 100] = Packet.n - this.E;
    this.E = Packet.n;
    this.v[this.ticks % 100] = Packet.o - this.F;
    this.F = Packet.o;
    this.w[this.ticks % 100] = Packet.l - this.G;
    this.G = Packet.l;
    this.x[this.ticks % 100] = Packet.m - this.H;
    this.H = Packet.m;
  }