Fixed crash caused by missing sounds
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.mod;
|
package io.anuke.mindustry.mod;
|
||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.assets.*;
|
||||||
import io.anuke.arc.audio.*;
|
import io.anuke.arc.audio.*;
|
||||||
import io.anuke.arc.audio.mock.*;
|
import io.anuke.arc.audio.mock.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
@@ -69,9 +70,9 @@ public class ContentParser{
|
|||||||
String name = "sounds/" + data.asString();
|
String name = "sounds/" + data.asString();
|
||||||
String path = Vars.tree.get(name + ".ogg").exists() && !Vars.ios ? name + ".ogg" : name + ".mp3";
|
String path = Vars.tree.get(name + ".ogg").exists() && !Vars.ios ? name + ".ogg" : name + ".mp3";
|
||||||
ModLoadingSound sound = new ModLoadingSound();
|
ModLoadingSound sound = new ModLoadingSound();
|
||||||
Core.assets.load(path, Sound.class).loaded = result -> {
|
AssetDescriptor<?> desc = Core.assets.load(path, Sound.class);
|
||||||
sound.sound = (Sound)result;
|
desc.loaded = result -> sound.sound = (Sound)result;
|
||||||
};
|
desc.errored = Throwable::printStackTrace;
|
||||||
return sound;
|
return sound;
|
||||||
});
|
});
|
||||||
put(Objective.class, (type, data) -> {
|
put(Objective.class, (type, data) -> {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
/** @return the loaded mod found by class, or null if not found. */
|
/** @return the loaded mod found by class, or null if not found. */
|
||||||
public @Nullable LoadedMod getMod(Class<? extends Mod> type){
|
public @Nullable LoadedMod getMod(Class<? extends Mod> type){
|
||||||
return loaded.find(l -> l.mod.getClass() == type);
|
return loaded.find(l -> l.mod != null && l.mod.getClass() == type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Imports an external mod file.*/
|
/** Imports an external mod file.*/
|
||||||
|
|||||||
Reference in New Issue
Block a user