generated from Legacy-Fabric/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ImmibisCore crashing because of hacks
- Loading branch information
1 parent
bbffe99
commit 5fe734f
Showing
4 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...t/src/main/java/fr/catcore/fabricatedforge/compat/mixin/immibiscore/ImmibisCoreMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters