优化对无法识别的模组的提示 (#4659)

This commit is contained in:
Glavo
2025-10-12 20:57:47 +08:00
committed by GitHub
parent f8a4261480
commit f9a39f1c90
4 changed files with 9 additions and 4 deletions

View File

@@ -631,6 +631,8 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
LocalModFile modInfo = dataItem.getModInfo(); LocalModFile modInfo = dataItem.getModInfo();
ModTranslations.Mod modTranslations = dataItem.getModTranslations(); ModTranslations.Mod modTranslations = dataItem.getModTranslations();
ModLoaderType modLoaderType = modInfo.getModLoaderType();
dataItem.loadIcon(imageView, new WeakReference<>(this.itemProperty())); dataItem.loadIcon(imageView, new WeakReference<>(this.itemProperty()));
String displayName = modInfo.getName(); String displayName = modInfo.getName();
@@ -656,16 +658,16 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
content.setTitle(displayName); content.setTitle(displayName);
StringJoiner joiner = new StringJoiner(" | "); StringJoiner joiner = new StringJoiner(" | ");
if (modLoaderType != ModLoaderType.UNKNOWN && StringUtils.isNotBlank(modInfo.getId()))
if (StringUtils.isNotBlank(modInfo.getId()))
joiner.add(modInfo.getId()); joiner.add(modInfo.getId());
joiner.add(FileUtils.getName(modInfo.getFile())); joiner.add(FileUtils.getName(modInfo.getFile()));
content.setSubtitle(joiner.toString()); content.setSubtitle(joiner.toString());
ModLoaderType modLoaderType = modInfo.getModLoaderType(); if (modLoaderType == ModLoaderType.UNKNOWN) {
if (!ModListPageSkin.this.getSkinnable().supportedLoaders.contains(modLoaderType)) { content.addTagWarning(i18n("mods.unknown"));
} else if (!ModListPageSkin.this.getSkinnable().supportedLoaders.contains(modLoaderType)) {
warning.add(i18n("mods.warning.loader_mismatch")); warning.add(i18n("mods.warning.loader_mismatch"));
switch (dataItem.getModInfo().getModLoaderType()) { switch (dataItem.getModInfo().getModLoaderType()) {
case FORGE: case FORGE:

View File

@@ -1093,6 +1093,7 @@ mods.update_modpack_mod.warning=Updating mods in a modpack can lead to irreparab
mods.warning.loader_mismatch=Mod loader mismatch mods.warning.loader_mismatch=Mod loader mismatch
mods.install=Install mods.install=Install
mods.save_as=Save As mods.save_as=Save As
mods.unknown=Unknown Mod
nbt.entries=%s entries nbt.entries=%s entries
nbt.open.failed=Failed to open file nbt.open.failed=Failed to open file

View File

@@ -890,6 +890,7 @@ mods.update_modpack_mod.warning=更新模組包中的模組可能導致模組包
mods.warning.loader_mismatch=模組載入器不匹配 mods.warning.loader_mismatch=模組載入器不匹配
mods.install=安裝到目前實例 mods.install=安裝到目前實例
mods.save_as=下載到本機目錄 mods.save_as=下載到本機目錄
mods.unknown=未知模組
nbt.entries=%s 個條目 nbt.entries=%s 個條目
nbt.open.failed=開啟檔案失敗 nbt.open.failed=開啟檔案失敗

View File

@@ -900,6 +900,7 @@ mods.update_modpack_mod.warning=更新整合包中的模组可能导致整合包
mods.warning.loader_mismatch=模组加载器不匹配 mods.warning.loader_mismatch=模组加载器不匹配
mods.install=安装到当前实例 mods.install=安装到当前实例
mods.save_as=下载到本地文件夹 mods.save_as=下载到本地文件夹
mods.unknown=未知模组
nbt.entries=%s 个条目 nbt.entries=%s 个条目
nbt.open.failed=打开文件失败 nbt.open.failed=打开文件失败