Table of Contents
Using LLMs for Minecraft Modding
This article explains when and when not to use LLMs for modding Minecraft, and how to use them most effectively.
If You're Learning
If you are learning Minecraft modding but already know how to code, you probably shouldn't be using LLMs at this stage. If you are learning to code, you should restrict your LLM usage only to asking it questions about how Java works.
- Generating code with LLMs takes away valuable practice. Practice is the most effective way to learn to code, and to learn how to mod Minecraft. Every line written by an LLM is a missed opportunity for you to practice.
- You don't know if the output is good. LLMs often generate output who looks correct and impressive to the untrained eye, but is incorrect or flawed in some way. If you are not yet a modding expert, you won't know the difference between good and bad output.
- LLMs often mix up Minecraft versions and modding platforms, or hallucinate APIs that don't exist. This is why you should ask about Java language features only, rather than asking about anything Minecraft-specific.
If You're Experienced
If you're confident you can tell apart good and bad code, then you may consider generating some code using LLMs. You should already have an idea in your mind about what the correct output should look like before asking an LLM to generate it. If you're experienced, have a play around with using AI agents in different scenarios, and you will learn in what scenarios they are most likely to produce good output faster than you could, and which are best left for humans.
Context
Much of an LLM's poor output, such as hallucinations, can be made much less likely by giving the LLM more context. If an experienced Java developer comes into your project with little prior knowledge about Minecraft or your project, think about what context they would need to perform your task successfully. Are they aware of the APIs available or any existing examples?
A traditional LLM like ChatGPT is not able to effectively find context for itself like a human developer would. At best, they search the web for any existing examples and get confused between different Minecraft versions. You need to search for all the context it requires (such as APIs and existing examples) yourself, and hope that it generates acceptable output. Often this is less effective than simply coding it yourself.
AI agents have advanced abilities to search for context themselves, which makes them a little more effective. However, they are still not as good as an experienced programmer at finding it. Consider giving it pointers to the right places to look to learn about the Minecraft and mod codebase before implementing the feature you are asking of it, like you would if you were onboarding a human and wanted them to get it done faster.
Detailed Prompts
LLMs have a tendency to fill in gaps in the instructions by making something up themselves, rather than asking you for clarification or discussing options like a good coworker would. If you want things to be done in a specific way then you should tell the LLM upfront.
Rather than asking an AI agent:
Add an electric furnace to my mod
Consider asking it:
Add an electric furnace to my Fabric mod. This furnace should consume power rather than fuel, 500 energy units should smelt one item. Use the TechReborn Energy API for power.
Followed by giving it context (see above) such as documentation and examples for the Energy API, the vanilla furnace implementation that needs to be adapted, and other example machines already existing in your mod. Notice how this leaves less room for interpretation on how the furnace should be implemented.
Another detail to add to prompts is if you notice that an LLM is often doing something you don't like (such as adding too many comments), simply telling it not to is a somewhat effective way to mitigate the issue. If you find yourself repeatedly telling it this, consider adding it to your `AGENTS.md` file.
Other uses of LLMs
If you have a repetitive or boilerplatey refactor, an AI agent may be a faster way to perform the refactor. For example, if you have a lot of hardcoded `Identifier`s across a lot of files, and want to extract them into a new constants class, an AI agent may be a useful tool for this.
There may be other valid uses of LLMs in Minecraft modding aside from coding. If you're running dry on ideas, sometimes bouncing ideas off an LLM can help you come up with some. In all likelihood you won't like most of the ideas it generates, but sometimes it generates some ideas that have potential. If it generates too many ideas that you don't like, consider making the prompt more detailed to give it a direction to think in, or explicitly exclude a class of ideas. For example, when coming up with ideas for a name for your mod with an LLM, asking it to not generate names containing “mine” or “craft” often improves the results.
It may also be possible to generate concept art using AI for inspiration only (it's not very good at pixel art). Not everyone is happy with the idea of using AI for this purpose, though.