Started by
modbroz
on
Topic category: Help with Minecraft modding (Java Edition)
PLEASE HELP, I want to know how to make an entity do certain things with artificial intelligence from Gemini or ChatGPT.
Topic category: Help with Minecraft modding (Java Edition)
PLEASE HELP, I want to know how to make an entity do certain things with artificial intelligence from Gemini or ChatGPT.
mcreator cannot do that, you could make a markov chain to make semi-intellegent speech.
If you just want the entity to have intelligent dialogue, it wouldn't be that difficult, and I can help you with that. But if you want it to actually result in movement, attacking, etc. that would be a real challenge in both programming, prompt engineering, and parsing the response.
Well can I at least make an AI chatbot or smh, I've heard of Mcreator mods that have AI chatbots and stuff.
You also said I could do that so could you show me how to do it
First you can get an API key from OpenAI, which is required if you want to use their GPT models. Of course, they are paid, but you can put in an arbitrary amount of money and it's largely pay as you go. I've sent over hundreds of messages for the past couple months yet it only cost like three dollars.
You then want to use Java's HttpURLConnection class to create a POST request to OpenAI, the payload structure of which can be found here:
https://platform.openai.com/docs/quickstart
Making a POST request is a little more complicated compared to GET, and requires you to read the OutputStream to stick on the required parameters, but I found a quick guide with an example here:
https://www.baeldung.com/httpurlconnection-post
Once you get the JSON response, you can parse it as you like, and to avoid doing more coding, just use the procedure system for the rest of the process up to sending the message or handling it however you'd like.
There are some good JSON parsing plugins for MCreator out there.