diff options
author | PandaNinjas <admin@malwarefight.gq> | 2023-02-13 16:22:43 -0800 |
---|---|---|
committer | PandaNinjas <admin@malwarefight.gq> | 2023-02-13 16:22:43 -0800 |
commit | 2beca5f91f8da0b16910e7720788eacf385e03db (patch) | |
tree | 5e8ea8afaeb5ff7e911a37057957dc4da9e938d4 /src/main/java/gq/malwarefight/nosession/relaunch | |
parent | 5be680bd58dec24b4de3738426a6ca36adaa54d1 (diff) | |
download | NoSession-2beca5f91f8da0b16910e7720788eacf385e03db.tar.gz NoSession-2beca5f91f8da0b16910e7720788eacf385e03db.tar.bz2 NoSession-2beca5f91f8da0b16910e7720788eacf385e03db.zip |
v1.1.0 release (trolling)
Diffstat (limited to 'src/main/java/gq/malwarefight/nosession/relaunch')
-rw-r--r-- | src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java b/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java index e712254..d1a240c 100644 --- a/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java +++ b/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java @@ -2,17 +2,6 @@ package gq.malwarefight.nosession.relaunch; import gq.malwarefight.nosession.tweaks.cleanup.CleanupTweaker; import gq.malwarefight.nosession.utils.Utils; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.client.FMLClientHandler; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModAPIManager; -import net.minecraftforge.fml.common.asm.ASMTransformerWrapper; -import net.minecraftforge.fml.common.registry.ItemStackHolderInjector; -import net.minecraftforge.fml.common.registry.ObjectHolderRegistry; -import net.minecraftforge.fml.relauncher.FMLInjectionData; -import net.minecraftforge.fml.relauncher.FMLLaunchHandler; - -import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -22,9 +11,18 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; +import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModAPIManager; +import net.minecraftforge.fml.common.asm.ASMTransformerWrapper; +import net.minecraftforge.fml.common.registry.ItemStackHolderInjector; +import net.minecraftforge.fml.common.registry.ObjectHolderRegistry; +import net.minecraftforge.fml.relauncher.FMLInjectionData; +import net.minecraftforge.fml.relauncher.FMLLaunchHandler; public class Relaunch { - public static void relaunch(ArrayList<String> args, File gameDir, File assetsDir, String version) throws Exception { + public static void relaunch(ArrayList<String> args) throws Exception { resetSecurityManager(); setToNull(FMLLaunchHandler.class, "INSTANCE"); setToNull(Loader.class, "instance"); @@ -36,18 +34,10 @@ public class Relaunch { Utils.setStaticValue(FMLInjectionData.class, "containers", new ArrayList<String>()); resetTransformerWrapper(); addSelfToClassloader(); - Class<Launch> innerLaunch = Launch.class; - Method launch = innerLaunch.getDeclaredMethod("main", String[].class); - launch.invoke(null, (Object) constructArgs(args, gameDir, assetsDir, version)); + Launch.main(constructArgs(args)); } - private static String[] constructArgs(ArrayList<String> initial, File gameDir, File assetDir, String version) { - initial.add("--version"); - initial.add(version); - initial.add("--gameDir"); - initial.add(gameDir.getAbsolutePath()); - initial.add("--assetsDir"); - initial.add(assetDir.getAbsolutePath()); + private static String[] constructArgs(ArrayList<String> initial) { initial.add("--tweakClass"); initial.add(CleanupTweaker.class.getName()); return initial.toArray(new String[0]); |