Merged with master

This commit is contained in:
Anuken
2020-02-09 12:27:44 -05:00
84 changed files with 488 additions and 413 deletions

View File

@@ -100,6 +100,8 @@ public class MusicControl{
/** 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.*/
private void play(@Nullable Music music){
if(!shouldPlay()) return;
//update volume of current track
if(current != null){
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.*/
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
lastRandomPlayed = music;
@@ -162,6 +164,10 @@ public class MusicControl{
current.play();
}
private boolean shouldPlay(){
return Core.settings.getInt("musicvol") > 0;
}
/** Fades out the current track, unless it has already been silenced. */
private void silence(){
play(null);

View File

@@ -375,7 +375,7 @@ public class Schematics implements Loadable{
/** Loads a schematic from base64. May throw an exception. */
public static Schematic readBase64(String schematic){
try{
return read(new ByteArrayInputStream(Base64Coder.decode(schematic)));
return read(new ByteArrayInputStream(Base64Coder.decode(schematic.trim())));
}catch(IOException e){
throw new RuntimeException(e);
}