Repository navigation
mcAI 1.22
A cleanup + quality-of-life release on top of 1.21: three new features, plus the internal
fixes found while reviewing the codebase.
New
- Configurable trigger prefix —
!aiis no longer hardcoded./ai prefix <value>
(e.g./ai prefix @ai) changes what starts an AI chat;/ai statusshows the current
value. - AI translation —
/ai tl <text>translates to the default target language,
/ai tl <lang> <text>to a specific one (/ai translateis an alias), and
/ai tlang <lang>sets the default target language. - Persona management —
/ai personashows the current persona,/ai persona list
lists all presets (default / builder / redstone / survival / english).
Fixed
- Anthropic model ids in the model catalog were empty strings; real ids are now filled in,
and blank ids are rejected outright. TokenStatswrites through the same copy-on-writeConfigManager.updateas everything
else; the daily rollover read path no longer mutates config.ApiKeyManagerreturns aPickedKeyhandle so exactly the key used in a request gets
blacklisted on failure; the dead-key set is now thread-safe.- The 8-second cooldown is only consumed after every validation passes (config ready, key
present, budget OK) — no more "cooldown eaten by a request that never ran". ConfigManagerwaits for the initial disk load before applying edits, removing a startup
race that could overwritemcai.json.- Removed the never-enabled
ExampleMixinand its mixins config. - Dead code cleaned from
VisionHandler/ChatHandler. RecipeHelpercraftability now uses bipartite maximum matching instead of greedy
consumption, so substitutable materials (e.g. planks) are handled correctly.ItemSwitchHandleronly sends the c2s payload when the channel is actually open.- README usage-CSV sample rows updated to the real 5-column format.
ChatHandlermoved into the client package (the only client-only class that lived in the
common package).
Packaging note: only
mcai-1.22.jargoes inmods. Do not put the-sources.jar
there — it carries afabric.mod.jsonwith the same mod id and an unexpanded
${version}, so Fabric sees two mods namedmcai.
- Minecraft 1.21.1, Fabric Loader >= 0.19.5, Java 21
- Your
mcai.jsonis fully compatible — nothing to reconfigure.
mcAI 1.22(中文)
在 1.21 基础上的一次「内部清理 + 三个新功能」更新。
新增
- 可配置触发前缀:
!ai不再写死,/ai prefix <值>(如/ai prefix @ai)即可修改,
/ai status会显示当前值。 - AI 翻译:
/ai tl <文本>翻成默认目标语言,/ai tl <语言> <文本>指定语言
(/ai translate是别名),/ai tlang <语言>设置默认目标语言。 - 人格管理:
/ai persona查看当前人格,/ai persona list列出全部预设
(default / builder / redstone / survival / english)。
修复
- 模型目录里 Anthropic 的 5 个模型 id 原本是空字符串,已补成真实 id,并加入空值校验。
TokenStats统一走ConfigManager.update的写时复制;跨天清理由“读时清零”改为只读判断。ApiKeyManager返回PickedKey句柄,失败时精确拉黑本次请求用掉的那把 key;
失效 key 集合改为线程安全。- 8 秒冷却移到所有校验通过之后才消耗,不再出现“配置没填好还先扣冷却”的问题。
ConfigManager会先等磁盘配置加载完成再应用修改,消除启动竞态覆盖mcai.json的隐患。- 移除从未启用的
ExampleMixin及 mixins 配置。 - 清理
VisionHandler/ChatHandler中的死代码。 RecipeHelper可合成判定改用二分图最大匹配,正确处理可替代材料(如木板)。ItemSwitchHandler只在对应网络通道可用时才发包。- README 中用量 CSV 示例改成真实的 5 列格式。
ChatHandler移入 client 包(common 包里唯一的客端专属类)。
打包提醒: 只有
mcai-1.22.jar放进mods。不要把-sources.jar放进去——
它带着同一个 mod id 且版本号是未替换的${version},Fabric 会看到两个叫mcai的 mod。
- Minecraft 1.21.1,Fabric Loader >= 0.19.5,Java 21
mcai.json完全兼容,不需要重新配置。