🧠 AI Chat API Mod (1.0)
Overview
AI Chat API is a compact Minecraft mod that adds an intelligent assistant to the game through the /aichat command. You can ask questions, get creative ideas, or have lively conversations with artificial intelligence powered by Pollinations.ai (OpenAI model). All responses appear directly in the game chat with standard Minecraft formatting preserved.
Currently, the conversation context saving feature is not implemented.
Future versions plan to support Forge, Fabric, and older Minecraft versions.
Key Features
💬 Chat with AI Right in the Game
Use the command /aichat <your message> to communicate with artificial intelligence. For example:
/aichat How to find diamonds faster?
🌍 Multi-Language Support
The system automatically detects the language of your query and responds in the same language.
⚡ Asynchronous Network Request Handling
HTTP requests are executed without blocking the gameplay, eliminating lag.
🔒 Error Resilience
The mod properly handles API failures with clear error messages in the user's language.
This command can be used to create other mods and datapacks.
Technical Highlights
// Simplified command structure
Commands.literal("aichat")
.then(Commands.argument("prompt", StringArgumentType.greedyString())
.executes(context -> {
// Asynchronous API call to Pollinations.ai
CompletableFuture.runAsync(() -> {
String response = fetchAIResponse(prompt);
// Safe execution in game thread
source.getServer().execute(() -> {
source.sendSuccess(() -> Component.literal("<Chat AI> " + response), false);
});
});
return 1;
})
);