Skip to content

Commit 9ec5775

Browse files
committed
Added a readable error instead of IllegalStateException
1 parent 2500785 commit 9ec5775

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/kotlin/net/alexwells/kottle/FMLKotlinModContainer.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import net.minecraftforge.fml.ModLoadingStage
1313
import net.minecraftforge.forgespi.language.IModInfo
1414
import net.minecraftforge.forgespi.language.ModFileScanData
1515
import org.apache.logging.log4j.LogManager
16+
import java.lang.IllegalStateException
1617
import java.util.*
1718
import java.util.function.Consumer
1819
import java.util.function.Supplier
@@ -75,7 +76,16 @@ class FMLKotlinModContainer(
7576
this.mod = modClass.kotlin.objectInstance ?: modClass.getConstructor().newInstance()
7677
logger.debug(LOADING, "Loaded mod instance {} of type {}", getModId(), modClass.name)
7778
} catch (e: Throwable) {
79+
if (e is IllegalStateException) {
80+
logger.error(
81+
LOADING,
82+
"This seems like a compatibility error between Kottle and the mod. " +
83+
"Please make sure identical versions of shadowed libraries are used in the mod and Kottle of this version."
84+
)
85+
}
86+
7887
logger.error(LOADING, "Failed to create mod instance. ModID: {}, class {}", getModId(), modClass.name, e)
88+
7989
throw ModLoadingException(modInfo, event.fromStage(), "fml.modloading.failedtoloadmod", e, modClass)
8090
}
8191

0 commit comments

Comments
 (0)