From 62d004e9c530804e80bb70105490ff312925c449 Mon Sep 17 00:00:00 2001 From: Prospector Date: Sat, 15 Jun 2024 10:56:41 -0400 Subject: [PATCH] Add support for QuickText in mod descriptions - Added support for QuickText in mod descriptions - Newlines in descriptions are no longer forced to be paragraphs, so single linebreaks are now allowed --- build.gradle | 8 ++ gradle.properties | 4 +- .../com/terraformersmc/modmenu/ModMenu.java | 11 +- .../modmenu/ModMenuModMenuCompat.java | 2 +- .../modmenu/TextPlaceholderApiCompat.java | 7 ++ .../gui/widget/DescriptionListWidget.java | 106 +++++++++++++----- .../terraformersmc/modmenu/util/HttpUtil.java | 4 +- .../modmenu/util/UpdateCheckerUtil.java | 2 +- .../terraformersmc/modmenu/util/mod/Mod.java | 78 ++++++------- .../modmenu/util/mod/ModSearch.java | 2 - src/main/resources/fabric.mod.json | 2 +- 11 files changed, 143 insertions(+), 83 deletions(-) create mode 100644 src/main/java/com/terraformersmc/modmenu/TextPlaceholderApiCompat.java diff --git a/build.gradle b/build.gradle index e2a6bd5b9..d8f058503 100644 --- a/build.gradle +++ b/build.gradle @@ -9,11 +9,15 @@ dependencies { mappings "net.fabricmc:yarn:$project.yarn_mappings:v2" mod "fabric-loader", "net.fabricmc:fabric-loader:$project.loader_version" + includeMod "fabric-api", fabricApi.module("fabric-api-base", project.fabric_version) includeMod "fabric-api", fabricApi.module("fabric-resource-loader-v0", project.fabric_version) includeMod "fabric-api", fabricApi.module("fabric-screen-api-v1", project.fabric_version) includeMod "fabric-api", fabricApi.module("fabric-key-binding-api-v1", project.fabric_version) includeMod "fabric-api", fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version) + + includeMod "text-placeholder-api", "eu.pb4:placeholder-api:${project.text_placeholder_api_version}" + compileOnly "org.quiltmc:quilt-loader:$project.quilt_loader_version" } @@ -26,4 +30,8 @@ repositories { name = 'Quilt' url = 'https://maven.quiltmc.org/repository/release' } + maven { + name = 'Nucleoid' + url = 'https://maven.nucleoid.xyz/' + } } diff --git a/gradle.properties b/gradle.properties index cde5b04f1..9225c07e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,7 @@ minecraft_version=1.20.4 yarn_mappings=1.20.4+build.2 loader_version=0.15.1 fabric_version=0.91.2+1.20.4 +text_placeholder_api_version=2.3.0+1.20.3 quilt_loader_version=0.17.7 # Project Metadata @@ -22,12 +23,13 @@ modrinth_slug=modmenu modrinth_id=mOgUt4GM modrinth_game_versions=1.20.4 modrinth_mod_loaders=fabric, quilt +modrinth_required_dependencies=P7dR8mSH,eXts2L7r # CurseForge Metadata curseforge_slug=modmenu curseforge_id=308702 curseforge_game_versions=1.20.4, Fabric, Quilt -curseforge_required_dependencies= +curseforge_required_dependencies=306612 curseforge_optional_dependencies= # Mod Loader Metadata diff --git a/src/main/java/com/terraformersmc/modmenu/ModMenu.java b/src/main/java/com/terraformersmc/modmenu/ModMenu.java index 3ff02381b..b126b7dce 100644 --- a/src/main/java/com/terraformersmc/modmenu/ModMenu.java +++ b/src/main/java/com/terraformersmc/modmenu/ModMenu.java @@ -45,8 +45,9 @@ public class ModMenu implements ClientModInitializer { private static final List apiImplementations = new ArrayList<>(); private static int cachedDisplayedModCount = -1; - public static boolean runningQuilt = FabricLoader.getInstance().isModLoaded("quilt_loader"); - public static boolean devEnvironment = FabricLoader.getInstance().isDevelopmentEnvironment(); + public static final boolean RUNNING_QUILT = FabricLoader.getInstance().isModLoaded("quilt_loader"); + public static final boolean DEV_ENVIRONMENT = FabricLoader.getInstance().isDevelopmentEnvironment(); + public static final boolean TEXT_PLACEHOLDER_COMPAT = FabricLoader.getInstance().isModLoaded("placeholder-api"); public static Screen getConfigScreen(String modid, Screen menuScreen) { for (ModMenuApi api : apiImplementations) { @@ -72,7 +73,10 @@ public void onInitializeClient() { Map updateCheckers = new HashMap<>(); Map providedUpdateCheckers = new HashMap<>(); + // Ignore deprecations, they're from Quilt Loader being in the dev env + //noinspection deprecation FabricLoader.getInstance().getEntrypointContainers("modmenu", ModMenuApi.class).forEach(entrypoint -> { + //noinspection deprecation ModMetadata metadata = entrypoint.getProvider().getMetadata(); String modId = metadata.getId(); try { @@ -88,10 +92,11 @@ public void onInitializeClient() { }); // Fill mods map + //noinspection deprecation for (ModContainer modContainer : FabricLoader.getInstance().getAllMods()) { Mod mod; - if (runningQuilt) { + if (RUNNING_QUILT) { mod = new QuiltMod(modContainer, modpackMods); } else { mod = new FabricMod(modContainer, modpackMods); diff --git a/src/main/java/com/terraformersmc/modmenu/ModMenuModMenuCompat.java b/src/main/java/com/terraformersmc/modmenu/ModMenuModMenuCompat.java index 34c4be77c..4ed4991e2 100644 --- a/src/main/java/com/terraformersmc/modmenu/ModMenuModMenuCompat.java +++ b/src/main/java/com/terraformersmc/modmenu/ModMenuModMenuCompat.java @@ -25,7 +25,7 @@ public Map> getProvidedConfigScreenFactories() { @Override public Map getProvidedUpdateCheckers() { - if (ModMenu.runningQuilt) { + if (ModMenu.RUNNING_QUILT) { return Map.of("quilt_loader", new QuiltLoaderUpdateChecker()); } else { return Map.of("fabricloader", new FabricLoaderUpdateChecker()); diff --git a/src/main/java/com/terraformersmc/modmenu/TextPlaceholderApiCompat.java b/src/main/java/com/terraformersmc/modmenu/TextPlaceholderApiCompat.java new file mode 100644 index 000000000..e8248db69 --- /dev/null +++ b/src/main/java/com/terraformersmc/modmenu/TextPlaceholderApiCompat.java @@ -0,0 +1,7 @@ +package com.terraformersmc.modmenu; + +import eu.pb4.placeholders.api.parsers.NodeParser; + +public class TextPlaceholderApiCompat { + public static final NodeParser PARSER = NodeParser.builder().quickText().build(); +} diff --git a/src/main/java/com/terraformersmc/modmenu/gui/widget/DescriptionListWidget.java b/src/main/java/com/terraformersmc/modmenu/gui/widget/DescriptionListWidget.java index f40531efe..4340256bc 100644 --- a/src/main/java/com/terraformersmc/modmenu/gui/widget/DescriptionListWidget.java +++ b/src/main/java/com/terraformersmc/modmenu/gui/widget/DescriptionListWidget.java @@ -28,28 +28,37 @@ import net.minecraft.util.Util; import net.minecraft.util.math.MathHelper; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class DescriptionListWidget extends EntryListWidget { private static final Text HAS_UPDATE_TEXT = Text.translatable("modmenu.hasUpdate"); private static final Text EXPERIMENTAL_TEXT = Text.translatable("modmenu.experimental").formatted(Formatting.GOLD); - private static final Text DOWNLOAD_TEXT = Text.translatable("modmenu.downloadLink").formatted(Formatting.BLUE).formatted(Formatting.UNDERLINE); + private static final Text MODRINTH_TEXT = Text.translatable("modmenu.modrinth"); + private static final Text DOWNLOAD_TEXT = Text.translatable("modmenu.downloadLink") + .formatted(Formatting.BLUE) + .formatted(Formatting.UNDERLINE); private static final Text CHILD_HAS_UPDATE_TEXT = Text.translatable("modmenu.childHasUpdate"); private static final Text LINKS_TEXT = Text.translatable("modmenu.links"); - private static final Text SOURCE_TEXT = Text.translatable("modmenu.source").formatted(Formatting.BLUE).formatted(Formatting.UNDERLINE); + private static final Text SOURCE_TEXT = Text.translatable("modmenu.source") + .formatted(Formatting.BLUE) + .formatted(Formatting.UNDERLINE); private static final Text LICENSE_TEXT = Text.translatable("modmenu.license"); - private static final Text VIEW_CREDITS_TEXT = Text.translatable("modmenu.viewCredits").formatted(Formatting.BLUE).formatted(Formatting.UNDERLINE); + private static final Text VIEW_CREDITS_TEXT = Text.translatable("modmenu.viewCredits") + .formatted(Formatting.BLUE) + .formatted(Formatting.UNDERLINE); private static final Text CREDITS_TEXT = Text.translatable("modmenu.credits"); private final ModsScreen parent; private final TextRenderer textRenderer; private ModListEntry lastSelected = null; - public DescriptionListWidget(MinecraftClient client, int width, int height, int y, int itemHeight, ModsScreen parent) { + public DescriptionListWidget(MinecraftClient client, + int width, + int height, + int y, + int itemHeight, + ModsScreen parent) { super(client, width, height, y, itemHeight); this.parent = parent; this.textRenderer = client.textRenderer; @@ -88,14 +97,15 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de int wrapWidth = getRowWidth() - 5; Mod mod = lastSelected.getMod(); - String description = mod.getTranslatedDescription(); - if (!description.isEmpty()) { - for (OrderedText line : textRenderer.wrapLines(Text.literal(description.replaceAll("\n", "\n\n")), wrapWidth)) { + Text description = mod.getFormattedDescription(); + if (!description.getString().isEmpty()) { + for (OrderedText line : textRenderer.wrapLines(description, wrapWidth)) { children().add(new DescriptionEntry(line)); } } - if (ModMenuConfig.UPDATE_CHECKER.getValue() && !ModMenuConfig.DISABLE_UPDATE_CHECKER.getValue().contains(mod.getId())) { + if (ModMenuConfig.UPDATE_CHECKER.getValue() && !ModMenuConfig.DISABLE_UPDATE_CHECKER.getValue() + .contains(mod.getId())) { UpdateInfo updateInfo = mod.getUpdateInfo(); if (updateInfo != null && updateInfo.isUpdateAvailable()) { children().add(emptyEntry); @@ -103,7 +113,9 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de int index = 0; for (OrderedText line : textRenderer.wrapLines(HAS_UPDATE_TEXT, wrapWidth - 11)) { DescriptionEntry entry = new DescriptionEntry(line); - if (index == 0) entry.setUpdateTextEntry(); + if (index == 0) { + entry.setUpdateTextEntry(); + } children().add(entry); index += 1; @@ -113,20 +125,34 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de children().add(new DescriptionEntry(line, 8)); } - Text updateMessage = updateInfo.getUpdateMessage(); - String downloadLink = updateInfo.getDownloadLink(); - if (updateMessage == null) { - updateMessage = DOWNLOAD_TEXT; - } else { - if (downloadLink != null) { - updateMessage = updateMessage.copy().formatted(Formatting.BLUE).formatted(Formatting.UNDERLINE); + if (updateInfo instanceof ModrinthUpdateInfo modrinthUpdateInfo) { + Text updateText = Text.translatable("modmenu.updateText", + VersionUtil.stripPrefix(modrinthUpdateInfo.getVersionNumber()), + MODRINTH_TEXT) + .formatted(Formatting.BLUE) + .formatted(Formatting.UNDERLINE); + + for (OrderedText line : textRenderer.wrapLines(updateText, wrapWidth - 16)) { + children().add(new LinkEntry(line, modrinthUpdateInfo.getDownloadLink(), 8)); } - } - for (OrderedText line : textRenderer.wrapLines(updateMessage, wrapWidth - 16)) { - if (downloadLink != null) { - children().add(new LinkEntry(line, downloadLink, 8)); + } else { + Text updateMessage = updateInfo.getUpdateMessage(); + String downloadLink = updateInfo.getDownloadLink(); + if (updateMessage == null) { + updateMessage = DOWNLOAD_TEXT; } else { - children().add(new DescriptionEntry(line, 8)); + if (downloadLink != null) { + updateMessage = updateMessage.copy() + .formatted(Formatting.BLUE) + .formatted(Formatting.UNDERLINE); + } + } + for (OrderedText line : textRenderer.wrapLines(updateMessage, wrapWidth - 16)) { + if (downloadLink != null) { + children().add(new LinkEntry(line, downloadLink, 8)); + } else { + children().add(new DescriptionEntry(line, 8)); + } } } } @@ -136,7 +162,9 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de int index = 0; for (OrderedText line : textRenderer.wrapLines(CHILD_HAS_UPDATE_TEXT, wrapWidth - 11)) { DescriptionEntry entry = new DescriptionEntry(line); - if (index == 0) entry.setUpdateTextEntry(); + if (index == 0) { + entry.setUpdateTextEntry(); + } children().add(entry); index += 1; @@ -163,7 +191,9 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de links.forEach((key, value) -> { int indent = 8; - for (OrderedText line : textRenderer.wrapLines(Text.translatable(key).formatted(Formatting.BLUE).formatted(Formatting.UNDERLINE), wrapWidth - 16)) { + for (OrderedText line : textRenderer.wrapLines(Text.translatable(key) + .formatted(Formatting.BLUE) + .formatted(Formatting.UNDERLINE), wrapWidth - 16)) { children().add(new LinkEntry(line, value, indent)); indent = 16; } @@ -212,7 +242,8 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de var role = iterator.next(); var roleName = role.getKey(); - for (var line : textRenderer.wrapLines(this.creditsRoleText(roleName), wrapWidth - 16)) { + for (var line : textRenderer.wrapLines(this.creditsRoleText(roleName), + wrapWidth - 16)) { children().add(new DescriptionEntry(line, indent)); indent = 16; } @@ -258,7 +289,10 @@ public void renderList(DrawContext DrawContext, int mouseX, int mouseY, float de RenderSystem.depthFunc(515); RenderSystem.disableDepthTest(); RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE); + RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, + GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, + GlStateManager.SrcFactor.ZERO, + GlStateManager.DstFactor.ONE); RenderSystem.setShader(GameRenderer::getPositionColorProgram); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); @@ -348,7 +382,8 @@ private Text creditsRoleText(String roleName) { // Fixes common role names people use in English (e.g. Author -> Authors) var fallback = roleName.endsWith("r") ? roleName + "s" : roleName; - return Text.translatableWithFallback("modmenu.credits.role." + translationKey, fallback).append(Text.literal(":")); + return Text.translatableWithFallback("modmenu.credits.role." + translationKey, fallback) + .append(Text.literal(":")); } protected class DescriptionEntry extends ElementListWidget.Entry { @@ -371,7 +406,16 @@ public DescriptionEntry setUpdateTextEntry() { } @Override - public void render(DrawContext DrawContext, int index, int y, int x, int itemWidth, int itemHeight, int mouseX, int mouseY, boolean isSelected, float delta) { + public void render(DrawContext DrawContext, + int index, + int y, + int x, + int itemWidth, + int itemHeight, + int mouseX, + int mouseY, + boolean isSelected, + float delta) { if (updateTextEntry) { UpdateAvailableBadge.renderBadge(DrawContext, x + indent, y); x += 11; diff --git a/src/main/java/com/terraformersmc/modmenu/util/HttpUtil.java b/src/main/java/com/terraformersmc/modmenu/util/HttpUtil.java index bf91b6008..82ccd94c3 100644 --- a/src/main/java/com/terraformersmc/modmenu/util/HttpUtil.java +++ b/src/main/java/com/terraformersmc/modmenu/util/HttpUtil.java @@ -22,8 +22,8 @@ public static HttpResponse request(HttpRequest.Builder builder, HttpRespo } private static String buildUserAgent() { - String env = ModMenu.devEnvironment ? "/development" : ""; - String loader = ModMenu.runningQuilt ? "quilt" : "fabric"; + String env = ModMenu.DEV_ENVIRONMENT ? "/development" : ""; + String loader = ModMenu.RUNNING_QUILT ? "quilt" : "fabric"; var modMenuVersion = getModMenuVersion(); var minecraftVersion = SharedConstants.getGameVersion().getName(); diff --git a/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java b/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java index 15cd08c61..68e01970d 100644 --- a/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java +++ b/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java @@ -220,7 +220,7 @@ private static UpdateChannel getUpdateChannel(String versionType) { private static @Nullable Map getUpdatedVersions(Collection modHashes) { String mcVer = SharedConstants.getGameVersion().getName(); - List loaders = ModMenu.runningQuilt ? List.of("fabric", "quilt") : List.of("fabric"); + List loaders = ModMenu.RUNNING_QUILT ? List.of("fabric", "quilt") : List.of("fabric"); List updateChannels; UpdateChannel preferredChannel = UpdateChannel.getUserPreference(); diff --git a/src/main/java/com/terraformersmc/modmenu/util/mod/Mod.java b/src/main/java/com/terraformersmc/modmenu/util/mod/Mod.java index 3bf6f58a5..d05237f6e 100644 --- a/src/main/java/com/terraformersmc/modmenu/util/mod/Mod.java +++ b/src/main/java/com/terraformersmc/modmenu/util/mod/Mod.java @@ -1,11 +1,13 @@ package com.terraformersmc.modmenu.util.mod; +import com.terraformersmc.modmenu.TextPlaceholderApiCompat; import com.google.common.base.Predicates; import com.terraformersmc.modmenu.ModMenu; import com.terraformersmc.modmenu.api.UpdateChecker; import com.terraformersmc.modmenu.api.UpdateInfo; import com.terraformersmc.modmenu.config.ModMenuConfig; import com.terraformersmc.modmenu.util.mod.fabric.FabricIconHandler; +import eu.pb4.placeholders.api.ParserContext; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.texture.NativeImageBackedTexture; import net.minecraft.text.Text; @@ -17,103 +19,96 @@ import java.util.stream.Collectors; public interface Mod { - @NotNull - String getId(); + @NotNull String getId(); - @NotNull - String getName(); + @NotNull String getName(); @NotNull default String getTranslatedName() { String translationKey = "modmenu.nameTranslation." + getId(); - if ((getId().equals("minecraft") || getId().equals("java") || ModMenuConfig.TRANSLATE_NAMES.getValue()) && I18n.hasTranslation(translationKey)) { + if ((getId().equals("minecraft") || getId().equals("java") || ModMenuConfig.TRANSLATE_NAMES.getValue()) && I18n.hasTranslation( + translationKey)) { return I18n.translate(translationKey); } return getName(); } - @NotNull - NativeImageBackedTexture getIcon(FabricIconHandler iconHandler, int i); + @NotNull NativeImageBackedTexture getIcon(FabricIconHandler iconHandler, int i); @NotNull default String getSummary() { - return getTranslatedSummary(); + String string = getTranslatedSummary(); + return ModMenu.TEXT_PLACEHOLDER_COMPAT ? TextPlaceholderApiCompat.PARSER.parseText(string, ParserContext.of()) + .getString() : string; } @NotNull default String getTranslatedSummary() { String translationKey = "modmenu.summaryTranslation." + getId(); - if ((getId().equals("minecraft") || getId().equals("java") || ModMenuConfig.TRANSLATE_DESCRIPTIONS.getValue()) && I18n.hasTranslation(translationKey)) { + if ((getId().equals("minecraft") || getId().equals("java") || ModMenuConfig.TRANSLATE_DESCRIPTIONS.getValue()) && I18n.hasTranslation( + translationKey)) { return I18n.translate(translationKey); } return getTranslatedDescription(); } - @NotNull - String getDescription(); + @NotNull String getDescription(); @NotNull default String getTranslatedDescription() { String translatableDescriptionKey = "modmenu.descriptionTranslation." + getId(); - if ((getId().equals("minecraft") || getId().equals("java") || ModMenuConfig.TRANSLATE_DESCRIPTIONS.getValue()) && I18n.hasTranslation(translatableDescriptionKey)) { + if ((getId().equals("minecraft") || getId().equals("java") || ModMenuConfig.TRANSLATE_DESCRIPTIONS.getValue()) && I18n.hasTranslation( + translatableDescriptionKey)) { return I18n.translate(translatableDescriptionKey); } return getDescription(); } - @NotNull - String getVersion(); + default Text getFormattedDescription() { + String string = getTranslatedDescription(); + return ModMenu.TEXT_PLACEHOLDER_COMPAT ? TextPlaceholderApiCompat.PARSER.parseText(string, + ParserContext.of()) : Text.literal(string); + } - @NotNull - String getPrefixedVersion(); + @NotNull String getVersion(); - @NotNull - List getAuthors(); + @NotNull String getPrefixedVersion(); + + @NotNull List getAuthors(); /** * @return a mapping of contributors to their roles. */ - @NotNull - Map> getContributors(); + @NotNull Map> getContributors(); /** * @return a mapping of roles to each contributor with that role. */ - @NotNull - SortedMap> getCredits(); + @NotNull SortedMap> getCredits(); - @NotNull - Set getBadges(); + @NotNull Set getBadges(); - @Nullable - String getWebsite(); + @Nullable String getWebsite(); - @Nullable - String getIssueTracker(); + @Nullable String getIssueTracker(); - @Nullable - String getSource(); + @Nullable String getSource(); - @Nullable - String getParent(); + @Nullable String getParent(); - @NotNull - Set getLicense(); + @NotNull Set getLicense(); - @NotNull - Map getLinks(); + @NotNull Map getLinks(); boolean isReal(); boolean allowsUpdateChecks(); - @Nullable - UpdateChecker getUpdateChecker(); + @Nullable UpdateChecker getUpdateChecker(); void setUpdateChecker(@Nullable UpdateChecker updateChecker); - @Nullable - UpdateInfo getUpdateInfo(); + @Nullable UpdateInfo getUpdateInfo(); void setUpdateInfo(@Nullable UpdateInfo updateInfo); @@ -123,7 +118,8 @@ default boolean hasUpdate() { return false; } - return updateInfo.isUpdateAvailable() && updateInfo.getUpdateChannel().compareTo(ModMenuConfig.UPDATE_CHANNEL.getValue()) >= 0; + return updateInfo.isUpdateAvailable() && updateInfo.getUpdateChannel() + .compareTo(ModMenuConfig.UPDATE_CHANNEL.getValue()) >= 0; } default @Nullable String getSha512Hash() throws IOException { diff --git a/src/main/java/com/terraformersmc/modmenu/util/mod/ModSearch.java b/src/main/java/com/terraformersmc/modmenu/util/mod/ModSearch.java index 95fb0c4b7..8c5b530e4 100644 --- a/src/main/java/com/terraformersmc/modmenu/util/mod/ModSearch.java +++ b/src/main/java/com/terraformersmc/modmenu/util/mod/ModSearch.java @@ -33,7 +33,6 @@ private static int passesFilters(ModsScreen screen, Mod mod, String query) { String modName = mod.getName(); String modTranslatedName = mod.getTranslatedName(); String modDescription = mod.getDescription(); - String modTranslatedDescription = mod.getTranslatedDescription(); String modSummary = mod.getSummary(); String library = I18n.translate("modmenu.searchTerms.library"); @@ -58,7 +57,6 @@ private static int passesFilters(ModsScreen screen, Mod mod, String query) { } if (modDescription.toLowerCase(Locale.ROOT).contains(query) // Search default mod description - || modTranslatedDescription.toLowerCase(Locale.ROOT).contains(query) // Search localized mod description || modSummary.toLowerCase(Locale.ROOT).contains(query) // Search mod summary || authorMatches(mod, query) // Search via author || library.contains(query) && mod.getBadges().contains(Mod.Badge.LIBRARY) // Search for lib mods diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7cc3bb6ab..4dad36ed6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -25,7 +25,7 @@ "fabric-key-binding-api-v1": "*", "fabric-lifecycle-events-v1": "*", "fabricloader": ">=0.12.23", - "minecraft": "1.20.4" + "minecraft": ">=1.20.3" }, "authors": [ "Prospector",