Fix for update to Forge installer
This commit is contained in:
parent
7531db2b71
commit
a21ad1f613
2 changed files with 16 additions and 17 deletions
|
@ -34,7 +34,7 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly "com.google.code.gson:gson:2.8.7"
|
compileOnly "com.google.code.gson:gson:2.8.7"
|
||||||
compileOnly "cpw.mods:modlauncher:8.0.9"
|
compileOnly "cpw.mods:modlauncher:8.0.9"
|
||||||
compileOnly "net.minecraftforge:installer:2.1.9"
|
compileOnly "net.minecraftforge:installer:2.2.7"
|
||||||
compileOnly "net.sf.jopt-simple:jopt-simple:5.0.4"
|
compileOnly "net.sf.jopt-simple:jopt-simple:5.0.4"
|
||||||
|
|
||||||
provided project(":common")
|
provided project(":common")
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package io.github.zekerzhayard.forgewrapper.installer.util;
|
package io.github.zekerzhayard.forgewrapper.installer.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.function.Predicate;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import net.minecraftforge.installer.actions.ClientInstall;
|
import net.minecraftforge.installer.actions.PostProcessors;
|
||||||
import net.minecraftforge.installer.actions.ProgressCallback;
|
import net.minecraftforge.installer.actions.ProgressCallback;
|
||||||
import net.minecraftforge.installer.json.Install;
|
import net.minecraftforge.installer.json.Install;
|
||||||
import net.minecraftforge.installer.json.InstallV1;
|
import net.minecraftforge.installer.json.InstallV1;
|
||||||
|
@ -16,23 +16,22 @@ public class InstallerV1 extends AbstractInstaller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean runClientInstall(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar, File installerJar) {
|
public boolean runClientInstall(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar,
|
||||||
return new ClientInstall4MultiMC(profile, monitor, libraryDir, minecraftJar).run(null, input -> true, installerJar);
|
File installerJar) {
|
||||||
}
|
PostProcessors processors = new PostProcessors(
|
||||||
|
profile instanceof InstallV1 ? (InstallV1) profile : new InstallV1(profile), true, monitor);
|
||||||
|
|
||||||
public static class ClientInstall4MultiMC extends ClientInstall {
|
try {
|
||||||
protected File libraryDir;
|
Method method = processors.getClass().getMethod("process", File.class, File.class, File.class, File.class);
|
||||||
protected File minecraftJar;
|
Object result = method.invoke(processors, libraryDir, minecraftJar, libraryDir.getParentFile(),
|
||||||
|
installerJar);
|
||||||
|
|
||||||
public ClientInstall4MultiMC(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar) {
|
if (method.getReturnType() == boolean.class)
|
||||||
super(profile instanceof InstallV1 ? (InstallV1) profile : new InstallV1(profile), monitor);
|
return (boolean) result;
|
||||||
this.libraryDir = libraryDir;
|
|
||||||
this.minecraftJar = minecraftJar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return result != null;
|
||||||
public boolean run(File target, Predicate<String> optionals, File installer) {
|
} catch (ReflectiveOperationException e) {
|
||||||
return this.processors.process(this.libraryDir, this.minecraftJar, this.libraryDir.getParentFile(), installer);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue