Working on MCreator workspaces from IntelliJ IDEA

MCreator is an excellent tool for modding Minecraft without deep programming knowledge, but for developers who want to dive into custom code and advanced features, IntelliJ IDEA can be a powerful integrated development environment (IDE) to work on MCreator workspaces. This guide will walk you through setting up your MCreator workspace in IntelliJ IDEA, streamlining your workflow, and maximizing productivity.

Gradle project

Every workspace that you create with MCreator is at the same time also a Gradle project, meaning it can be opened with any IDE that supports Gradle. MCreator maintains a compatible file structure so both external IDEs and MCreator can be used at the same time.

Import the project into IntelliJ IDEA

To start working with the MCreator workspace, you'll need to import the generated Gradle project into IntelliJ.

  1. Open IntelliJ IDEA.
  2. Import Project:
    • On the welcome screen, click on Open
    • Navigate to your MCreator workspace folder and select it
  3. Gradle Sync: Once the project is imported, IntelliJ will automatically detect the build.gradle file and start syncing your project dependencies. This may take some time depending on your system and internet speed.

Working with MCreator Code in IntelliJ

Once your project is set up, you can start working on the codebase directly from IntelliJ.

  1. Exploring the Code:
    • The code generated by MCreator is located under the src directory.
    • Explore your mod elements (blocks, items, events, etc.), and you can now write custom code or modify the auto-generated code from MCreator (if you do so, make sure to lock the code of the mod elements that you are changing).
  2. Writing Custom Code:
    • IntelliJ provides powerful tools for code completion, refactoring, and debugging. You can use this to improve or customize your mod beyond the options available in MCreator.
    • Make sure to test any code changes by running the Minecraft client or server from the configurations you set up.

You can build and export the project from either MCreator or IntelliJ IDEA.

Autogenerated code

If you want to modify the code generated by MCreator, make sure to lock the code of the mod elements that you modify. Otherwise, MCreator will override your changes.

If you want to modify the base mod files that reference all mod elements of a certain type or main mod file, make sure to do so in the user code blocks that are marked with starting and ending comments in the code.

If you want to add custom Java files to the project, make sure to do them outside the mod package specified in Workspace settings in MCreator, as otherwise MCreator may delete them during workspace code regeneration.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.