SearchRinth
在 Minecraft 中直接搜索并安装模组,无需切换窗口,也无需手动复制到 mods 文件夹。
Minecraft 1.20.1 · Forge · 仅限客户端
logo
功能说明
按下快捷键即可打开搜索界面。输入名称,选择模组,点击“Download”:文件会带着进度条下载,并通过 SHA-1 校验,最终存入你的 mods 文件夹。随后,该模组会提示你重启游戏。
搜索结果始终按 1.20.1 + Forge 进行过滤,因此你无法下载不兼容的模组。
安装
从 Releases 页面下载 searchrinth-<version>.jar
将其放置在与其它模组相同的 mods 文件夹中。
启动游戏
无依赖项——仅需 Forge。
管理
默认快捷键为 M。可在 Settings → Controls → SearchRinth 中重新绑定。
从源码构建
./gradlew build
生成的模组文件位于 build/libs/searchrinth-<version>.jar。带有 -slim 后缀的文件是中间产物,无需添加到游戏中。
工作原理
以下是一些最初看似简单但实际不得不做出的决策:
mods 文件夹不可见。路径取自 FMLPaths.MODSDIR —— 便携版及 Prism/MultiMC 实例均没有 %APPDATA%.minecraft。
下载先写入 .part 文件,仅在通过 Modrinth API 的 SHA-1 校验后,才会原子性地移动到目标位置。游戏永远不会看到未完整下载的 jar 包。文件名来自 API,因此已做清理——否则类似 ../../evil.jar 这样的文件名会被写到文件夹之外。
Modrinth 图标大多为 WebP 格式(在测试样本的 158 个中有 122 个),无损版本为 VP8L。Minecraft 内部的 NativeImage (stb_image) 以及 JDK 的 ImageIO 均无法读取它,且 CDN 也无法将其转换为 PNG。因此,WebP 由 TwelveMonkeys 库解码,该库打包在模组内,并对内部包进行了重命名以避免与其他模组冲突。PNG 和 GIF 则走正常处理流程。
重启游戏会通过 WMI 恢复启动命令;如果失败,则从 RuntimeMXBean.getInputArguments() 和 sun.java.command 重建。在 Windows 上,ProcessHandle.current().info().commandLine() 返回空的 Optional,因此不能依赖它。包装脚本会等待旧进程结束,然后再启动新进程。
所有网络与文件 I/O 均在独立的线程池中运行;渲染线程仅读取原子性的进度计数器。
隐私
该模组仅访问 api.modrinth.com 和 cdn.modrinth.com。无遥测数据。
重启时,启动参数(包括会话令牌)会临时存放在系统临时文件夹的一个文件中——否则新实例将失去授权。该文件在游戏启动后立即被删除。
许可证
MIT
Logo 包含 Modrinth 的标志,其为 Modrinth 的商标。本项目为非官方项目,与 Modrinth 无关。
SearchRinth
Search and install mods with Modrinth directly from Minecraft - without alt-tab, without manually copying to the mods folder.
Minecraft 1.20.1 · Forge · client only
logo
What does
Press the key and the search screen opens. Enter the name, select the mod, click “Download”: the file downloads with a progress bar, is checked by SHA-1 and ends up in your mods folder. After this, the mod suggests restarting the game.
The results are always filtered by 1.20.1 + Forge, so you won’t be able to download an incompatible mod.
Installation
Download searchrinth-<version>.jar from Releases
Place it in your mods folder next to your other mods.
Launch the game
There are no dependencies - only Forge.
Management
The default key is M. Reassigned to Settings → Controls → SearchRinth.
Build from source
./gradlew build
The finished mod is build/libs/searchrinth-<version>.jar. The file with the -slim suffix is intermediate and does not need to be added to the game.
How it works
A few decisions that had to be made that were not as they seemed at first glance:
The mods folder is not visible. The path is taken from FMLPaths.MODSDIR - portable builds and Prism/MultiMC instances do not have any %APPDATA%.minecraft.
The download goes to a .part file, and only after checking SHA-1 from the Modrinth API, the file is atomically moved to its place. The game never sees an under-downloaded jar. The file name comes from the API, so it is sanitized - otherwise a filename like ../../evil.jar would be written outside the folder.
Modrinth icons are mostly WebP (122 out of 158 in the tested sample), and in the lossless version VP8L. Neither NativeImage (stb_image) inside Minecraft nor ImageIO from the JDK read it, and the CDN cannot convert it to PNG. Therefore, WebP is decoded by the TwelveMonkeys library, packaged inside the mod with packages repackaged so as not to conflict with other mods. PNG and GIF follow the normal path.
Restarting the game restores the launch command via WMI, and if it doesn’t work, it rebuilds it from RuntimeMXBean.getInputArguments() and sun.java.command. ProcessHandle.current().info().commandLine() on Windows returns an empty Optional, so you can't rely on it. The wrapper script waits for the old process to complete and only then starts a new one.
All network and file I/O live in a separate thread pool; The render thread only reads atomic progress counters.
Privacy
The mod only accesses api.modrinth.com and cdn.modrinth.com. No telemetry.
When restarted, the startup arguments (including the session token) are temporarily placed in a file in the system temp folder - otherwise the new instance will lose authorization. The file is deleted immediately after the game starts.
License
MIT
The logo contains the Modrinth logo, a trademark of Modrinth. The project is unofficial and not associated with Modrinth.
评论 0
登录后参与评分
还没有评论,来抢沙发吧