Fixed issue with records not properly cancelling music.
This commit is contained in:
parent
f700e5ad15
commit
8ef48fd27b
|
@ -31,10 +31,17 @@ public class AetherMusicHandler {
|
|||
if (phase == TickEvent.Phase.END) {
|
||||
if (type.equals(TickEvent.Type.CLIENT)) {
|
||||
if (!this.mc.isGamePaused()) {
|
||||
this.musicTicker.update();
|
||||
if (!musicTicker.playingRecord()) {
|
||||
this.musicTicker.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(mc.getSoundHandler().isSoundPlaying(musicTicker.getRecord())))
|
||||
{
|
||||
musicTicker.trackRecord(null);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -56,9 +63,9 @@ public class AetherMusicHandler {
|
|||
}
|
||||
}
|
||||
} else if (category == SoundCategory.RECORDS && !(event.name.contains("note"))) {
|
||||
this.musicTicker.stopMusic();
|
||||
this.musicTicker.trackRecord(event.sound);
|
||||
this.mc.getSoundHandler().stopSounds();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class AetherMusicTicker implements IUpdatePlayerListBox {
|
|||
|
||||
private final Random rand = new Random();
|
||||
private final Minecraft mc;
|
||||
private ISound currentMusic;
|
||||
private ISound currentMusic, currentRecord;
|
||||
private int timeUntilNextMusic = 100;
|
||||
|
||||
public AetherMusicTicker(Minecraft mcIn) {
|
||||
|
@ -64,6 +64,16 @@ public class AetherMusicTicker implements IUpdatePlayerListBox {
|
|||
return this.currentMusic != null;
|
||||
}
|
||||
|
||||
public boolean playingRecord()
|
||||
{
|
||||
return this.currentRecord != null;
|
||||
}
|
||||
|
||||
public ISound getRecord()
|
||||
{
|
||||
return this.currentRecord;
|
||||
}
|
||||
|
||||
public AetherMusicTicker.TrackType getRandomTrack() {
|
||||
int num = this.rand.nextInt(4);
|
||||
|
||||
|
@ -76,6 +86,11 @@ public class AetherMusicTicker implements IUpdatePlayerListBox {
|
|||
this.timeUntilNextMusic = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public void trackRecord(ISound record)
|
||||
{
|
||||
this.currentRecord = record;
|
||||
}
|
||||
|
||||
public void stopMusic() {
|
||||
if (this.currentMusic != null) {
|
||||
this.mc.getSoundHandler().stopSound(this.currentMusic);
|
||||
|
|
Loading…
Reference in a new issue