From 11808457fef3f3e351cdc544b1db76f721822957 Mon Sep 17 00:00:00 2001 From: Henry Le Grys Date: Tue, 2 Jan 2024 20:22:23 +0000 Subject: [PATCH] Fix launcher trying to download processor outputs Fix for forge 1.20.4; the generated client jar is specified as a library because it goes on the classpath now. --- .../loaders/ModernForgeLoaderProcessor.java | 16 ++++++++++++++++ .../launcher/model/minecraft/Library.java | 4 +++- .../com/skcraft/launcher/update/BaseUpdater.java | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java b/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java index b21b63f..b59201b 100644 --- a/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java +++ b/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java @@ -150,6 +150,22 @@ public class ModernForgeLoaderProcessor implements ILoaderProcessor { // Add loader manifest to the map manifest.getLoaders().put(loaderName, new LoaderManifest(profile.getLibraries(), profile.getData(), extraFiles)); + // Find name of final patched library and mark it as excluded from download + // TODO: we should generalize this to all process outputs, really + SidedData finalJars = profile.getData().get("PATCHED"); + if (finalJars != null) { + String libraryName = finalJars.getClient(); + libraryName = libraryName.substring(1, libraryName.length() - 1); + + for (Library lib : result.getLoaderLibraries()) { + if (lib.getName().equals(libraryName)) { + lib.setGenerated(true); + log.info(String.format("Setting generated flag on library '%s'", lib.getName())); + break; + } + } + } + // Add processors manifest.getTasks().addAll(profile.toProcessorEntries(loaderName)); } diff --git a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java index f6cd2d8..2fa1c35 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java @@ -8,6 +8,7 @@ package com.skcraft.launcher.model.minecraft; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.collect.Lists; @@ -33,7 +34,8 @@ public class Library { private String comment; // Custom - private boolean locallyAvailable; + @JsonInclude(value = JsonInclude.Include.NON_DEFAULT) + private boolean generated; public boolean matches(Environment environment) { boolean allow = false; diff --git a/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java b/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java index e447ef0..ea6dff0 100644 --- a/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java +++ b/launcher/src/main/java/com/skcraft/launcher/update/BaseUpdater.java @@ -249,6 +249,8 @@ public abstract class BaseUpdater { } for (Library library : allLibraries) { + if (library.isGenerated()) continue; // Skip generated libraries. + if (library.matches(environment)) { checkInterrupted();