diff --git a/README.md b/README.md index fbb73f2..9e18e62 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ If you are still using 0.1.0 Cleanroom, use 0.5.4. But that's not recommended. * MAGE (Graphical Tweaks) * Extra Utilities 2 * In Control! +* More Refined Storage +* Better Formatting Code ## Note Add + to start of the file if it's not there. \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 95101c1..86b3c79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ mappings_version=39-1.12 mod_id=fugue mod_name=Fugue mod_main_class=Fugue -mod_version=0.15.5 +mod_version=0.15.6 mod_base_package=com.cleanroommc.fugue mod_authors=kappa_maintainer mod_description=A mod that patch dead mods for Cleanroom diff --git a/src/main/java/com/cleanroommc/fugue/common/FugueLoadingPlugin.java b/src/main/java/com/cleanroommc/fugue/common/FugueLoadingPlugin.java index d13dc56..b92c6fb 100644 --- a/src/main/java/com/cleanroommc/fugue/common/FugueLoadingPlugin.java +++ b/src/main/java/com/cleanroommc/fugue/common/FugueLoadingPlugin.java @@ -144,6 +144,10 @@ public class FugueLoadingPlugin implements IFMLLoadingPlugin { if (FugueConfig.modPatchConfig.enableExtraUtilities) { TransformerDelegate.registerExplicitTransformerByInstance(new FieldSetterTransformer(), "com.rwtema.extrautils2.utils.datastructures.FieldSetter"); } + if (FugueConfig.modPatchConfig.enableBetterFC) { + TransformerDelegate.registerExplicitTransformerByInstance(new HK_LoaderTransformer(), "kpan.better_fc.asm.hook.HK_Loader"); + } + if (FugueConfig.getCodeSourcePatchTargets.length > 0) { TransformerDelegate.registerExplicitTransformerByInstance(new ITweakerTransformer(), FugueConfig.getCodeSourcePatchTargets); } diff --git a/src/main/java/com/cleanroommc/fugue/config/FugueConfig.java b/src/main/java/com/cleanroommc/fugue/config/FugueConfig.java index cf092a9..5914331 100644 --- a/src/main/java/com/cleanroommc/fugue/config/FugueConfig.java +++ b/src/main/java/com/cleanroommc/fugue/config/FugueConfig.java @@ -54,6 +54,7 @@ public class FugueConfig { "com.noobanidus.variegated.compat.bloodmagic.handlers.HellfireSpeed", "ic2.core.util.ReflectionUtil", "net.arsenalnetwork.betterhud.h", + "com.github.alexthe666.iceandfire.entity.EntitySnowVillager", }; @Config.Comment( diff --git a/src/main/java/com/cleanroommc/fugue/config/ModPatchConfig.java b/src/main/java/com/cleanroommc/fugue/config/ModPatchConfig.java index e1f5a2f..c6d6698 100644 --- a/src/main/java/com/cleanroommc/fugue/config/ModPatchConfig.java +++ b/src/main/java/com/cleanroommc/fugue/config/ModPatchConfig.java @@ -99,4 +99,6 @@ public class ModPatchConfig { public boolean enableMoreRefinedStorage = true; @Config.Name("Enable HEI Patch (temporary)") public boolean enableHEI = true; + @Config.Name("Enable Better Formatting Code Patch") + public boolean enableBetterFC = true; } diff --git a/src/main/java/com/cleanroommc/fugue/transformer/HK_LoaderTransformer.java b/src/main/java/com/cleanroommc/fugue/transformer/HK_LoaderTransformer.java new file mode 100644 index 0000000..d1073a8 --- /dev/null +++ b/src/main/java/com/cleanroommc/fugue/transformer/HK_LoaderTransformer.java @@ -0,0 +1,33 @@ +package com.cleanroommc.fugue.transformer; + +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 top.outlands.foundation.TransformerDelegate; + +import java.io.ByteArrayInputStream; + +public class HK_LoaderTransformer implements IExplicitTransformer { + + @Override + public byte[] transform(byte[] bytes) { + try { + CtClass cc = ClassPool.getDefault().makeClass(new ByteArrayInputStream(bytes)); + cc.getDeclaredMethod("onConstructed").instrument(new ExprEditor() { + public void edit(MethodCall m) throws CannotCompileException { + if (m.getMethodName().equals("getPrivateField") && m.getLineNumber() == 16) { + m.replace("$_ = top.outlands.foundation.TransformerDelegate#getTransformers();"); + } + } + }); + bytes = cc.toBytecode(); + } catch (Throwable t) { + Fugue.LOGGER.error(t); + } + return bytes; + } +}