Repository navigation
Conversation
删掉整文件覆盖写的那半套(FileUtils.writeLines 先截断再写),改用已有的 readResourcePacks + updateResourcePacks(temp + ATOMIC_MOVE)。已选中同一资源包时不再触碰文件;重复的 resourcePacks 行也统一按最后一行生效重写。
ModLauncherService 读 LAUNCHTARGET,含 server 即返回。Forge/NeoForge 专用服务器常把客户端 mods 整个复制过去,原来每次开服都会联网下载并重建资源包,Forge 分支还会在服务端根目录写 options.txt。
launchwrapper 在没传 --gameDir 时给 null(服务端启动就是这样),原来直接 gameDir.toPath() 会 NPE 让整个启动失败;FML 自己也用 new File(".") 兜这种情况。side 判定用 FMLLaunchHandler.side(),1.6~1.7.10 在 cpw.mods.fml、1.8~1.12.2 在 net.minecraftforge.fml,判不出来保持原行为。
首次启动生成带说明的模板,读取失败一律回落默认值,且绝不覆盖已有文件。cacheTtlHours 是更新检查间隔(小时),0 表示每次启动都校验,默认 24,即原先硬编码的 UPDATE_TIME_GAP;excludeMods 是不参与汉化的模组命名空间,并入 Manifest 的 blackList,跳过下载并删除已缓存汉化。两者都只对 v2 新流程生效。顺带把 GameConfig 的多行注释压成一行。
镜像站不可用时回退到 CFPAOrg 仓库的 autobuild release:构建配置新增 githubBaseUrl 一并打进 i18n-build.properties,ResourcePackHttp 新增 openLegacy,先走原有 open(),只在抛 IOException 时兜底,全失败时抛 GitHub 的异常并把镜像异常挂成 suppressed。v2 的按模组下载不受影响。
i18nMetaData.json 的 assets[].loader 只有 Forge/Fabric 两个取值,NeoForge 与 Quilt 之前分别上报 Forge 与 Fabric,用真实名筛选时拿不到资源。入口改为上报 NeoForge/Quilt(NeoForgeBootstrap 与 ModLauncherService 复用已有的 FMLLoader 探测,Fabric 侧探测 QuiltLoader),LegacyConfig 再做一次别名回退,未知加载器保持取第一条。
配置新增 onlyWhenChineseSystem(默认 false,保持原行为)。为 true 时按 JVM/系统区域设置判定,非中文系统在 I18nUserConfig.load() 之后直接返回:不联网、不下载、不写 options.txt,同时 RuntimePackActivation.disable() 关掉运行时钩子,避免类变换器仍去改资源包选择。整合包作者可设为 true 后随包分发。判定读的是操作系统区域设置,不是游戏内语言。
新增「配置」段,说明 config/i18nupdatemod.json 的三个键(cacheTtlHours、excludeMods、onlyWhenChineseSystem);支持范围按 i18nMetaData.json 修正为 26.1~26.3。顺手把版本号里的 ASCII ~ 换成全角 ~:GitHub 把单个 ~ 当删除线,原来那行是带删除线显示的。
There was a problem hiding this comment.
🟡 Changes recommended
Legacy fallback does not consistently honor settings or try every mirror, and language-gated launches still write logs.
4 open findings
What changed in this PR
Adds user controls for translation updates and improves loader detection, server handling, and legacy download fallback.
Changes:
- Adds cache interval, mod exclusion, and system-language settings.
- Adds GitHub fallback and corrects loader identification.
- Uses atomic options updates and documents configuration.
| File | Description |
|---|---|
| src/main/java/i18nupdatemod/neoforgeloader/NeoForgeBootstrap.java | Reports NeoForge correctly. |
| src/main/java/i18nupdatemod/modlauncher/ModLauncherService.java | Detects NeoForge and skips dedicated servers. |
| src/main/java/i18nupdatemod/launchwrapper/LaunchWrapperTweaker.java | Handles servers and missing game directories. |
| src/main/java/i18nupdatemod/I18nUpdateMod.java | Loads settings and applies language gating. |
| src/main/java/i18nupdatemod/fabricloader/FabricLoaderMod.java | Identifies Quilt. |
| src/main/java/i18nupdatemod/core/v2/ResourcePackV2.java | Applies configured exclusions. |
| src/main/java/i18nupdatemod/core/v2/ResourcePackDownloader.java | Uses the configured cache interval. |
| src/main/java/i18nupdatemod/core/v1/ResourcePack.java | Uses legacy download routing. |
| src/main/java/i18nupdatemod/core/v1/LegacyConfig.java | Maps loader names to compatible assets. |
| src/main/java/i18nupdatemod/core/RuntimePackActivation.java | Allows disabling runtime activation. |
| src/main/java/i18nupdatemod/core/net/ResourcePackHttp.java | Adds GitHub fallback support. |
| src/main/java/i18nupdatemod/core/I18nUserConfig.java | Defines configuration loading and defaults. |
| src/main/java/i18nupdatemod/core/GameConfig.java | Routes pack selection through atomic updates. |
| README.md | Documents settings and supported versions. |
| build.gradle.kts | Bundles the GitHub fallback URL. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- 新增 I18nUpdateMod.prepare():先读配置与语言门禁,通过后才打开日志文件 - Fabric/Quilt、launchwrapper、ModLauncher、NeoForge 引导四个入口改调 prepare() - 配置逐字段解析:某个字段类型写错只回它自己的默认值,不再连带把门禁打回默认 - 配置相关日志攒到日志文件打开后输出,DEBUG 摘要不再丢
- Gson 对空值返回 null,不再抛异常,直接追加汉化包并保留其它选项行
- 三个来源各自独立尝试,失败原因 addSuppressed 到最终异常
- selectNamespaces 接收排除项,仅用于跳过;缓存清理只认 Manifest 的 blackList - V1 用 isExcluded 过滤 modDomains,README 与配置模板同步措辞
- 由固定 1 天改为 I18nUserConfig.cacheTtlHours(),0 表示每次启动都校验
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

变更内容
新增
config/i18nupdatemod.json:首次启动生成带说明的模板。cacheTtlHours:更新检查间隔(小时),默认 24,0表示每次启动都校验。excludeMods:不参与汉化的模组命名空间(例如jei、create),跳过下载,已缓存的汉化也会删除。onlyWhenChineseSystem:为true时只在系统语言为中文时启动;非中文系统下模组完全不动作(不联网、不下载、不写任何文件),便于整合包作者随包分发。autobuildrelease。修复
options.txt改为原子写:内容未变化时不再重写。gameDir缺失:回退到当前目录,不再空指针。其他
8 个 commit,15 个文件(+267 −54)。