-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
PatchRelaunchClassLoader.java
39 lines (35 loc) · 1.23 KB
/
PatchRelaunchClassLoader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package me.nallar.tickthreading.minecraft.patched;
import java.net.URL;
import java.util.logging.Level;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.IClassTransformer;
import cpw.mods.fml.relauncher.RelaunchClassLoader;
public abstract class PatchRelaunchClassLoader extends RelaunchClassLoader {
public PatchRelaunchClassLoader(URL[] sources) {
super(sources);
}
@Override
protected byte[] runTransformers(String name, byte[] basicClass) {
if (basicClass == null) {
if (DEBUG_CLASSLOADING) {
FMLLog.warning("Could not find the class " + name + ". This is not necessarily an issue.");
}
} else {
for (IClassTransformer transformer : transformers) {
try {
byte[] oldClass = basicClass;
basicClass = transformer.transform(name, basicClass);
if (basicClass == null) {
basicClass = oldClass;
FMLLog.severe(transformer.getClass() + " returned a null class during transformation, ignoring.");
}
} catch (Throwable throwable) {
if (DEBUG_CLASSLOADING || !throwable.getMessage().contains("for invalid side")) {
FMLLog.log(Level.SEVERE, throwable, "Failed to transform " + name);
}
}
}
}
return basicClass;
}
}