summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2024-02-29 00:48:02 +0000
committerTheKodeToad <TheKodeToad@proton.me>2024-02-29 10:44:17 +0000
commitb8a61722e9b3f9e87d220a488c1dd523c6d5de97 (patch)
tree563e9adf493fe13788878f4d382c1c992bec20e5
parenta3413eb5c46f0205b0aa7c0fd8cc326dbebcced2 (diff)
downloadProject-Tick-b8a61722e9b3f9e87d220a488c1dd523c6d5de97.tar.gz
Project-Tick-b8a61722e9b3f9e87d220a488c1dd523c6d5de97.zip
Fix for update to Forge installer
-rw-r--r--build.gradle2
-rw-r--r--src/main/java/io/github/zekerzhayard/forgewrapper/installer/util/InstallerV1.java31
2 files changed, 16 insertions, 17 deletions
diff --git a/build.gradle b/build.gradle
index 45e6dee5d7..ebd89d45ae 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,7 +34,7 @@ repositories {
dependencies {
compileOnly "com.google.code.gson:gson:2.8.7"
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"
provided project(":common")
diff --git a/src/main/java/io/github/zekerzhayard/forgewrapper/installer/util/InstallerV1.java b/src/main/java/io/github/zekerzhayard/forgewrapper/installer/util/InstallerV1.java
index 014a6240ea..c9ceeaf45c 100644
--- a/src/main/java/io/github/zekerzhayard/forgewrapper/installer/util/InstallerV1.java
+++ b/src/main/java/io/github/zekerzhayard/forgewrapper/installer/util/InstallerV1.java
@@ -1,9 +1,9 @@
package io.github.zekerzhayard.forgewrapper.installer.util;
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.json.Install;
import net.minecraftforge.installer.json.InstallV1;
@@ -16,23 +16,22 @@ public class InstallerV1 extends AbstractInstaller {
}
@Override
- public boolean runClientInstall(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar, File installerJar) {
- return new ClientInstall4MultiMC(profile, monitor, libraryDir, minecraftJar).run(null, input -> true, installerJar);
- }
+ public boolean runClientInstall(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar,
+ File installerJar) {
+ PostProcessors processors = new PostProcessors(
+ profile instanceof InstallV1 ? (InstallV1) profile : new InstallV1(profile), true, monitor);
- public static class ClientInstall4MultiMC extends ClientInstall {
- protected File libraryDir;
- protected File minecraftJar;
+ try {
+ Method method = processors.getClass().getMethod("process", File.class, File.class, File.class, File.class);
+ Object result = method.invoke(processors, libraryDir, minecraftJar, libraryDir.getParentFile(),
+ installerJar);
- public ClientInstall4MultiMC(Install profile, ProgressCallback monitor, File libraryDir, File minecraftJar) {
- super(profile instanceof InstallV1 ? (InstallV1) profile : new InstallV1(profile), monitor);
- this.libraryDir = libraryDir;
- this.minecraftJar = minecraftJar;
- }
+ if (method.getReturnType() == boolean.class)
+ return (boolean) result;
- @Override
- public boolean run(File target, Predicate<String> optionals, File installer) {
- return this.processors.process(this.libraryDir, this.minecraftJar, this.libraryDir.getParentFile(), installer);
+ return result != null;
+ } catch (ReflectiveOperationException e) {
+ throw new RuntimeException(e);
}
}
}