Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Tags
Creators
Details
AI Command
Control Minecraft with natural language. Type /ai give me a maxed-out diamond sword and the AI figures out the commands.
Features
/ai <text>— describe what you want, AI generates and executes Minecraft commands- Danger detection — destructive commands (ban, kill, fill, explosives) prompt for confirmation
- Multiple backends — local rule engine (free, offline) + 9 cloud providers
- ModMenu integration for graphical config
- Command corrector — auto-fixes legacy syntax from less capable models
Installation
- Install Fabric Loader 0.18.5+
- Install Fabric API
- Drop
ai-command-1.0.0.jarinto.minecraft/mods/ - (Recommended) Install ModMenu for a config GUI
Requires Minecraft 26.1 and Java 25+.
Usage
/ai give me 64 diamonds
/ai switch to creative mode
/ai give me a maxed-out netherite sword
/ai spawn a zombie named Bob
Safe commands run immediately. Dangerous ones ask you to click [Confirm].
All config via commands:
/ai-config # show current config
/ai-config provider deepseek # switch backend
/ai-config apikey sk-xxx # set API key
/ai-config model deepseek-chat # change model
/ai-config test # test connection
Or open ModMenu, click "AI Command", and use the GUI.
Configuration
AI Backends
| ID | Name | Type | Needs Key |
|---|---|---|---|
rule_engine |
Local Rule Engine | Offline | No |
deepseek |
DeepSeek (recommended) | Cloud | Yes |
claude |
Claude | Cloud | Yes |
openai |
OpenAI | Cloud | Yes |
qwen |
Qwen | Cloud | Yes |
glm |
GLM | Cloud | Yes |
moonshot |
Moonshot | Cloud | Yes |
ollama |
Ollama | Local | No |
custom |
Custom API | Self-hosted | Optional |
Dangerous Command Categories
| Category | Examples |
|---|---|
| Irreversible | /ban, /kill, /stop, /clear |
| Explosives | /summon tnt, /give end_crystal |
| Hostile spawns | /summon creeper, /summon wither |
| Destructive | /fill, /clone, /setblock |
| Major impact | /gamerule, /difficulty |
Customize with /ai-config danger add|remove.
Model Recommendations
DeepSeek Chat has been tested the most and handles MC 26.1's new syntax best.
The Flash variant is cheaper but occasionally outputs legacy syntax — the built-in CommandCorrector cleans this up, so the difference is minimal in practice. If Flash fails on a complex request, switch to deepseek-v4-pro for noticeably better instruction following.
Claude, GPT-4o, Qwen, and others haven't been thoroughly tested. Any OpenAI-compatible API should work in theory.
Commands are not guaranteed 100% correct. Minecraft's command system has too many edge cases. Please report bugs on the issue tracker and include a log snippet (/ai-config log true to enable).
Development
Built with Claude Code. The process involved:
Extracting command registries, NBT tag names, and entity attributes from MC 26.1 source, cross-referencing against zh.minecraft.wiki, and iterating on prompt engineering across many rounds. Legacy syntax, NBT case sensitivity, and attribute naming were recurring pain points. DeepSeek Flash refusing to follow fine-grained instructions was the hardest — solved with prompt refinement plus a post-processing corrector.
Project Structure
src/main/java/com/realikun/aicommand/
├── AICommandMod.java # Entry point
├── ai/
│ ├── AIProvider.java # Backend interface
│ ├── AIProviderRegistry.java # 9 providers
│ ├── AIRequestBuilder.java # System prompt
│ ├── RuleEngineProvider.java # Local rule engine
│ ├── LLMApiProvider.java # Cloud API calls
│ └── CommandCorrector.java # Syntax correction
├── command/
│ ├── AICommand.java # /ai
│ └── AIConfigCommand.java # /ai-config
├── config/
│ ├── AIConfig.java # Config management
│ └── ModMenuIntegration.java # ModMenu UI
├── safety/
│ └── CommandSafetyChecker.java # Danger detection
├── reference/
│ └── MinecraftCommands.java # MC 26.1 command reference
└── mixin/
└── ChatLengthMixin.java # Chat limit removal
License
CC0-1.0 — public domain.
Author
REALIKUN2024
Bugs? Suggestions? GitHub Issues
AI指令 (AI Command)
在聊天框里用自然语言控制 Minecraft。输入 /ai 给我一把满级钻石剑,AI 帮你生成指令并执行。
功能概览
/ai <文本>— 用自然语言描述需求,AI 自动生成 Minecraft 指令- 危险指令检测 — ban、kill、fill、爆炸物等弹确认框,点一下确认
- 多后端 — 本地规则引擎(离线免费)+ 9 个云端 AI,
/ai-config一键切 - ModMenu 图形化配置
- 指令修正器 — 自动修复部分模型输出的旧版 MC 语法
安装
- 装 Fabric Loader 0.18.5+
- 装 Fabric API
- 把
ai-command-1.0.0.jar丢进.minecraft/mods/ - 推荐装 ModMenu 拿图形化配置
需要 Minecraft 26.1,Java 25+。
使用方式
/ai 给我64个钻石
/ai 切换到创造模式
/ai 给我一把满级下界合金剑
/ai 生成一只叫小明的僵尸
AI 返回生成的指令。安全指令直接执行,危险指令需要点 [确认]。
配置全部通过命令完成:
/ai-config # 看当前配置
/ai-config provider deepseek # 切到 DeepSeek
/ai-config apikey sk-xxx # 设 API Key
/ai-config model deepseek-chat # 换模型
/ai-config test # 测试连接
装了 ModMenu 的话,模组列表里点 "AI指令" 进去有图形界面。
配置详解
AI 后端
| 后端 | 名称 | 类型 | 需要 Key |
|---|---|---|---|
rule_engine |
本地规则引擎 | 离线 | 否 |
deepseek |
DeepSeek(推荐) | 云端 | 是 |
claude |
Claude | 云端 | 是 |
openai |
OpenAI | 云端 | 是 |
qwen |
通义千问 | 云端 | 是 |
glm |
智谱 GLM | 云端 | 是 |
moonshot |
月之暗面 | 云端 | 是 |
ollama |
Ollama | 本地 | 否 |
custom |
自定义 API | 自建 | 可选 |
危险指令分类
五类指令弹确认窗:
| 分类 | 示例 |
|---|---|
| 不可逆 | /ban, /kill, /stop, /clear |
| 爆炸物 | /summon tnt, /give end_crystal |
| 危险召唤 | /summon creeper, /summon wither |
| 可能破坏 | /fill, /clone, /setblock |
| 重大影响 | /gamerule, /difficulty |
/ai-config danger add|remove 加自己的规则。
关于模型
这段时间测下来,DeepSeek Chat 在指令遵循和 MC 26.1 新版语法上最稳。
Flash 版便宜但偶尔蹦旧版语法——模组里自带 CommandCorrector 会自动修,所以日常用着差别不大。真遇到 Flash 翻车,换 deepseek-v4-pro,指令遵循度明显上一档。
Claude、GPT-4o、通义千问这些没正经测过。理论上 OpenAI 兼容的都能接。
AI 生成的指令不保证 100% 正确。Minecraft 指令系统太复杂了,偶尔输出格式不对、参数填错都正常。遇到 Bug 请提 Issue,顺便 /ai-config log true 开个日志,把那段贴过来。
开发
在 Claude Code 辅助下完成开发。大概过程:
从 MC 26.1 源码提取命令注册表、NBT 标签名、实体属性,再跟 zh.minecraft.wiki 逐条交叉验证。提示词来来回回改了很多轮——旧版语法残留、NBT 大小写、属性名称格问题都不是一次修好的。最头疼的是 DeepSeek Flash 不遵从细粒度指令,最后靠提示词 + 后处理器双管齐下才稳住。
项目结构
src/main/java/com/realikun/aicommand/
├── AICommandMod.java # 主入口
├── ai/
│ ├── AIProvider.java # 后端接口
│ ├── AIProviderRegistry.java # 9 个后端
│ ├── AIRequestBuilder.java # 系统提示词
│ ├── RuleEngineProvider.java # 本地规则引擎
│ ├── LLMApiProvider.java # 云端请求
│ └── CommandCorrector.java # 指令修正
├── command/
│ ├── AICommand.java # /ai
│ └── AIConfigCommand.java # /ai-config
├── config/
│ ├── AIConfig.java # 配置
│ └── ModMenuIntegration.java # ModMenu
├── safety/
│ └── CommandSafetyChecker.java # 安全检查
├── reference/
│ └── MinecraftCommands.java # MC 26.1 命令表
└── mixin/
└── ChatLengthMixin.java # 解除字数限制
许可证
CC0-1.0 — 公有领域。
作者
REALIKUN2024
有 Bug 或建议?GitHub Issues


