From a3d9e29350bba7f601e05921e80c2e12f60186bc Mon Sep 17 00:00:00 2001 From: Glavo Date: Sat, 10 Jan 2026 20:39:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E8=B5=84=E6=BA=90=E5=8C=85=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E9=A1=B5=E9=9D=A2=E4=B8=AD=E9=9A=90=E8=97=8F=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E6=A0=87=E7=AD=BE=20(#5180)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jackhuang/hmcl/ui/versions/DownloadListPage.java | 11 ++++++++--- .../org/jackhuang/hmcl/ui/versions/DownloadPage.java | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java index 8a9335365..4a177b0ce 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java @@ -208,6 +208,10 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP : i18n("curse.category." + category); } + protected boolean shouldDisplayCategory(String category) { + return !"minecraft".equals(category); + } + private String getLocalizedCategoryIndent(ModDownloadListPageSkin.CategoryIndented category) { return StringUtils.repeats(' ', category.indent * 4) + (category.getCategory() == null @@ -556,9 +560,10 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP content.setTitle(mod != null && I18n.isUseChinese() ? mod.getDisplayName() : dataItem.getTitle()); content.setSubtitle(dataItem.getDescription()); content.getTags().clear(); - dataItem.getCategories().stream() - .map(category -> getSkinnable().getLocalizedCategory(category)) - .forEach(content::addTag); + for (String category : dataItem.getCategories()) { + if (getSkinnable().shouldDisplayCategory(category)) + content.addTag(getSkinnable().getLocalizedCategory(category)); + } loadIcon(dataItem); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java index ed424c9ce..7b9e3ba36 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java @@ -357,9 +357,10 @@ public class DownloadPage extends Control implements DecoratorPage { ModTranslations.Mod mod = ModTranslations.getTranslationsByRepositoryType(page.repository.getType()).getModByCurseForgeId(addon.getSlug()); content.setTitle(mod != null && I18n.isUseChinese() ? mod.getDisplayName() : addon.getTitle()); content.setSubtitle(addon.getDescription()); - addon.getCategories().stream() - .map(page::getLocalizedCategory) - .forEach(content::addTag); + for (String category : addon.getCategories()) { + if (page.shouldDisplayCategory(category)) + content.addTag(page.getLocalizedCategory(category)); + } if (StringUtils.isNotBlank(addon.getIconUrl())) { imageView.imageProperty().bind(FXUtils.newRemoteImage(addon.getIconUrl(), 80, 80, true, true)); }