Commit 0ad3baced76b5a77c014b1fd5be6f5f6a421b4a0
1 parent
36ff51e4
+ Fixed loading mods that have been dragged into the minecraft .jar
Showing
1 changed file
with
17 additions
and
1 deletions
java/com/mumfrey/liteloader/core/LiteLoader.java
... | ... | @@ -301,7 +301,23 @@ public final class LiteLoader implements FilenameFilter |
301 | 301 | // To try to avoid loading the same mod multiple times if it appears in more than one entry in the class path, we index |
302 | 302 | // the mods by name and hopefully match only a single instance of a particular mod |
303 | 303 | HashMap<String, Class> modsToLoad = new HashMap<String, Class>(); |
304 | - | |
304 | + | |
305 | + try | |
306 | + { | |
307 | + File packagePath = new File(LiteLoader.class.getProtectionDomain().getCodeSource().getLocation().toURI()); | |
308 | + | |
309 | + LinkedList<Class> modClasses = getSubclassesFor(packagePath, Minecraft.class.getClassLoader(), LiteMod.class, "LiteMod"); | |
310 | + | |
311 | + for (Class mod : modClasses) | |
312 | + { | |
313 | + modsToLoad.put(mod.getSimpleName(), mod); | |
314 | + } | |
315 | + } | |
316 | + catch (Throwable th) | |
317 | + { | |
318 | + logger.warning("Error loading from local class path: " + th.getMessage()); | |
319 | + } | |
320 | + | |
305 | 321 | // Search through the class path and find mod classes |
306 | 322 | for (String classPathPart : classPathEntries) |
307 | 323 | { | ... | ... |