#A reliable way to map a Class to a ModContainer

7 messages · Page 1 of 1 (latest)

sturdy elm
#

Is there a way to reliably determine what mod a class comes from having only the class object available?

lofty vessel
#

you can manually load the mod jar yourself and check if the classes full name is contained in it

#

but probably not without doing that as they're all just added to the classpath

sturdy elm
#

Well, that's kind of the issue, I couldn't find a reliable way to get all mod paths.
ModContainer#getRootPaths is close, but it only returns the resources folder in dev environment if a sourceSet isn't added manually in build.gradle, which I can't really guarantee.

lofty vessel
#

i would assume you're gonna have to read every single jar and check the mod id in the fmj

#

basically redoing what fabric loader is doing

#

i'd just not do whatever you're doing