简体   繁体   中英

Minecraft custom launcher - forge mod load

I'm trying to make a launcher for minecraft.

When I launch it from workspace (in C:/users/hugo/workspace), everything work perfectly.

But when I run the launcher from desktop, it try to load mods from ALL folders in the desktop. It create a "logs" folder in the desktop folder too.

my launch command (without library load and after generation):

javaw -Xmx1024M -Xms1024M -XX:MaxPermSize=256M 
-Djava.library.path=C:\Users\Hugo\AppData\Roaming\Survival-Machines\game1\natives
-cp "C:\Users\Hugo\AppData...versions\1.7.10\1.7.10.jar;"
net.minecraft.launchwrapper.Launch
--tweakClass cpw.mods.fml.common.launcher.FMLTweaker
--username Slaynash
--version 1.7.10
--gameDir C:\Users\Hugo\AppData\Roaming\Survival-Machines\game1\
--assetsDir C:\Users\Hugo\AppData\Roaming\Survival-Machines\game1\assets
--assetIndex 1.7.10
--uuid 32********a3
--userProperties {}
--accessToken fa********cc

I launch it with java and function Runtime.getRuntime().exec(String cmd);

Is my launch command bad, or have i forgot an argument ?

Thanks for help, Hugo

and sorry for my bad english :/

I think it's in the launch command - I suggest you use a different override of the exec() method - one that allows you to set the working folder.

Your current one just inherits the current working directory, evidently the desktop.

Instead, use Runtime.getRuntime().exec(String cmd, String[] argp, File dir);

This lets you tell java where to start the application, which will presumably be the folder that contains your mods.

https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String,%20java.lang.String[],%20java.io.File)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM