Skip to content

Commit

Permalink
Fix ImmibisCore crashing because of hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Apr 23, 2024
1 parent bbffe99 commit 5fe734f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
Binary file added lib/immibis-core-52.4.6.jar
Binary file not shown.
1 change: 1 addition & 0 deletions mod-compat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
modCompileOnly(group: "local", name: "CodeChickenCore", version: "0.8.1.6")
modCompileOnly(group: "local", name: "NotEnoughItems", version: "1.4.7.4")
modCompileOnly(group: "local", name: "TreeCapitator", version: "1.4.6-r07")
modCompileOnly(group: "local", name: "immibis-core", version: "52.4.6")
}

base {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package fr.catcore.fabricatedforge.compat.mixin.immibiscore;

import cpw.mods.fml.relauncher.IClassTransformer;
import cpw.mods.fml.relauncher.RelaunchClassLoader;
import fr.catcore.modremapperapi.ClassTransformer;
import immibis.core.ImmibisCore;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ImmibisCore.class)
public class ImmibisCoreMixin {
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Ljava/lang/Class;getClassLoader()Ljava/lang/ClassLoader;"), remap = false)
private static ClassLoader provideFakeClassLoader(Class instance) {
return null;
}

@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcpw/mods/fml/relauncher/RelaunchClassLoader;registerTransformer(Ljava/lang/String;)V"), remap = false)
private static void registerClassLoader(RelaunchClassLoader instance, String s) {
try {
IClassTransformer classTransformer = (IClassTransformer)Class.forName(s).newInstance();
ClassTransformer.registerPostTransformer(classTransformer);
System.out.println("Registered ClassTransformer: " + s);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"codechickencore.ClassOverriderMixin",
"codechickencore.DelegatedTransformerMixin",
"codechickencore.DescriptorMappingMixin",
"immibiscore.ImmibisCoreMixin",
"nei.FurnaceRecipeHandlerMixin",
"nei.TMIUninstallerMixin",
"treecapitator.ItemInWorldManagerTransformerMixin"
Expand Down

0 comments on commit 5fe734f

Please sign in to comment.