Skip to content

Commit

Permalink
Update grs patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Aug 13, 2024
1 parent 83a18dc commit 3b76a61
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,9 @@ public class FugueLoadingPlugin implements IFMLLoadingPlugin {
TransformerDelegate.registerExplicitTransformerByInstance(new FreeSectorManagerTransformer(), "meldexun.nothirium.util.FreeSectorManager$AVL", "meldexun.nothirium.util.FreeSectorManager$RB");
}
if (FugueConfig.modPatchConfig.enableGroovyScript) {
//TransformerDelegate.registerExplicitTransformerByInstance(new GroovyClassLoaderTransformer(), "groovy.lang.GroovyClassLoader");

TransformerDelegate.registerExplicitTransformerByInstance(new GroovyClassLoaderTransformer(), "groovy.lang.GroovyClassLoader");
//TransformerDelegate.registerExplicitTransformerByInstance(new ExceptionMessageTransformer(), "org.codehaus.groovy.control.messages.ExceptionMessage");
TransformerDelegate.registerExplicitTransformerByInstance(new GroovyRunnerRegistryTransformer(), "org.apache.groovy.plugin.GroovyRunnerRegistry");
TransformerDelegate.registerExplicitTransformerByInstance(new ASTTransformationCollectorCodeVisitorTransformer(), "org.codehaus.groovy.transform.ASTTransformationCollectorCodeVisitor");


/*TransformerDelegate.registerExplicitTransformerByInstance(new ProxyGeneratorAdapterTransformer(), "org.codehaus.groovy.runtime.ProxyGeneratorAdapter$InnerLoader");
TransformerDelegate.registerExplicitTransformerByInstance(new SunClassLoaderTransformer(), "org.codehaus.groovy.reflection.SunClassLoader");
TransformerDelegate.registerExplicitTransformerByInstance(new ClassLoaderForClassArtifactsTransformer(), "org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts");
TransformerDelegate.registerExplicitTransformerByInstance(new ReflectorLoaderTransformer(), "org.codehaus.groovy.runtime.metaclass.ReflectorLoader");*/
}
if (FugueConfig.modPatchConfig.enableIC2CE) {
Config.registerConfigModifier(new IC2ExtraFixer(), "mixins.ic2c_extras.json");
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/cleanroommc/fugue/helper/HookHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.codehaus.groovy.ast.AnnotationNode;
import org.objectweb.asm.Opcodes;
import top.outlands.foundation.TransformerDelegate;
import top.outlands.foundation.boot.ActualClassLoader;
Expand Down Expand Up @@ -127,12 +126,14 @@ public static void logCL(ClassLoader parent) {
Fugue.LOGGER.info("ClassLoader: {}", parent);
}

public static void verifyAndAddTransform(AnnotationNode annotation, Class<?> transformClass) {
Fugue.LOGGER.info("ClassLoader1: {} {}", transformClass, transformClass.getClassLoader());

Arrays.stream(transformClass.getAnnotations()).forEach(annotationNode -> {Fugue.LOGGER.info("ClassLoader2: {} {}", annotationNode.getClass(), annotationNode.annotationType().getClassLoader());});
public static Class<?> loadClass(String name) {
Class<?> c = null;
try {
c = Launch.classLoader.findClass(name);
} catch (ClassNotFoundException | NoClassDefFoundError ignored) {}
return c;
}

}

public static byte[] redirectGetClassByte(LaunchClassLoader instance, String s) throws IOException {
byte[] bytes = null;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ public byte[] transform(byte[] bytes) {
public void edit(MethodCall m) throws CannotCompileException {
//Fugue.LOGGER.info("Transforming Groovy class method: {}", m.getMethodName());
if (m.getMethodName().equals("loadClass")) {
m.replace("$_ = net.minecraft.launchwrapper.Launch#classLoader.loadClass($1);");
m.replace("""
Class c = com.cleanroommc.fugue.helper.HookHelper#loadClass($1);
if (c != null) {
$_ = c;
} else {
$_ = $proceed($$);
}
""");
}
}
});
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 3b76a61

Please sign in to comment.