Make the mod work on both forge & neoforge

Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404-59 2025-06-24 18:11:25 +02:00
parent fcba61b050
commit 0726b36418
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1

View File

@ -56,8 +56,9 @@ object Configuration {
getMethod("getConfigDir").invoke(getMethod("getInstance").invoke(null))
}
} else {
Class.forName("net.neoforged.fml.loading.FMLPaths")
.getField("CONFIGDIR")
try { Class.forName("net.neoforged.fml.loading.FMLPaths") } catch (_: ClassNotFoundException) {
Class.forName("net.minecraftforge.fml.loading.FMLPaths")
}.getField("CONFIGDIR")
.get(null)
.let { enum ->
enum.javaClass.getMethod("get").invoke(enum)