From 20122e1bca55a029527e0990c3b4607613add860 Mon Sep 17 00:00:00 2001 From: Daniel Orr Date: Sat, 19 Oct 2024 18:56:15 +0100 Subject: [PATCH 1/2] feat: update sort --- .../modmenu/config/ModMenuConfig.java | 5 ++-- .../modmenu/gui/ModsScreen.java | 2 +- .../resources/assets/modmenu/lang/en_us.json | 25 ++++++++++--------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/terraformersmc/modmenu/config/ModMenuConfig.java b/src/main/java/com/terraformersmc/modmenu/config/ModMenuConfig.java index fc11fd79..746d8540 100644 --- a/src/main/java/com/terraformersmc/modmenu/config/ModMenuConfig.java +++ b/src/main/java/com/terraformersmc/modmenu/config/ModMenuConfig.java @@ -89,8 +89,9 @@ public static SimpleOption[] asOptions() { } public enum Sorting { - ASCENDING(Comparator.comparing(mod -> mod.getTranslatedName() - .toLowerCase(Locale.ROOT))), DESCENDING(ASCENDING.getComparator().reversed()); + ASCENDING(Comparator.comparing(mod -> mod.getTranslatedName().toLowerCase(Locale.ROOT))), + DESCENDING(ASCENDING.getComparator().reversed()), + HAS_UPDATE(Comparator.comparing(Mod::hasUpdate).reversed()); private final Comparator comparator; diff --git a/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java b/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java index ca03b120..d15c9eec 100644 --- a/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java +++ b/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java @@ -140,7 +140,7 @@ protected void init() { Text sortingText = ModMenuConfig.SORTING.getButtonText(); Text librariesText = ModMenuConfig.SHOW_LIBRARIES.getButtonText(); - int sortingWidth = textRenderer.getWidth(sortingText) + 20; + int sortingWidth = textRenderer.getWidth(sortingText) + 28; int librariesWidth = textRenderer.getWidth(librariesText) + 20; this.filtersWidth = librariesWidth + sortingWidth + 2; diff --git a/src/main/resources/assets/modmenu/lang/en_us.json b/src/main/resources/assets/modmenu/lang/en_us.json index 2c779bef..d3cc460f 100644 --- a/src/main/resources/assets/modmenu/lang/en_us.json +++ b/src/main/resources/assets/modmenu/lang/en_us.json @@ -4,7 +4,7 @@ "modmenu.title": "Mods", "modmenu.nameTranslation.modmenu": "Mod Menu", "modmenu.descriptionTranslation.modmenu": "Adds a mod menu to view the list of mods you have installed.", - + "modmenu.loaded": "(%s Loaded)", "modmenu.loaded.short": "(%s)", "modmenu.loaded.69.secret": "(%s Loaded...nice)", @@ -13,7 +13,7 @@ "modmenu.mods.1": " (%s Mod)", "modmenu.mods.69.secret": " (%s Mods...nice)", "modmenu.mods.420.secret": " (%s Mods...blaze it)", - + "modmenu.search": "Search for mods", "modmenu.searchTerms.library": "api library", "modmenu.searchTerms.patchwork": "patchwork forge fml", @@ -22,7 +22,7 @@ "modmenu.searchTerms.clientside": "clientside gameside", "modmenu.searchTerms.configurable": "configurations configs configures configurable options settings", "modmenu.searchTerms.hasUpdate": "updates version", - + "modmenu.toggleFilterOptions": "Toggle Filter Options", "modmenu.showingMods.n": "Showing %s mods", "modmenu.showingMods.1": "Showing %s mod", @@ -32,20 +32,20 @@ "modmenu.showingModsLibraries.n.1": "Showing %s mods and %s library", "modmenu.showingModsLibraries.1.n": "Showing %s mod and %s libraries", "modmenu.showingModsLibraries.1.1": "Showing %s mod and %s library", - + "modmenu.badge.library": "Library", "modmenu.badge.clientsideOnly": "Client", "modmenu.badge.deprecated": "Deprecated", "modmenu.badge.forge": "Forge", "modmenu.badge.modpack": "Modpack", "modmenu.badge.minecraft": "Minecraft", - + "modmenu.dropInfo.line1": "Drag and drop files into", "modmenu.dropInfo.line2": "this window to add mods", "modmenu.dropConfirm": "Do you want to copy the following mods into the mods directory?", "modmenu.dropSuccessful.line1": "Successfully copied mods", "modmenu.dropSuccessful.line2": "Restart game to load mods", - + "modmenu.modIdToolTip": "Mod ID: %s", "modmenu.authorPrefix": "By %s", "modmenu.config": "Edit Config", @@ -53,7 +53,7 @@ "modmenu.configure.error": "Failed to load config screen for '%s'\nReport to '%s', not Mod Menu", "modmenu.website": "Website", "modmenu.issues": "Issues", - + "modmenu.credits": "Credits:", "modmenu.viewCredits": "View Credits", "modmenu.license": "License:", @@ -65,7 +65,7 @@ "modmenu.updateText": "v%s on %s", "modmenu.install_version": "Install version %s", "modmenu.downloadLink": "Download", - + "modmenu.buymeacoffee": "Buy Me a Coffee", "modmenu.coindrop": "Coindrop", "modmenu.crowdin": "Crowdin", @@ -87,7 +87,7 @@ "modmenu.twitter": "X (Twitter)", "modmenu.wiki": "Wiki", "modmenu.youtube": "YouTube", - + "modmenu.credits.role.author": "Authors", "modmenu.credits.role.contributor": "Contributors", "modmenu.credits.role.translator": "Translators", @@ -95,20 +95,21 @@ "modmenu.credits.role.playtester": "Playtesters", "modmenu.credits.role.illustrator": "Illustrators", "modmenu.credits.role.owner": "Owners", - + "modmenu.modsFolder": "Open Mods Folder", "modmenu.configsFolder": "Open Configs Folder", - + "modmenu.nameTranslation.minecraft": "Minecraft", "modmenu.descriptionTranslation.minecraft": "The base game.", "modmenu.nameTranslation.java": "Java", "modmenu.descriptionTranslation.java": "The Java runtime environment.", "modmenu.javaDistributionName": "Running: %s", - + "modmenu.options": "Mod Menu Options", "option.modmenu.sorting": "Sort", "option.modmenu.sorting.ascending": "A-Z", "option.modmenu.sorting.descending": "Z-A", + "option.modmenu.sorting.has_update": "Has Update", "option.modmenu.show_libraries": "Libraries", "option.modmenu.show_libraries.true": "Shown", "option.modmenu.show_libraries.false": "Hidden", From 822db0d70b71ae776cbd77c9c7e620f16de6b1fb Mon Sep 17 00:00:00 2001 From: Daniel Orr Date: Sat, 19 Oct 2024 18:59:23 +0100 Subject: [PATCH 2/2] chore: add back whitespace to reduce diff --- .../resources/assets/modmenu/lang/en_us.json | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/resources/assets/modmenu/lang/en_us.json b/src/main/resources/assets/modmenu/lang/en_us.json index d3cc460f..66d57169 100644 --- a/src/main/resources/assets/modmenu/lang/en_us.json +++ b/src/main/resources/assets/modmenu/lang/en_us.json @@ -4,7 +4,7 @@ "modmenu.title": "Mods", "modmenu.nameTranslation.modmenu": "Mod Menu", "modmenu.descriptionTranslation.modmenu": "Adds a mod menu to view the list of mods you have installed.", - + "modmenu.loaded": "(%s Loaded)", "modmenu.loaded.short": "(%s)", "modmenu.loaded.69.secret": "(%s Loaded...nice)", @@ -13,7 +13,7 @@ "modmenu.mods.1": " (%s Mod)", "modmenu.mods.69.secret": " (%s Mods...nice)", "modmenu.mods.420.secret": " (%s Mods...blaze it)", - + "modmenu.search": "Search for mods", "modmenu.searchTerms.library": "api library", "modmenu.searchTerms.patchwork": "patchwork forge fml", @@ -22,7 +22,7 @@ "modmenu.searchTerms.clientside": "clientside gameside", "modmenu.searchTerms.configurable": "configurations configs configures configurable options settings", "modmenu.searchTerms.hasUpdate": "updates version", - + "modmenu.toggleFilterOptions": "Toggle Filter Options", "modmenu.showingMods.n": "Showing %s mods", "modmenu.showingMods.1": "Showing %s mod", @@ -32,20 +32,20 @@ "modmenu.showingModsLibraries.n.1": "Showing %s mods and %s library", "modmenu.showingModsLibraries.1.n": "Showing %s mod and %s libraries", "modmenu.showingModsLibraries.1.1": "Showing %s mod and %s library", - + "modmenu.badge.library": "Library", "modmenu.badge.clientsideOnly": "Client", "modmenu.badge.deprecated": "Deprecated", "modmenu.badge.forge": "Forge", "modmenu.badge.modpack": "Modpack", "modmenu.badge.minecraft": "Minecraft", - + "modmenu.dropInfo.line1": "Drag and drop files into", "modmenu.dropInfo.line2": "this window to add mods", "modmenu.dropConfirm": "Do you want to copy the following mods into the mods directory?", "modmenu.dropSuccessful.line1": "Successfully copied mods", "modmenu.dropSuccessful.line2": "Restart game to load mods", - + "modmenu.modIdToolTip": "Mod ID: %s", "modmenu.authorPrefix": "By %s", "modmenu.config": "Edit Config", @@ -53,7 +53,7 @@ "modmenu.configure.error": "Failed to load config screen for '%s'\nReport to '%s', not Mod Menu", "modmenu.website": "Website", "modmenu.issues": "Issues", - + "modmenu.credits": "Credits:", "modmenu.viewCredits": "View Credits", "modmenu.license": "License:", @@ -65,7 +65,7 @@ "modmenu.updateText": "v%s on %s", "modmenu.install_version": "Install version %s", "modmenu.downloadLink": "Download", - + "modmenu.buymeacoffee": "Buy Me a Coffee", "modmenu.coindrop": "Coindrop", "modmenu.crowdin": "Crowdin", @@ -87,7 +87,7 @@ "modmenu.twitter": "X (Twitter)", "modmenu.wiki": "Wiki", "modmenu.youtube": "YouTube", - + "modmenu.credits.role.author": "Authors", "modmenu.credits.role.contributor": "Contributors", "modmenu.credits.role.translator": "Translators", @@ -95,16 +95,16 @@ "modmenu.credits.role.playtester": "Playtesters", "modmenu.credits.role.illustrator": "Illustrators", "modmenu.credits.role.owner": "Owners", - + "modmenu.modsFolder": "Open Mods Folder", "modmenu.configsFolder": "Open Configs Folder", - + "modmenu.nameTranslation.minecraft": "Minecraft", "modmenu.descriptionTranslation.minecraft": "The base game.", "modmenu.nameTranslation.java": "Java", "modmenu.descriptionTranslation.java": "The Java runtime environment.", "modmenu.javaDistributionName": "Running: %s", - + "modmenu.options": "Mod Menu Options", "option.modmenu.sorting": "Sort", "option.modmenu.sorting.ascending": "A-Z",