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.
This commit is contained in:
Henry Le Grys 2024-01-02 20:22:23 +00:00
parent 60030695b3
commit 11808457fe
3 changed files with 21 additions and 1 deletions

View File

@ -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<String> 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));
}

View File

@ -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;

View File

@ -249,6 +249,8 @@ public abstract class BaseUpdater {
}
for (Library library : allLibraries) {
if (library.isGenerated()) continue; // Skip generated libraries.
if (library.matches(environment)) {
checkInterrupted();