mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-16 22:15:11 +00:00
even more fixes
This commit is contained in:
9 files changed
+75
-20
No files matched your search
@@ -47,4 +47,9 @@ public class ReflectionUtil {
|
||||
public static void jailBreak(Method method) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static Class<?> getCallerClass() {
|
||||
return Class.forName(Thread.currentThread().getStackTrace()[3].getClassName());
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,9 @@ import com.falsepattern.lib.internal.Tags;
|
||||
import com.falsepattern.lib.mixin.MixinInfo;
|
||||
import lombok.val;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class IMixinPluginTransformer implements IClassNodeTransformer {
|
||||
@Override
|
||||
@@ -41,18 +44,21 @@ public class IMixinPluginTransformer implements IClassNodeTransformer {
|
||||
@Override
|
||||
public void transform(ClassNode cn, String transformedName, boolean obfuscated) {
|
||||
val methods = cn.methods;
|
||||
val remove = new ArrayList<MethodNode>();
|
||||
String name;
|
||||
if (!MixinInfo.isMixinBooterLegacy()) {
|
||||
FPTransformer.LOG.info("Could not detect MixinBooterLegacy. Converting IMixinPlugin to legacy compat mode.");
|
||||
for (val method : methods) {
|
||||
if (method.name.equals("preApply") || method.name.equals("postApply")) {
|
||||
method.desc = method.desc.replace("org/spongepowered/libraries/org/objectweb/asm/tree/ClassNode",
|
||||
"org/spongepowered/asm/lib/tree/ClassNode");
|
||||
for (val local: method.localVariables) {
|
||||
local.desc = local.desc.replace("org/spongepowered/libraries/org/objectweb/asm/tree/ClassNode",
|
||||
"org/spongepowered/asm/lib/tree/ClassNode");
|
||||
}
|
||||
}
|
||||
FPTransformer.LOG.info("Could not detect MixinBooterLegacy. Removing MBL compat code.");
|
||||
name = "org/spongepowered/libraries/org/objectweb/asm/tree/ClassNode";
|
||||
} else {
|
||||
FPTransformer.LOG.info("Detected MixinBooterLegacy. Removing SpongeMixins compat code.");
|
||||
name = "org/spongepowered/asm/lib/tree/ClassNode";
|
||||
}
|
||||
for (val method: methods) {
|
||||
if ((method.name.equals("preApply") || method.name.equals("postApply")) &&
|
||||
method.desc.contains(name)) {
|
||||
remove.add(method);
|
||||
}
|
||||
}
|
||||
methods.removeAll(remove);
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,14 @@ package com.falsepattern.lib.internal.config;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigurationManager;
|
||||
import com.falsepattern.lib.internal.Tags;
|
||||
|
||||
@Config(modid = Tags.MODID)
|
||||
public class LibraryConfig {
|
||||
static {
|
||||
ConfigurationManager.selfInit();
|
||||
}
|
||||
@Config.Comment({"Used to control whether FalsePatternLib should check for outdated mods.",
|
||||
"If you're building a public modpack, you should turn this off so that your users don't " +
|
||||
"get nagged about outdated mods."})
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.falsepattern.lib.internal.config;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigurationManager;
|
||||
import com.falsepattern.lib.internal.Tags;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -31,6 +32,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
@Config(modid = Tags.MODID,
|
||||
category = "toasts")
|
||||
public class ToastConfig {
|
||||
static {
|
||||
ConfigurationManager.selfInit();
|
||||
}
|
||||
@Config.Comment("The maximum amount of toasts to show on the screen")
|
||||
@Config.LangKey("config.falsepatternlib.maxtoasts")
|
||||
@Config.DefaultInt(5)
|
||||
|
||||
@@ -58,11 +58,6 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
super.preInit(e);
|
||||
try {
|
||||
ConfigurationManager.initialize(ToastConfig.class);
|
||||
} catch (ConfigException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,11 +57,6 @@ public class CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
ConfigurationManagerImpl.registerBus();
|
||||
try {
|
||||
ConfigurationManager.initialize(LibraryConfig.class);
|
||||
} catch (ConfigException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
if (LibraryConfig.ENABLE_UPDATE_CHECKER) {
|
||||
FalsePatternLib.getLog().info("Launching asynchronous update check.");
|
||||
updatesFuture = UpdateChecker.fetchUpdatesAsync(FalsePatternLib.UPDATE_URL).thenApplyAsync(updates -> {
|
||||
|
||||
Reference in new issue
Block a user