Mods with atlases that reference non-existent files will no longer cause crashes

This commit is contained in:
Yair Morgenstern 2023-11-04 23:55:47 +02:00
parent 927aa8a788
commit 9b5ded43d4

View File

@ -103,9 +103,14 @@ object ImageGetter {
val extraAtlas = if (mod.isEmpty()) fileName else if (fileName == "game") mod else "$mod/$fileName"
var tempAtlas = atlases[extraAtlas] // fetch if cached
if (tempAtlas == null) {
try {
debug("Loading %s = %s", extraAtlas, file.path())
tempAtlas = TextureAtlas(file) // load if not
atlases[extraAtlas] = tempAtlas // cache the freshly loaded
} catch (ex: Exception){
debug("Could not load file $file")
continue
}
}
for (region in tempAtlas.regions) {
if (region.name.startsWith("Skins")) {