mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 06:17:47 -04:00
Fixed crash when launching 1.7.10 forge version
This commit is contained in:
parent
506c409303
commit
a52cc8c093
@ -25,6 +25,7 @@ import org.jackhuang.hmcl.auth.AuthInfo;
|
|||||||
import org.jackhuang.hmcl.auth.AuthenticationException;
|
import org.jackhuang.hmcl.auth.AuthenticationException;
|
||||||
import org.jackhuang.hmcl.auth.ServerDisconnectException;
|
import org.jackhuang.hmcl.auth.ServerDisconnectException;
|
||||||
import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
||||||
|
import org.jackhuang.hmcl.download.MaintainTask;
|
||||||
import org.jackhuang.hmcl.launch.*;
|
import org.jackhuang.hmcl.launch.*;
|
||||||
import org.jackhuang.hmcl.mod.CurseCompletionTask;
|
import org.jackhuang.hmcl.mod.CurseCompletionTask;
|
||||||
import org.jackhuang.hmcl.setting.LauncherVisibility;
|
import org.jackhuang.hmcl.setting.LauncherVisibility;
|
||||||
@ -76,7 +77,7 @@ public final class LauncherHelper {
|
|||||||
Profile profile = Settings.INSTANCE.getSelectedProfile();
|
Profile profile = Settings.INSTANCE.getSelectedProfile();
|
||||||
GameRepository repository = profile.getRepository();
|
GameRepository repository = profile.getRepository();
|
||||||
DefaultDependencyManager dependencyManager = profile.getDependency();
|
DefaultDependencyManager dependencyManager = profile.getDependency();
|
||||||
Version version = repository.getVersion(selectedVersion);
|
Version version = repository.getVersion(selectedVersion).resolve(repository);
|
||||||
Account account = Settings.INSTANCE.getSelectedAccount();
|
Account account = Settings.INSTANCE.getSelectedAccount();
|
||||||
VersionSetting setting = profile.getVersionSetting(selectedVersion);
|
VersionSetting setting = profile.getVersionSetting(selectedVersion);
|
||||||
Optional<String> gameVersion = GameVersion.minecraftVersion(repository.getVersionJar(version));
|
Optional<String> gameVersion = GameVersion.minecraftVersion(repository.getVersionJar(version));
|
||||||
|
@ -62,7 +62,7 @@ public class InstallerController {
|
|||||||
Consumer<InstallerItem> removeAction = x -> {
|
Consumer<InstallerItem> removeAction = x -> {
|
||||||
LinkedList<Library> newList = new LinkedList<>(version.getLibraries());
|
LinkedList<Library> newList = new LinkedList<>(version.getLibraries());
|
||||||
newList.remove(library);
|
newList.remove(library);
|
||||||
new MaintainTask(profile.getRepository(), version.setLibraries(newList))
|
new MaintainTask(version.setLibraries(newList))
|
||||||
.then(variables -> new VersionJsonSaveTask(profile.getRepository(), variables.get(MaintainTask.ID)))
|
.then(variables -> new VersionJsonSaveTask(profile.getRepository(), variables.get(MaintainTask.ID)))
|
||||||
.with(profile.getRepository().refreshVersionsAsync())
|
.with(profile.getRepository().refreshVersionsAsync())
|
||||||
.with(Task.of(Schedulers.javafx(), () -> loadVersion(this.profile, this.versionId)))
|
.with(Task.of(Schedulers.javafx(), () -> loadVersion(this.profile, this.versionId)))
|
||||||
|
@ -84,17 +84,17 @@ public class DefaultDependencyManager extends AbstractDependencyManager {
|
|||||||
case "forge":
|
case "forge":
|
||||||
return new ForgeInstallTask(this, gameVersion, version, libraryVersion)
|
return new ForgeInstallTask(this, gameVersion, version, libraryVersion)
|
||||||
.then(variables -> new LibrariesUniqueTask(variables.get("version")))
|
.then(variables -> new LibrariesUniqueTask(variables.get("version")))
|
||||||
.then(variables -> new MaintainTask(repository, variables.get("version")))
|
.then(variables -> new MaintainTask(variables.get("version")))
|
||||||
.then(variables -> new VersionJsonSaveTask(repository, variables.get("version")));
|
.then(variables -> new VersionJsonSaveTask(repository, variables.get("version")));
|
||||||
case "liteloader":
|
case "liteloader":
|
||||||
return new LiteLoaderInstallTask(this, gameVersion, version, libraryVersion)
|
return new LiteLoaderInstallTask(this, gameVersion, version, libraryVersion)
|
||||||
.then(variables -> new LibrariesUniqueTask(variables.get("version")))
|
.then(variables -> new LibrariesUniqueTask(variables.get("version")))
|
||||||
.then(variables -> new MaintainTask(repository, variables.get("version")))
|
.then(variables -> new MaintainTask(variables.get("version")))
|
||||||
.then(variables -> new VersionJsonSaveTask(repository, variables.get("version")));
|
.then(variables -> new VersionJsonSaveTask(repository, variables.get("version")));
|
||||||
case "optifine":
|
case "optifine":
|
||||||
return new OptiFineInstallTask(this, gameVersion, version, libraryVersion)
|
return new OptiFineInstallTask(this, gameVersion, version, libraryVersion)
|
||||||
.then(variables -> new LibrariesUniqueTask(variables.get("version")))
|
.then(variables -> new LibrariesUniqueTask(variables.get("version")))
|
||||||
.then(variables -> new MaintainTask(repository, variables.get("version")))
|
.then(variables -> new MaintainTask(variables.get("version")))
|
||||||
.then(variables -> new VersionJsonSaveTask(repository, variables.get("version")));
|
.then(variables -> new VersionJsonSaveTask(repository, variables.get("version")));
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Library id " + libraryId + " is unrecognized.");
|
throw new IllegalArgumentException("Library id " + libraryId + " is unrecognized.");
|
||||||
|
@ -28,16 +28,14 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MaintainTask extends TaskResult<Version> {
|
public class MaintainTask extends TaskResult<Version> {
|
||||||
|
|
||||||
private final GameRepository repository;
|
|
||||||
private final Version version;
|
private final Version version;
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|
||||||
public MaintainTask(GameRepository repository, Version version) {
|
public MaintainTask(Version version) {
|
||||||
this(repository, version, ID);
|
this(version, ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MaintainTask(GameRepository repository, Version version, String id) {
|
public MaintainTask(Version version, String id) {
|
||||||
this.repository = repository;
|
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public class Version implements Comparable<Version>, Validation {
|
|||||||
jar == null ? parent.jar : jar,
|
jar == null ? parent.jar : jar,
|
||||||
assetIndex == null ? parent.assetIndex : assetIndex,
|
assetIndex == null ? parent.assetIndex : assetIndex,
|
||||||
assets == null ? parent.assets : assets,
|
assets == null ? parent.assets : assets,
|
||||||
Lang.merge(parent.libraries, this.libraries),
|
Lang.merge(this.libraries, parent.libraries),
|
||||||
Lang.merge(parent.compatibilityRules, this.compatibilityRules),
|
Lang.merge(parent.compatibilityRules, this.compatibilityRules),
|
||||||
downloads == null ? parent.downloads : downloads,
|
downloads == null ? parent.downloads : downloads,
|
||||||
logging == null ? parent.logging : logging,
|
logging == null ? parent.logging : logging,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user