-
Notifications
You must be signed in to change notification settings - Fork 4
/
ForgeInstallWrapper2.java
54 lines (44 loc) · 1.29 KB
/
ForgeInstallWrapper2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.net.URL;
import java.io.File;
import java.net.URLClassLoader;
import java.lang.reflect.Method;
import java.io.PrintStream;
import java.util.function.Predicate;
import net.minecraftforge.installer.actions.ClientInstall;
import net.minecraftforge.installer.actions.ProgressCallback;
import net.minecraftforge.installer.json.Install;
import net.minecraftforge.installer.json.Util;
public class ForgeInstallWrapper2 {
public static void main(String[] args)
{
if (args.length == 2)
{
ForgeInstall(new File(args[0]), new File(args[1]));
}
else
{
System.out.println("Incorrect parameters");
}
}
@SuppressWarnings("unchecked")
public static void ForgeInstall(File _installerJar, File minecraftDir)
{
System.out.println("Installing Forge from JAR v2");
try {
Install profile = Util.loadInstallProfile();
ProgressCallback monitor = ProgressCallback.withOutputs(System.out);
ClientInstall install = new ClientInstall(profile, monitor);
Predicate<String> optPred = new Predicate<String>() {
@Override
public boolean test(String s) {
return true;
}
};
Object result = install.run(minecraftDir, optPred);
} catch (Throwable e1) {
e1.printStackTrace();
System.exit(-1);
}
System.out.println("Forge update complete");
}
}