This commit is contained in:
Anuken
2020-02-07 20:21:45 -05:00
parent a6801af128
commit 0ffcd0b94c
2 changed files with 7 additions and 2 deletions

View File

@@ -100,6 +100,8 @@ public class MusicControl{
/** Plays and fades in a music track. This must be called every frame. /** Plays and fades in a music track. This must be called every frame.
* If something is already playing, fades out that track and fades in this new music.*/ * If something is already playing, fades out that track and fades in this new music.*/
private void play(@Nullable Music music){ private void play(@Nullable Music music){
if(!shouldPlay()) return;
//update volume of current track //update volume of current track
if(current != null){ if(current != null){
current.setVolume(fade * Core.settings.getInt("musicvol") / 100f); current.setVolume(fade * Core.settings.getInt("musicvol") / 100f);
@@ -143,7 +145,7 @@ public class MusicControl{
/** Plays a music track once and only once. If something is already playing, does nothing.*/ /** Plays a music track once and only once. If something is already playing, does nothing.*/
private void playOnce(Music music){ private void playOnce(Music music){
if(current != null || music == null) return; //do not interrupt already-playing tracks if(current != null || music == null || !shouldPlay()) return; //do not interrupt already-playing tracks
//save last random track played to prevent duplicates //save last random track played to prevent duplicates
lastRandomPlayed = music; lastRandomPlayed = music;
@@ -162,6 +164,10 @@ public class MusicControl{
current.play(); current.play();
} }
private boolean shouldPlay(){
return Core.settings.getInt("musicvol") > 0;
}
/** Fades out the current track, unless it has already been silenced. */ /** Fades out the current track, unless it has already been silenced. */
private void silence(){ private void silence(){
play(null); play(null);

View File

@@ -24,7 +24,6 @@ public class Junction extends Block{
super(name); super(name);
update = true; update = true;
solid = true; solid = true;
instantTransfer = true;
group = BlockGroup.transportation; group = BlockGroup.transportation;
unloadable = false; unloadable = false;
entityType = JunctionEntity::new; entityType = JunctionEntity::new;