Skip to content

Commit a21ad1f

Browse files
TheKodeToadpeterix
authored andcommitted
Fix for update to Forge installer
1 parent 7531db2 commit a21ad1f

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repositories {
3434
dependencies {
3535
compileOnly "com.google.code.gson:gson:2.8.7"
3636
compileOnly "cpw.mods:modlauncher:8.0.9"
37-
compileOnly "net.minecraftforge:installer:2.1.9"
37+
compileOnly "net.minecraftforge:installer:2.2.7"
3838
compileOnly "net.sf.jopt-simple:jopt-simple:5.0.4"
3939

4040
provided project(":common")
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package io.github.zekerzhayard.forgewrapper.installer.util;
22

33
import java.io.File;
4-
import java.util.function.Predicate;
4+
import java.lang.reflect.Method;
55

6-
import net.minecraftforge.installer.actions.ClientInstall;
6+
import net.minecraftforge.installer.actions.PostProcessors;
77
import net.minecraftforge.installer.actions.ProgressCallback;
88
import net.minecraftforge.installer.json.Install;
99
import net.minecraftforge.installer.json.InstallV1;
@@ -16,23 +16,22 @@ public Install loadInstallProfile() {
1616
}
1717

1818
@Override
19-
public boolean runClientInstall(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar, File installerJar) {
20-
return new ClientInstall4MultiMC(profile, monitor, libraryDir, minecraftJar).run(null, input -> true, installerJar);
21-
}
19+
public boolean runClientInstall(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar,
20+
File installerJar) {
21+
PostProcessors processors = new PostProcessors(
22+
profile instanceof InstallV1 ? (InstallV1) profile : new InstallV1(profile), true, monitor);
2223

23-
public static class ClientInstall4MultiMC extends ClientInstall {
24-
protected File libraryDir;
25-
protected File minecraftJar;
24+
try {
25+
Method method = processors.getClass().getMethod("process", File.class, File.class, File.class, File.class);
26+
Object result = method.invoke(processors, libraryDir, minecraftJar, libraryDir.getParentFile(),
27+
installerJar);
2628

27-
public ClientInstall4MultiMC(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar) {
28-
super(profile instanceof InstallV1 ? (InstallV1) profile : new InstallV1(profile), monitor);
29-
this.libraryDir = libraryDir;
30-
this.minecraftJar = minecraftJar;
31-
}
29+
if (method.getReturnType() == boolean.class)
30+
return (boolean) result;
3231

33-
@Override
34-
public boolean run(File target, Predicate<String> optionals, File installer) {
35-
return this.processors.process(this.libraryDir, this.minecraftJar, this.libraryDir.getParentFile(), installer);
32+
return result != null;
33+
} catch (ReflectiveOperationException e) {
34+
throw new RuntimeException(e);
3635
}
3736
}
3837
}

0 commit comments

Comments
 (0)