Skip to content

Commit 083dbb1

Browse files
authored
修复安装新实例时未将 patch 合并到主 manifest 中的问题 (#6718)
1 parent c958519 commit 083dbb1

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultGameBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public Task<?> buildAsync() {
111111
GameInstanceManifest.Resolved resolved = draft.getBaseSnapshot().resolve(manifest);
112112
return new GameDownloadTask(dependencyManager, resolved.launchManifest())
113113
.thenApplyAsync(minecraftJar -> {
114-
draft.put(resolved.standaloneManifest());
114+
draft.put(resolved.launchManifest().withPatches(manifest.patches()));
115115
draft.putPrimaryJar(id, minecraftJar);
116116
return draft.commit().getInstance(id);
117117
});

HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ public <E extends Exception> Task<Void> updateInstanceAsync(
638638
return Task.supplyAsync(() -> {
639639
GameRepositoryDraft draft = openDraft();
640640
active.set(draft);
641-
GameInstance publishedInstance = getInstance(instanceId);
642-
return publishedInstance;
641+
return draft.getBaseSnapshot().getInstance(instanceId);
643642
})
644643
.thenComposeAsync(updater)
645644
.thenApplyAsync(manifest -> {

HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepositoryDraft.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public DefaultGameRepository getRepository() {
9191
return repository;
9292
}
9393

94+
@Override
9495
public DefaultGameRepositorySnapshot getBaseSnapshot() {
9596
return baseSnapshot;
9697
}

HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameRepositoryDraft.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ enum State {
6363
/// @return the repository
6464
GameRepository getRepository();
6565

66+
GameRepositorySnapshot getBaseSnapshot();
67+
6668
/// Returns this draft's lifecycle state.
6769
///
6870
/// @return the current state

0 commit comments

Comments
 (0)