diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-05 15:27:36 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 10:27:36 +0200 |
commit | 44dfbbb419f1736530c04c02a651f7757cf83f3d (patch) | |
tree | 1e8171573680b9415cecf199d479d49f7ad1f48a /src/main/java/cc/polyfrost/oneconfig/plugin | |
parent | 494d4f0bd0856e8e8d373003c82729ca722c6ccf (diff) | |
download | OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.tar.gz OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.tar.bz2 OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.zip |
rewrite command manager, stop using essential relocate, and reformat code (#34)
* reformat code
* reformat code
rewrite command manager
stop using essential relocate
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/plugin')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java | 28 |
2 files changed, 14 insertions, 16 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java b/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java index f5cac15..951e942 100644 --- a/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java +++ b/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java @@ -1,6 +1,5 @@ package cc.polyfrost.oneconfig.plugin; -import cc.polyfrost.oneconfig.libs.mixinextras.MixinExtrasBootstrap; import org.spongepowered.asm.lib.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; @@ -13,7 +12,6 @@ public class OneConfigMixinPlugin implements IMixinConfigPlugin { @Override public void onLoad(String mixinPackage) { - MixinExtrasBootstrap.init(); try { Class.forName("gg.essential.vigilance.Vigilant"); isVigilance = true; diff --git a/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java b/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java index fecdeed..29cf2fd 100644 --- a/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java +++ b/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java @@ -16,6 +16,20 @@ import org.objectweb.asm.tree.*; import java.io.File; public class VigilantTransformer implements ITransformer { + @SuppressWarnings("unused") + public static VigilanceConfig returnNewConfig(Vigilant vigilant, File file) { + if (vigilant != null && Minecraft.getMinecraft().isCallingFromMinecraftThread()) { + String name = !vigilant.getGuiTitle().equals("Settings") ? vigilant.getGuiTitle() : Loader.instance().activeModContainer() == null ? "Unknown" : Loader.instance().activeModContainer().getName(); + if (name.equals("OneConfig")) name = "Essential"; + String finalName = name; + // duplicate fix + if (ConfigCore.oneConfigMods.stream().anyMatch(mod -> mod.name.equals(finalName))) return null; + return new VigilanceConfig(new Mod(name, ModType.THIRD_PARTY), file.getAbsolutePath(), vigilant); + } else { + return null; + } + } + @Override public String[] getClassName() { return new String[]{"gg.essential.vigilance.Vigilant"}; @@ -88,18 +102,4 @@ public class VigilantTransformer implements ITransformer { } } } - - @SuppressWarnings("unused") - public static VigilanceConfig returnNewConfig(Vigilant vigilant, File file) { - if (vigilant != null && Minecraft.getMinecraft().isCallingFromMinecraftThread()) { - String name = !vigilant.getGuiTitle().equals("Settings") ? vigilant.getGuiTitle() : Loader.instance().activeModContainer() == null ? "Unknown" : Loader.instance().activeModContainer().getName(); - if (name.equals("OneConfig")) name = "Essential"; - String finalName = name; - // duplicate fix - if (ConfigCore.oneConfigMods.stream().anyMatch(mod -> mod.name.equals(finalName))) return null; - return new VigilanceConfig(new Mod(name, ModType.THIRD_PARTY), file.getAbsolutePath(), vigilant); - } else { - return null; - } - } } |