fix: unable to launch

This commit is contained in:
huanghongxun
2020-03-08 20:49:00 +08:00
parent 20d0a2ae62
commit 4332bc124e
2 changed files with 5 additions and 23 deletions

View File

@@ -124,7 +124,7 @@ public final class LauncherHelper {
private void launch0() {
HMCLGameRepository repository = profile.getRepository();
DefaultDependencyManager dependencyManager = profile.getDependency();
Version version = MaintainTask.maintain(repository, repository.getResolvedPreservingPatchesVersion(selectedVersion));
Version version = MaintainTask.maintain(repository, repository.getResolvedVersion(selectedVersion));
Optional<String> gameVersion = GameVersion.minecraftVersion(repository.getVersionJar(version));
TaskExecutor executor = Task.allOf(

View File

@@ -45,7 +45,7 @@ public class MaintainTask extends Task<Version> {
this.repository = repository;
this.version = version;
if (!version.isResolvedPreservingPatches())
if (version.getInheritsFrom() != null)
throw new IllegalArgumentException("MaintainTask requires independent game version");
}
@@ -55,28 +55,10 @@ public class MaintainTask extends Task<Version> {
}
public static Version maintain(GameRepository repository, Version version) {
if (!version.isResolvedPreservingPatches())
if (version.getInheritsFrom() != null)
throw new IllegalArgumentException("MaintainTask requires independent game version");
// We made a mistake that priority of OptiFine should be 90000 instead of 10000,
// manually reset priority here.
version = version.setPatches(version.getPatches().stream().map(patch -> {
if (FABRIC.getPatchId().equals(patch.getId())) {
return patch.setPriority(30000);
} else if (FORGE.getPatchId().equals(patch.getId())) {
return patch.setPriority(30000);
} else if (LITELOADER.getPatchId().equals(patch.getId())) {
return patch.setPriority(60000);
} else if (OPTIFINE.getPatchId().equals(patch.getId())) {
return patch.setPriority(90000);
} else if (MINECRAFT.getPatchId().equals(patch.getId())) {
return patch.setPriority(0);
} else {
return patch;
}
}).collect(Collectors.toList())).resolve(repository);
String mainClass = version.getMainClass();
String mainClass = version.resolve(null).getMainClass();
if (mainClass != null && mainClass.contains("launchwrapper")) {
return maintainOptiFineLibrary(repository, maintainGameWithLaunchWrapper(unique(version), true));
@@ -91,7 +73,7 @@ public class MaintainTask extends Task<Version> {
public static Version maintainPreservingPatches(GameRepository repository, Version version) {
if (!version.isResolvedPreservingPatches())
throw new IllegalArgumentException("MaintainTask requires independent game version");
Version newVersion = maintain(repository, version.resolvePreservingPatches(repository));
Version newVersion = maintain(repository, version.resolve(repository));
return newVersion.setPatches(version.getPatches()).markAsUnresolved();
}