crazygamerz0137

This mod adds a smart AI chatbot directly inside Minecraft server and single-player chat, allowing players to talk with an in-game assistant just like chatting with a real helper. The bot listens to normal chat messages (for example, messages starting with a special prefix such as !ai) and instantly replies inside the same chat window, answering questions, explaining game mechanics, helping with commands, giving building ideas, redstone tips, survival strategies, and even simple study or maths help for players who want to learn while playing. The chatbot works in real time, supports multiple players at once, and keeps conversations clean and friendly so it is safe for school-age users and public servers. Server owners can fully configure the bot’s name, reply style, cooldown, and allowed features, and can enable or disable learning, fun talk, or technical help modes. The mod is lightweight, does not change gameplay balance, and is designed to work smoothly with existing servers without lag. It is perfect for SMP servers, classroom worlds, and practice servers where players want quick help without opening a browser, turning Minecraft chat into a powerful, interactive AI assistant that feels like a real player inside the world.

Kodari AI
KodariFeb 24 at 2:37 am 14,837 (v2)

I’ll create an AI-powered chat assistant mod for Minecraft.

MinecraftChatAI
An AI-powered chatbot that operates directly within Minecraft chat, responding to messages with a configurable prefix (e.g., !ai). Players can ask questions about game mechanics, building tips, redstone help, survival strategies, and even educational content. Supports multiple concurrent conversations, includes cooldown management, and offers configurable response styles. Server owners can customize the bot's name, behavior modes, and feature toggles. Safe for all ages with built-in content moderation. Works seamlessly in multiplayer and singleplayer without affecting gameplay balance or performance.

Now I’ll build the complete mod structure with all necessary components.

Complete Minecraft Chat AI mod created successfully with comprehensive AI chatbot functionality, including OpenAI integration, message filtering, cooldown management, admin commands, and full configuration system.

crazygamerz0137

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 6 error(s):

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 14: cannot find symbol
    private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
                         ^
  symbol: class MediaType
  location: class OpenAIProvider

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 15: cannot find symbol
    private final OkHttpClient client;
                  ^
  symbol: class OkHttpClient
  location: class OpenAIProvider

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 8: package okhttp3 does not exist
import okhttp3.*;
^

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 14: cannot find symbol
      private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
                           ^
  symbol: class MediaType
  location: class OpenAIProvider

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 15: cannot find symbol
      private final OkHttpClient client;
                    ^
  symbol: class OkHttpClient
  location: class OpenAIProvider

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 8: package okhttp3 does not exist
  import okhttp3.*;
  ^


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - MediaType
  - OkHttpClient
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/minecraftchatai/ai/OpenAIProvider.java
  -   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java
 exceeds maximum 

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariFeb 24 at 2:39 am 17,665 (v2)

I need to read the relevant files to understand the issue and fix it.

I can see the issue. The OkHttp3 and Gson dependencies are declared with implementation but they need to be included in the mod jar. In Fabric mods, external libraries must be bundled using the include configuration.

Let me fix the build.gradle:

The issue is that OkHttp3 is declared as implementation in build.gradle, which means it’s not included in the mod’s JAR. For Fabric mods, external libraries need to be either shaded (included) or declared as include dependencies.

Fixed the build.gradle to include OkHttp3 and its dependencies (okio, kotlin-stdlib) in the mod JAR using the include configuration.

crazygamerz0137

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 6 error(s):

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 14: cannot find symbol
    private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
                         ^
  symbol: class MediaType
  location: class OpenAIProvider

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 15: cannot find symbol
    private final OkHttpClient client;
                  ^
  symbol: class OkHttpClient
  location: class OpenAIProvider

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 8: package okhttp3 does not exist
import okhttp3.*;
^

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 14: cannot find symbol
      private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
                           ^
  symbol: class MediaType
  location: class OpenAIProvider

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 15: cannot find symbol
      private final OkHttpClient client;
                    ^
  symbol: class OkHttpClient
  location: class OpenAIProvider

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 8: package okhttp3 does not exist
  import okhttp3.*;
  ^


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - MediaType
  - OkHttpClient
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/minecraftchatai/ai/OpenAIProvider.java
  -   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java
 exceeds maximum 

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariFeb 24 at 2:42 am 4,216 (v2)

I need to read the files to understand the current implementation and fix the missing dependency issue.

I can see the issue - the OkHttp dependency isn’t being resolved properly. The best solution is to replace OkHttp with Java’s built-in HttpClient (available in Java 21), which avoids external dependencies entirely.

Fixed the compilation error by replacing OkHttp with Java’s built-in HttpClient and removing all external HTTP dependencies from build.gradle.

crazygamerz0137

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 6 error(s):

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 14: cannot find symbol
    private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
                         ^
  symbol: class MediaType
  location: class OpenAIProvider

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 15: cannot find symbol
    private final OkHttpClient client;
                  ^
  symbol: class OkHttpClient
  location: class OpenAIProvider

ERROR in src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 8: package okhttp3 does not exist
import okhttp3.*;
^

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 14: cannot find symbol
      private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
                           ^
  symbol: class MediaType
  location: class OpenAIProvider

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 15: cannot find symbol
      private final OkHttpClient client;
                    ^
  symbol: class OkHttpClient
  location: class OpenAIProvider

ERROR in   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java at line 8: package okhttp3 does not exist
  import okhttp3.*;
  ^


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - MediaType
  - OkHttpClient
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/com/minecraftchatai/ai/OpenAIProvider.java
  -   src/main/java/com/minecraftchatai/ai/OpenAIProvider.java
 exceeds maximum 

Please fix this error by creating a new artifact with the corrected code.

crazygamerz0137

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 2 error(s):

ERROR in src/main/java/com/minecraftchatai/command/ChatAICommand.java at line 84: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "player");
                                                                ^

ERROR in   src/main/java/com/minecraftchatai/command/ChatAICommand.java at line 84: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "player");
                                                                  ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/minecraftchatai/command/ChatAICommand.java
  -   src/main/java/com/minecraftchatai/command/ChatAICommand.java
 exceeds maximum 

Please fix this error by creating a new artifact with the corrected code.

crazygamerz0137

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/minecraftchatai/command/ChatAICommand.java at line 84: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "player");
                                                                ^

ERROR in   src/main/java/com/minecraftchatai/command/ChatAICommand.java at line 84: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = EntityArgumentType.getPlayer(context, "player");
                                                                  ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/minecraftchatai/command/ChatAICommand.java
  -   src/main/java/com/minecraftchatai/command/ChatAICommand.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariMar 9 at 7:14 am 8,483 (v2)

Fixed the compilation error by adding throws CommandSyntaxException to the clearPlayerCooldown method signature and importing the exception class.

Kodari can make mistakes. Review important code before using.
Files
src
.gitignore
build.gradle
gradle.properties
README.md
settings.gradle
Code
18 935
src/main/java/com/minecraftchatai/MinecraftChatAI.java
package com.minecraftchatai;

import com.minecraftchatai.ai.AIResponseHandler;
import com.minecraftchatai.chat.ChatListener;
import com.minecraftchatai.command.ChatAICommand;
import com.minecraftchatai.config.ConfigManager;
import com.minecraftchatai.cooldown.CooldownManager;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MinecraftChatAI implements ModInitializer {
    public static final String MOD_ID = "minecraftchatai";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
    
    private static MinecraftChatAI instance;
    private ConfigManager configManager;
    private CooldownManager cooldownManager;
    private AIResponseHandler aiResponseHandler;
    private ChatListener chatListener;
    
    @Override
    public void onInitialize() {
        instance = this;
        LOGGER.info("Initializing Minecraft Chat AI");
        
        configManager = new ConfigManager();
        cooldownManager = new CooldownManager();
        aiResponseHandler = new AIResponseHandler(configManager);
        chatListener = new ChatListener(configManager, cooldownManager, aiResponseHandler);
        
        ServerMessageEvents.CHAT_MESSAGE.register(chatListener);
        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> 
            ChatAICommand.register(dispatcher, configManager, cooldownManager, aiResponseHandler)
        );
        
        LOGGER.info("Minecraft Chat AI initialized successfully");
    }
    
    public static MinecraftChatAI getInstance() {
        return instance;
    }
    
    public ConfigManager getConfigManager() {
        return configManager;
    }
    
    public CooldownManager getCooldownManager() {
        return cooldownManager;
    }
    
    public AIResponseHandler getAIResponseHandler() {
        return aiResponseHandler;
    }
}