Developing MCreator plugins

Before you start

Before starting to create plugins for MCreator, you should know every aspect of MCreator. You should and have also to know basic Java and Forge coding with Forge Concepts. Finally, success to make an MCreator plugin is possible by trying something, understand why it doesn't work, and search.

What you can make

With MCreator plugins, one can add new features to MCreator, more specifically (at the time of writing):

  • Custom procedure blocks and categories
  • Custom global triggers
  • Custom JSON advancement triggers and categories
  • AI task blocks and categories
  • New generators

Demo plugins

You can start off with making a plugin by exploring demo plugins that help you get started with your own plugin:

Plugin basics

Setting up the plugin

The basic plugin structure looks somewhat like this:

bruuuuh
Let's take a look at what these files do.

 

plugin.json (Mandatory): All plugins have to include this file. This file contains the basic metadata of the plugin, like the author, the version of the plugin, the supported MCreator version(s), the weight of the plugin (the plugin loading priority), and most importantly, the ID of the plugin. The next section will explain the exact specifications of the plugin.json file.

"procedures" directory: This is where the Blocky JSON data for procedures are stored. Note that this only stores the "formats" and the visuals for procedure blocks, not the actual code it generates.

"triggers" directory: This is where the JSON data for global triggers are stored. Note that this only stores the "formats" and the visuals for the global triggers, not the actual code it generates.

"aitasks" directory (not shown here): This is where the Blocky JSON data for AI tasks are stored. Note that this only stores the "formats" and the visuals for AI tasks, not the actual code it generates.

The "forge-x.xx.x" directories: This is where all the magic happens. This is where all the Freemarker files for generating code are stored(Procedures, AI tasks, Triggers, everything) for the specified Minecraft version in the "x.xx.x" part of the directory name. At the time of writing the supported Minecraft versions for MCreator is 1.14.4 and 1.15.2.

 

plugin.json specifications 

plugin.json is the most important part of your plugin. It contains all of the necessary data for MCreator to properly read your plugin. Let's take a look at an existing plugin.json file.

waat

Let's look at the data line by line.

 

id (Mandatory): This is the ID of your plugin. Try to make it unique to avoid conflicts with other plugins. You should use English characters and it cannot have capital letters. Please also avoid using special symbols and spaces.

minversion(Suggested): The minimum MCreator version your plugin works on, used to ensure compatibility with the version of MCreator your user is on. Specific to the build number. Exact build numbers can be found at https://mcreator.net/changelog, but do not include the dots and add a extra zero in after the year number. For example, if the build number at https://mcreator.net/changelog is 2020.3.22116, the number you write here is 20200322116.

maxversion(Not shown here, Suggested): The maximum MCreator version your plugin works on, used to ensure compatibility with the version of MCreator your user is on. Specific to the build number. Exact build numbers can be found at https://mcreator.net/changelog, but do not include the dots and add a extra zero in after the year number. For example, if the build number at https://mcreator.net/changelog is 2020.3.22116, the number you write here is 20200322116.

The info block(Mandatory):

  -name(Mandatory): The display name of your plugin. Try to avoid long names and names with Non-English characters to prevent rendering problems.

  -version: The current version of your plugin. Try to avoid long version names and version names with Non-English characters to prevent rendering problems.

  -authors(Mandatory): The creator(s) of your plugin. Try to avoid long names and names with Non-English characters to prevent rendering problem.

  -description(Not shown here): Description of your plugin.Try to avoid descriptions with Non-English characters to prevent rendering problem.

Installation

There are two ways to install a plugin:

Way A

1. Close MCreator.

2.  Go to /.mcreator/plugins and place the .zip file of the plugin there. You need to enable hidden folders on your OS to see this.

3. Open MCreator, if everything is fine, then your plugin should be listed with other plugins (Preference -> Manage plugins).

Way B

1. Launch MCreator

2. Go to preference => manage plugins and click on "load plugin" to import the .zip file.

3. Relaunch MCreator, then your plugin should be listed with other plugins (Preference -> Manage plugins).

Exporting

To export the plugin, simply archive the root folder of the plugin into a ZIP file, so the plugin has the following structure:

  • <plugin file name>.zip
    • plugin.json
    • (procedures)
    • (<generator 1 name>)
    • ...

Video tutorial

If you prefer to watch the video, you can find the wiki page above summarized in a video:



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.