public void t_() {
    this.P = this.locX;
    this.Q = this.locY;
    this.R = this.locZ;
    super.t_();
    this.motX *= 1.15D;
    this.motZ *= 1.15D;
    this.motY += 0.04D;
    this.move(this.motX, this.motY, this.motZ);
    float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);

    this.yaw = (float) (MathHelper.b(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);

    for (this.pitch = (float) (MathHelper.b(this.motY, (double) f) * 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;
    if (this.ticksFlown == 0 && !this.R()) {
      this.world.makeSound(this, "fireworks.launch", 3.0F, 1.0F);
    }

    ++this.ticksFlown;
    if (this.world.isClientSide && this.ticksFlown % 2 < 2) {
      this.world.addParticle(
          EnumParticle.FIREWORKS_SPARK,
          this.locX,
          this.locY - 0.3D,
          this.locZ,
          this.random.nextGaussian() * 0.05D,
          -this.motY * 0.5D,
          this.random.nextGaussian() * 0.05D,
          new int[0]);
    }

    if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
      this.world.broadcastEntityEffect(this, (byte) 17);
      this.die();
    }
  }
Example #2
0
  public void o() {
    if (this.l.b()) {
      float f1 = this.b(1.0F);

      if (f1 > 0.5F
          && this.l.i(MathHelper.b(this.p), MathHelper.b(this.q), MathHelper.b(this.r))
          && this.W.nextFloat() * 30.0F < (f1 - 0.4F) * 2.0F) {
        this.Z = 300;
      }
    }

    super.o();
  }