我关闭了这个模组。因为我讨厌我所做的一切。感谢大家下载和支持其他方面。它仅支持 1.21.4...

Gemini in Minecraft
由 Roflboy 带来,带着对 Minecraft 社区的爱。<3
这个 Fabric 模组将 Google 的 Gemini AI 整合进 Minecraft,让你能够在游戏内直接与 AI 助手互动。AI 可以回答问题、提供关于你当前环境的信息,甚至执行游戏内命令(如果已启用)。
功能
- 游戏内 AI 聊天: 向 Gemini 提问并直接在聊天窗口中接收回复。
- 上下文感知响应: AI 能够获取有关你当前游戏状态的信息,包括:
- 玩家坐标 (x, y, z)
- 当前维度
- 一天中的时间和天气
- 游戏难度和模式
- 玩家生命值、食物和经验等级
- 物品栏和装备的物品
- Ping 值和在线玩家
- 命令执行(可选): 如果启用,Gemini 可以根据你的请求执行 Minecraft 命令。命令将以
minecraft 代码块的形式包含在 AI 的回复中。
- 对话历史(可选): 模组可以记住过去的对话,从而实现更自然且具备上下文感知的交互。对话历史的大小可配置。
- 可配置的 System Prompt: 通过修改 system prompt 来自定义 AI 的行为和性格。提供了默认的 prompt,侧重于乐于助人和提供 Minecraft 专属信息。
- 可自定义模型: 选择使用的 Gemini 模型(默认:
gemini-1.5-flash)。
- 可配置的 maxOutputTokens: 设置 AI 返回的最大响应大小(默认:200)
- 有用的命令: 使用
/aihelp 访问可用命令列表。
- MOTD: 模组拥有每日消息,每次玩家登录时随机选择一条。
- 可点击的回复: AI 回复是可点击的,方便你轻松跟进之前的消息或提出新的查询。
- 声音反馈: 所有操作都有声音提示。
System Prompt 中的动态变量
systemMessage 支持几个动态变量,当向 AI 发起查询时,这些变量会被实时游戏信息替换。这允许 AI 提供具有上下文感知的回复。以下是可用变量的列表:
{username}: 你的 Minecraft 玩家名称。
{x}: 你当前的 X 坐标(格式化为两位小数)。
{y}: 你当前的 Y 坐标(格式化为两位小数)。
{z}: 你当前的 Z 坐标(格式化为两位小数)。
{time}: 当前世界时间(以刻为单位)。
{timeOfDay}: 根据世界时间指示是“白天”还是“夜晚”。
{health}: 你当前的生命值(格式化为一位小数,满值为 20)。
{food}: 你当前的饥饿值(满值为 20)。
{xp}: 你当前的经验等级。
{dimension}: 你当前所在的维度名称(例如 "minecraft:overworld")。
{difficulty}: 当前游戏难度(例如 "peaceful", "easy", "normal", "hard")。
{weather}: 当前天气状况("clear" 或 "raining")。
{gameMode}: 你当前的游戏模式(例如 "survival", "creative", "adventure", "spectator")。
{mainHand}: 你主手中持有的物品,包括数量(例如 "1x Diamond Sword" 或 "nothing")。
{offHand}: 你副手中持有的物品,包括数量(例如 "1x Shield" 或 "nothing")。
{inventory}: 你物品栏中物品的逗号分隔列表(不包括盔甲),包括数量(例如 "64x Cobblestone, 16x Iron Ingot" 或 "empty")。
{armor}: 你装备的盔甲的逗号分隔列表,包括耐久度(例如 "Diamond Helmet (150/363), Iron Chestplate (200/240)" 或 "no armor")。
{ping}: 你当前到服务器的 Ping 值(以毫秒为单位)。
{playerCount}: 当前在线玩家的总数。
{playerList}: 所有在线玩家名称的逗号分隔列表(例如 "Player1, Player2, Player3" 或 "no other players")。
这些变量会在你每次向 AI 发送查询时自动更新,确保回复与你当前的情况相关。你可以在自定义的 systemMessage 中使用这些变量来定制 AI 的行为。
命令
/ai <query>: 向 AI 发送问题。
/aihelp: 显示可用命令及其描述的列表。
/aihistory: 显示你与 AI 的对话历史(如果启用了记忆功能)。
/clearmemory: 清除对话历史。
/setupai apikey <apiKey>: 设置你的 Google Gemini API 密钥。这是模组正常运行所必需的。
/setupai model <modelName>: 设置要使用的 Gemini 模型(例如 gemini-1.5-flash)。
/setupai system <systemMessage>: 为 AI 设置自定义系统消息。
/setupai defaultsystem: 将系统消息重置为默认值。
/setupai memory <enabled> <size>: 启用或禁用对话记忆并设置其大小。
enabled: true 或 false。
size: 要存储的消息数量(用户和 AI 的消息,最大 50)。
/setupai maxoutput <tokens>: 设置最大输出令牌数。
tokens: 50 到 8046 之间的任意数字
/setupai commands <enabled>: 启用或禁用 AI 命令执行。
/reloadconfig: 重新加载配置,就像你刚刚在 Minecraft 环境之外更改它一样。
安装
- 安装 Fabric: 确保你已为你的 Minecraft 版本安装了 Fabric Loader。
- 下载模组: 下载
GeminiInMinecraft 模组(jar 文件)。
- 放入 mods 文件夹: 将下载的 jar 文件放入你的 Minecraft
mods 文件夹中。
- 获取 API 密钥: 你需要一个 Google Gemini API 密钥。你可以从 Google AI Studio 网站 获取。
- 配置模组: 启动游戏后,使用
/setupai apikey <your_api_key> 命令来设置你的 API 密钥。
配置
该模组使用位于你的 Minecraft config 目录中的配置文件(geminiinminecraft.json)。首次运行模组时会自动创建此文件。你可以直接编辑此文件,或使用游戏内的 /setupai 命令来修改设置。
配置选项:
model:Gemini 模型名称(默认:gemini-1.5-flash)。
apiKey:你的 Google Gemini API 密钥。
systemMessage:引导 AI 行为的系统提示词。
memoryEnabled:是否启用对话记忆(true 或 false)。
memorySize:对话历史记录的大小(如果启用了记忆功能)。
maxOutputTokens:AI 响应中令牌的最大数量。
commandExecutionEnabled:是否启用 AI 命令执行(true 或 false)。
重要说明
- API 密钥安全: 你的 API 密钥以明文形式存储在配置文件中。请注意谁可以访问你的 Minecraft 目录。
- 命令执行风险: 启用命令执行功能将使 AI 能够运行你世界中的命令。请谨慎使用此功能,因为 AI 可能会执行意外或不期望的命令。建议在主世界使用之前,先在安全的环境(例如测试世界)中测试命令执行功能。
- AI 局限性: Gemini 是一个强大的 AI,但并非完美无缺。它有时可能会提供错误或无意义的回复。请务必仔细核实 AI 提供的信息,尤其是在涉及游戏机制或外部资源时。
- 格式处理: 模组的系统提示词指示 Gemini 使用 Markdown 格式。模组会将这些 Markdown 转换为 Minecraft 的文本格式化代码。如果你修改了系统提示词,请注意格式处理方式。
- 错误处理: 模组包含基本的错误处理机制,但仍可能出现意外错误。如果遇到任何问题,请检查游戏日志以获取更详细的信息。
致谢与感谢
衷心感谢 Minecraft 和 Fabric 社区持续的支持与启发。如果没有这些出色的工具和资源,这个模组将无法实现。
特别感谢 Google 提供的 Gemini AI 模型,它们构成了本模组核心功能的基础;以及 Zaggott 为本模组设计的标志。
当然,也要感谢**你**使用我的模组!我希望你觉得它既有用又有趣。
贡献代码
如果你想为这个模组的开发做出贡献,欢迎在 GitHub 仓库 提交问题或拉取请求。所有形式的贡献都受到欢迎,无论是修复漏洞、提出功能建议还是改进代码。请确保你的拉取请求具有相关性。
支持项目(可选)
如果你喜欢使用这个模组并希望支持其开发,可以请我喝杯咖啡!
任何支持都将不胜感激,并帮助我继续改进和维护该模组。
最终致谢
再次感谢你试用我的模组!我很期待看到你是如何使用它的,并倾听你的反馈。
I close this mod. Cuz i hate everything what i do. Thx y'all for your downloadings and other things. It's only support 1.21.4...

Gemini in Minecraft
Brought to you by Roflboy, with love for the Minecraft community. <3
This Fabric mod integrates Google's Gemini AI into Minecraft, allowing you to interact with an AI assistant directly within the game. The AI can answer questions, provide information about your current environment, and even execute in-game commands (if enabled).
Features
- In-Game AI Chat: Ask Gemini questions and receive responses directly in your chat window.
- Context-Aware Responses: The AI has access to information about your current game state, including:
- Player coordinates (x, y, z)
- Current dimension
- Time of day and weather
- Game difficulty and mode
- Player health, food, and XP level
- Inventory and equipped items
- Ping and online players
- Command Execution (Optional): If enabled, Gemini can execute Minecraft commands based on your requests. Commands are provided in a
minecraft code block within the AI's response.
- Conversation History (Optional): The mod can remember past conversations, allowing for more natural and context-aware interactions. The size of the conversation history is configurable.
- Configurable System Prompt: Customize the AI's behavior and personality by modifying the system prompt. A default prompt is provided, focusing on helpfulness and Minecraft-specific information.
- Customizable Model: Choose which Gemini model to use (default:
gemini-1.5-flash).
- Configurable maxOutputTokens: set maximum size of response, that will AI return (default: 200)
- Helpful Commands: Access a list of available commands using
/aihelp.
- MOTD: Mod have messages of the day, that randomly chosen every time when player log in.
- Clickable Responses: AI responses are clickable, allowing you to easily follow up on previous messages or suggest new queries.
- Sound feedback: All actions are sounded.
Dynamic Variables in System Prompt
The systemMessage supports several dynamic variables that are replaced with real-time game information when the AI is queried. This allows the AI to provide context-aware responses. Here's a list of the available variables:
{username}: Your Minecraft player name.
{x}: Your current X-coordinate (formatted to two decimal places).
{y}: Your current Y-coordinate (formatted to two decimal places).
{z}: Your current Z-coordinate (formatted to two decimal places).
{time}: The current world time (in ticks).
{timeOfDay}: Indicates whether it's "day" or "night" based on the world time.
{health}: Your current health (formatted to one decimal place, out of 20).
{food}: Your current food level (out of 20).
{xp}: Your current experience level.
{dimension}: The name of the dimension you're currently in (e.g., "minecraft:overworld").
{difficulty}: The current game difficulty (e.g., "peaceful", "easy", "normal", "hard").
{weather}: The current weather condition ("clear" or "raining").
{gameMode}: Your current game mode (e.g., "survival", "creative", "adventure", "spectator").
{mainHand}: The item you're holding in your main hand, including the quantity (e.g., "1x Diamond Sword" or "nothing").
{offHand}: The item you're holding in your offhand, including the quantity (e.g., "1x Shield" or "nothing").
{inventory}: A comma-separated list of the items in your inventory (excluding armor), including quantities (e.g., "64x Cobblestone, 16x Iron Ingot" or "empty").
{armor}: A comma-separated list of your equipped armor, including durability (e.g., "Diamond Helmet (150/363), Iron Chestplate (200/240)" or "no armor").
{ping}: Your current ping to the server (in milliseconds).
{playerCount}: The total number of players currently online.
{playerList}: A comma-separated list of the names of all online players (e.g., "Player1, Player2, Player3" or "no other players").
These variables are automatically updated each time you send a query to the AI, ensuring that the responses are relevant to your current situation. You can use these variables in your custom systemMessage to tailor the AI's behavior.
Commands
/ai <query>: Sends a question to the AI.
/aihelp: Displays a list of available commands and their descriptions.
/aihistory: Shows your conversation history with the AI (if memory is enabled).
/clearmemory: Clears the conversation history.
/setupai apikey <apiKey>: Sets your Google Gemini API key. This is required for the mod to function.
/setupai model <modelName>: Sets the Gemini model to use (e.g., gemini-1.5-flash).
/setupai system <systemMessage>: Sets a custom system message for the AI.
/setupai defaultsystem: Resets the system message to the default.
/setupai memory <enabled> <size>: Enables or disables conversation memory and sets its size.
enabled: true or false.
size: The number of messages (both user and AI) to store (maximum 50).
/setupai maxoutput <tokens>: Sets maximum of output tokens.
tokens: Any number between 50 and 8046
/setupai commands <enabled>: Enables or disables AI command execution.
/reloadconfig: Reload config like you just change it out of minecraft env.
Installation
- Install Fabric: Make sure you have the Fabric Loader installed for your Minecraft version.
- Download the Mod: Download the
GeminiInMinecraft mod (jar file).
- Place in Mods Folder: Place the downloaded jar file into your Minecraft
mods folder.
- Obtain an API Key: You'll need a Google Gemini API key. You can obtain one from the Google AI Studio website.
- Configure the Mod: After launching the game, use the
/setupai apikey <your_api_key> command to set your API key.
Configuration
The mod uses a configuration file (geminiinminecraft.json) located in your Minecraft config directory. This file is automatically created when the mod is first run. You can edit this file directly, or use the in-game /setupai commands to modify the settings.
Configuration Options:
model: The Gemini model name (default: gemini-1.5-flash).
apiKey: Your Google Gemini API key.
systemMessage: The system prompt that guides the AI's behavior.
memoryEnabled: Whether conversation memory is enabled (true or false).
memorySize: The size of the conversation history (if memory is enabled).
maxOutputTokens: Maximum size of tokens in AI response.
commandExecutionEnabled: Whether AI command execution is enabled (true or false).
Important Notes
- API Key Security: Your API key is stored in plain text in the configuration file. Be mindful of who has access to your Minecraft directory.
- Command Execution Risks: Enabling command execution gives the AI the ability to run commands in your world. Use this feature with caution, as the AI might execute unexpected or undesirable commands. It's recommended to test command execution in a safe environment (e.g., a test world) before using it in your main world.
- AI Limitations: Gemini is a powerful AI, but it's not perfect. It may sometimes provide incorrect or nonsensical responses. Always double-check information provided by the AI, especially when it comes to game mechanics or external resources.
- Formatting: The mod's system prompt instructs Gemini to use Markdown formatting. The mod converts this Markdown to Minecraft's text formatting codes. If you modify the system prompt, be aware of how formatting is handled.
- Error Handling: The mod includes basic error handling, but unexpected errors may still occur. Check the game logs for more detailed information if you encounter problems.
Acknowledgments and Thanks
A huge thank you to the Minecraft and Fabric communities for their continued support and inspiration. This mod wouldn't be possible without the amazing tools and resources available.
Special thanks to Google for their Gemini AI models, which power this mod's core functionality, Zaggott for the mod logo.
And, of course, thank you for using my mod! I hope you find it helpful and fun.
Contributing
If you'd like to contribute to the development of this mod, feel free to submit issues or pull requests on the GitHub repository. All contributions are welcome, whether it's bug fixes, feature suggestions, or code improvements. Please make sure your pull request is relevant.
Support the Project (Optional)
If you enjoy using this mod and would like to support its development, you can buy me a coffee!
Any support is greatly appreciated and helps me continue to improve and maintain the mod.
Final Thanks
Thanks again for trying out my mod! I'm excited to see how you use it and hear your feedback.
评论 0
登录后参与评分
还没有评论,来抢沙发吧