Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,21 @@ public void setVersionListSource(String versionListSource) {
this.versionListSource.set(versionListSource);
}

@SerializedName("defaultAddonSource")
private final StringProperty defaultAddonSource = new SimpleStringProperty("mods.modrinth");

public StringProperty defaultAddonSourceProperty() {
return defaultAddonSource;
}

public String getDefaultAddonSource() {
return defaultAddonSource.get();
}

public void setDefaultAddonSource(String defaultAddonSource) {
this.defaultAddonSource.set(defaultAddonSource);
}

@SerializedName("hasProxy")
private final BooleanProperty hasProxy = new SimpleBooleanProperty();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ public DownloadSettingsPage() {
downloadSourcePane.setItems(DownloadProviders.DIRECT_PROVIDERS.keySet());
downloadSourcePane.valueProperty().bindBidirectional(config().downloadTypeProperty());

downloadSource.getContent().setAll(autoChooseDownloadSource, versionListSourcePane, downloadSourcePane);
var defaultAddonSourcePane = new LineSelectButton<String>();
defaultAddonSourcePane.setTitle(i18n("settings.launcher.default_addon_source"));
defaultAddonSourcePane.setConverter(I18n::i18n);
defaultAddonSourcePane.setItems("mods.modrinth", "mods.curseforge");
defaultAddonSourcePane.valueProperty().bindBidirectional(config().defaultAddonSourceProperty());

downloadSource.getContent().setAll(autoChooseDownloadSource, versionListSourcePane, downloadSourcePane, defaultAddonSourcePane);
}

content.getChildren().addAll(ComponentList.createComponentListTitle(i18n("settings.launcher.download_source")), downloadSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jackhuang.hmcl.mod.RemoteModRepository;
import org.jackhuang.hmcl.mod.curse.CurseForgeRemoteModRepository;
import org.jackhuang.hmcl.mod.modrinth.ModrinthRemoteModRepository;
import org.jackhuang.hmcl.setting.ConfigHolder;
import org.jackhuang.hmcl.util.i18n.I18n;

import java.util.MissingResourceException;
Expand Down Expand Up @@ -67,12 +68,22 @@ private HMCLLocalizedDownloadListPage(DownloadPage.DownloadCallback callback, bo
downloadSources.add("mods.curseforge");
}

if (modrinth != null) {
downloadSource.set("mods.modrinth");
} else if (curseForge != null) {
downloadSource.set("mods.curseforge");
if ("mods.curseforge".equals(ConfigHolder.config().getDefaultAddonSource())) {
if (curseForge != null) {
downloadSource.set("mods.curseforge");
} else if (modrinth != null) {
downloadSource.set("mods.modrinth");
} else {
throw new AssertionError("Should not be here.");
}
} else {
throw new AssertionError("Should not be here.");
if (modrinth != null) {
downloadSource.set("mods.modrinth");
} else if (curseForge != null) {
downloadSource.set("mods.curseforge");
} else {
throw new AssertionError("Should not be here.");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import org.jackhuang.hmcl.task.Task;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.*;

import static org.jackhuang.hmcl.util.logging.Logger.LOG;

Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,7 @@ settings.launcher.download.threads.auto=Automatically Determine
settings.launcher.download.threads.hint=Too many threads may cause your system to freeze, and your download speed may be affected by your ISP and download servers. It is not always the case that more threads increase your download speed.
settings.launcher.download_source=Download Source
settings.launcher.download_source.auto=Automatically Choose Download Sources
settings.launcher.default_addon_source=Default Addon Source
settings.launcher.enable_game_list=Show instance list in homepage
settings.launcher.font=Font
settings.launcher.font.anti_aliasing=Anti-aliasing
Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ settings.launcher.download.threads.auto=自動選取執行緒數
settings.launcher.download.threads.hint=執行緒數過高可能導致系統卡頓。你的下載速度會受到網際網路運營商、下載來源伺服器等方面的影響。調高下載執行緒數不一定能大幅提升總下載速度。
settings.launcher.download_source=下載來源
settings.launcher.download_source.auto=自動選取下載來源
settings.launcher.default_addon_source=遊戲內容預設下載源
settings.launcher.enable_game_list=在首頁內顯示遊戲清單
settings.launcher.font=字體
settings.launcher.font.anti_aliasing=反鋸齒
Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ settings.launcher.download.threads.auto=自动选择线程数
settings.launcher.download.threads.hint=线程数过高可能导致系统卡顿。你的下载速度会受到互联网运营商、下载源服务器等方面的影响。调高下载线程数不一定能大幅提升总下载速度。
settings.launcher.download_source=下载源
settings.launcher.download_source.auto=自动选择下载源
settings.launcher.default_addon_source=游戏内容默认下载源
settings.launcher.enable_game_list=在主页内显示版本列表
settings.launcher.font=字体
settings.launcher.font.anti_aliasing=抗锯齿
Expand Down
12 changes: 9 additions & 3 deletions HMCLCore/src/main/java/org/jackhuang/hmcl/mod/RemoteMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,22 @@ public int hashCode() {
}

public enum Type {
CURSEFORGE(CurseForgeRemoteModRepository.MODS),
MODRINTH(ModrinthRemoteModRepository.MODS);
CURSEFORGE("mods.curseforge", CurseForgeRemoteModRepository.MODS),
MODRINTH("mods.modrinth", ModrinthRemoteModRepository.MODS);

private final String key;
private final RemoteModRepository remoteModRepository;

public String getKey() {
return key;
}

public RemoteModRepository getRemoteModRepository() {
return this.remoteModRepository;
}

Type(RemoteModRepository remoteModRepository) {
Type(String key, RemoteModRepository remoteModRepository) {
this.key = key;
this.remoteModRepository = remoteModRepository;
}
}
Expand Down