mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-23 21:49:46 +00:00
Fixed new ICrashReportDetail loader working with packaged mods by delaying it until the ModContainer's construct event. Closes #2924
This commit is contained in:
1 parent
d3e758fce6
commit
e65218b525
6 files changed
+100
-38
No files matched your search
@@ -27,6 +27,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.Mod.Metadata;
|
||||
import net.minecraftforge.fml.common.asm.transformers.BlamingTransformer;
|
||||
@@ -466,6 +467,10 @@ public class FMLModContainer implements ModContainer
|
||||
ModClassLoader modClassLoader = event.getModClassLoader();
|
||||
modClassLoader.addFile(source);
|
||||
modClassLoader.clearNegativeCacheFor(candidate.getClassList());
|
||||
|
||||
//Only place I could think to add this...
|
||||
MinecraftForge.preloadCrashClasses(event.getASMHarvestedData(), getModId(), candidate.getClassList());
|
||||
|
||||
Class<?> clazz = Class.forName(className, true, modClassLoader);
|
||||
|
||||
Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates();
|
||||
|
||||
@@ -521,7 +521,6 @@ public class Loader
|
||||
}
|
||||
}
|
||||
}
|
||||
preloadCrashClasses();
|
||||
modController.transition(LoaderState.CONSTRUCTING, false);
|
||||
modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, discoverer.getASMTable(), reverseDependencies);
|
||||
|
||||
@@ -1118,33 +1117,4 @@ public class Loader
|
||||
{
|
||||
return modController != null ? modController.getState() : LoaderState.NOINIT;
|
||||
}
|
||||
|
||||
|
||||
private void preloadCrashClasses()
|
||||
{
|
||||
//For all the normal CrashReport classes to be defined. We're in MC's classloader so this should all be fine
|
||||
new CrashReport("ThisIsFake", new Exception("Not real"));
|
||||
|
||||
FMLLog.log(Level.DEBUG, "Preloading CrashReport Classes");
|
||||
//Find all ICrashReportDetail's handlers and preload them.
|
||||
List<String> classes = Lists.newArrayList();
|
||||
for (ASMData asm : discoverer.getASMTable().getAll(ICrashReportDetail.class.getName().replace('.', '/')))
|
||||
{
|
||||
classes.add(asm.getClassName());
|
||||
}
|
||||
for (ASMData asm : discoverer.getASMTable().getAll(ICrashCallable.class.getName().replace('.', '/')))
|
||||
{
|
||||
classes.add(asm.getClassName());
|
||||
}
|
||||
Collections.sort(classes); //Sort it because I like pretty output ;)
|
||||
for (String name : classes)
|
||||
{
|
||||
FMLLog.log(Level.DEBUG, "\t" + name);
|
||||
try
|
||||
{
|
||||
Class<?> cls = Class.forName(name, false, getClass().getClassLoader());
|
||||
}
|
||||
catch (Exception e){}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
|
||||
if (file.isDirectory())
|
||||
{
|
||||
FMLLog.finer("Recursing into package %s", path + file.getName());
|
||||
exploreFileSystem(path + file.getName() + ".", file, harvestedMods, candidate, mc);
|
||||
exploreFileSystem(path + file.getName() + "/", file, harvestedMods, candidate, mc);
|
||||
continue;
|
||||
}
|
||||
Matcher match = classFile.matcher(file.getName());
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ASMModParser
|
||||
|
||||
for (String intf : interfaces)
|
||||
{
|
||||
table.addASMData(candidate, intf, this.asmType.getClassName(), null, null);
|
||||
table.addASMData(candidate, intf, this.asmType.getInternalName(), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user