generated from kappa-maintainer/1.12.2-FG6-Template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch Thaumic Fixes (Moved from MixinFixer)
- Loading branch information
1 parent
b7ee598
commit 49322fb
Showing
6 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
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
33 changes: 33 additions & 0 deletions
33
.../com/cleanroommc/fugue/transformer/thaumicfixes/ThaumicFixesLoadingPluginTransformer.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,33 @@ | ||
package com.cleanroommc.fugue.transformer.thaumicfixes; | ||
|
||
import com.cleanroommc.fugue.common.Fugue; | ||
import javassist.CannotCompileException; | ||
import javassist.ClassPool; | ||
import javassist.CtClass; | ||
import javassist.expr.ExprEditor; | ||
import javassist.expr.MethodCall; | ||
import top.outlands.foundation.IExplicitTransformer; | ||
|
||
import java.io.ByteArrayInputStream; | ||
|
||
public class ThaumicFixesLoadingPluginTransformer implements IExplicitTransformer { | ||
@Override | ||
public byte[] transform(byte[] bytes) { | ||
try { | ||
CtClass cc = ClassPool.getDefault().makeClass(new ByteArrayInputStream(bytes)); | ||
cc.getConstructors()[0].instrument(new ExprEditor(){ | ||
@Override | ||
public void edit(MethodCall m) throws CannotCompileException { | ||
if (m.getMethodName().equals("addConfiguration") && m.getMethodName().equals("init")) { | ||
m.where().setBody("{}"); | ||
} | ||
} | ||
}); | ||
bytes = cc.toBytecode(); | ||
cc.defrost(); | ||
} catch (Throwable t) { | ||
Fugue.LOGGER.error("Exception {} on {}", t, this.getClass().getSimpleName()); | ||
} | ||
return bytes; | ||
} | ||
} |