Exemplo n.º 1
0
  /** Updates the JList with a new model. */
  public void update() {
    MusicTicker.MusicType var1 = this.mc.getAmbientMusicType();

    if (this.currentMusic != null) {
      if (!var1.getMusicLocation().equals(this.currentMusic.getSoundLocation())) {
        this.mc.getSoundHandler().stopSound(this.currentMusic);
        this.timeUntilNextMusic =
            MathHelper.getRandomIntegerInRange(this.rand, 0, var1.getMinDelay() / 2);
      }

      if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic)) {
        this.currentMusic = null;
        this.timeUntilNextMusic =
            Math.min(
                MathHelper.getRandomIntegerInRange(
                    this.rand, var1.getMinDelay(), var1.getMaxDelay()),
                this.timeUntilNextMusic);
      }
    }

    if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0) {
      this.currentMusic =
          PositionedSoundRecord.createPositionedSoundRecord(var1.getMusicLocation());
      this.mc.getSoundHandler().playSound(this.currentMusic);
      this.timeUntilNextMusic = Integer.MAX_VALUE;
    }
  }
Exemplo n.º 2
0
 public void update() {
   MusicTicker.MusicType localMusicType = this.field_147677_b.func_147109_W();
   if (this.field_147678_c != null) {
     if (!localMusicType
         .getMusicTickerLocation()
         .equals(this.field_147678_c.getPositionedSoundLocation())) {
       this.field_147677_b.getSoundHandler().stopSound(this.field_147678_c);
       this.field_147676_d =
           MathHelper.getRandomIntegerInRange(
               this.field_147679_a, 0, localMusicType.func_148634_b() / 2);
     }
     if (!this.field_147677_b.getSoundHandler().isSoundPlaying(this.field_147678_c)) {
       this.field_147678_c = null;
       this.field_147676_d =
           Math.min(
               MathHelper.getRandomIntegerInRange(
                   this.field_147679_a,
                   localMusicType.func_148634_b(),
                   localMusicType.func_148633_c()),
               this.field_147676_d);
     }
   }
   if ((this.field_147678_c == null) && (this.field_147676_d-- <= 0)) {
     this.field_147678_c =
         PositionedSoundRecord.func_147673_a(localMusicType.getMusicTickerLocation());
     this.field_147677_b.getSoundHandler().playSound(this.field_147678_c);
     this.field_147676_d = 2147483647;
   }
 }
Exemplo n.º 3
0
    public void update() {
      MusicTicker.MusicType musictype = this.field_147677_b.func_147109_W();

      if (FMLClientHandler.instance().getWorldClient() != null
          && FMLClientHandler.instance().getWorldClient().provider
              instanceof IGalacticraftWorldProvider) {
        musictype = MUSIC_TYPE_MARS;
      }

      if (this.field_147678_c != null) {
        if (!musictype
            .getMusicTickerLocation()
            .equals(this.field_147678_c.getPositionedSoundLocation())) {
          this.field_147677_b.getSoundHandler().stopSound(this.field_147678_c);
          this.field_147676_d =
              MathHelper.getRandomIntegerInRange(
                  this.field_147679_a, 0, musictype.func_148634_b() / 2);
        }

        if (!this.field_147677_b.getSoundHandler().isSoundPlaying(this.field_147678_c)) {
          this.field_147678_c = null;
          this.field_147676_d =
              Math.min(
                  MathHelper.getRandomIntegerInRange(
                      this.field_147679_a, musictype.func_148634_b(), musictype.func_148633_c()),
                  this.field_147676_d);
        }
      }

      if (this.field_147678_c == null && this.field_147676_d-- <= 0) {
        this.field_147678_c =
            PositionedSoundRecord.func_147673_a(musictype.getMusicTickerLocation());
        this.field_147677_b.getSoundHandler().playSound(this.field_147678_c);
        this.field_147676_d = Integer.MAX_VALUE;
      }
    }