[Tutorial] MCreator Plugins Development 0 - Setup

Started by crispy_chips1234 on

Topic category: Plugins and third-party tools

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] MCreator Plugins Development 0 - Setup
Wed, 06/17/2020 - 02:12 (edited)

Hi there :D This is a tutorial on how to make MCreator plugins.


Before we start

Before I start explaining how to make a plugin, you must understand that they are quite limited and they could only add new procedure blocks, ai tasks, global triggers, and code generators to MCreator. New mod elements are NOT possible. Adding new parameters to existing mod elements are NOT possible. To follow the tutorials, you must have some basic knowledge of JSON as well as Google's "Blocky" visual programming system that MCreator utilizes to make the procedure system possible. Reading this page is strongly recommended for learning the creation of new procedure blocks. Of course Java knowledge is also required, and you should know how to do code a feature before attempting to implement it in the form of MCreator plugins.


Gathering the gear

There are some vital resources that you need while developing MCreator plugins.

  • A text editor. Although you could use the text editor provided with your operating system (Like TextEdit for mac), you should probably get a professional one with code suggestion and syntax highlighting. You could use Notepad++, Visual Studio Code, Sublime Text, but I prefer using Atom. It has beautiful UI, built in Git and Github support, and most importantly a variety of addons (named "Packages") that could ease your workflow even more and even add support for new file types, like Freemarker .ftl files which would make the code generation part of plugin development much easier.

  • An intermediate understanding of how MCreator and Forge functions. You can't start making MCreator plugins the first day after you discovered them XD

  • (Optional) a Git client. If you want multiple people work on a plugin at the same time, you have to get a Git client to help you do version control to your Git repository. Or you should get a text editor that supports Git :D


Setting up the workspace

The basic plugin structure looks somewhat like this:

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

 

plugin.json (Mandatory): All plugins must include this file. This file contains the basic metadata of the plugin, like the author, the version of the plugin, the supported MCreator version, 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 glitches.

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

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

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

 

If there are any other optional arguments for plugin.json that I missed, feel free to tell me in the comments.

Here is the plugin.json template from the image if you need it ^ ^:

{
    "id": "my-mcreator-plugin",
    "minversion": 202000318613,
    "info": {
        "name": "MCreator cool plugin",
        "version": "1.0.0",
        "authors": "Me!"
    }
}

 

 


Installing and Exporting your plugin.
 

Exporting to a .zip file:https://i.ibb.co/g6m4NvQ/plugin-instructions.png

(You could also copy the root directory to .mcreator/plugins, MCreator would still read it but exporting as a .zip file makes sharing a lot easier)

 

Installing a plugin:

There are two ways to install a plugin:

Way A

First step a) : close MCreator.

Second step a) : 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.

Third step a) : open MCreator, if everything is fine, then procedure blocks should be here. If not, open an issue.

Way B

First step b) : launch MCreator.

Second step b) : go to preference => manage plugins and click on "load plugin" to import the .zip file.

Third step b) : relaunch MCreator, if everything is fine, then procedure blocks should be here. If not, open an issue.

You could now open MCreator, and if you followed everything carefully, you should see your plugin loaded in the list of plugins :D


Conclusion

This tutorial covered the resources and knowledge needed to make a MCreator plugin, the plugin file structure, plugin.json customization, and how to export and install your plugin. The next tutorial will be released soon and I'll leave a link here when I finish it. If there is anything that you don't understand (Except for basic coding knowledge like JSON files), feel free to ask in the comments, I'll try to reply as soon as possible. If you want to check out existing plugins, here is a list of (almost) all of the plugins posted on this forum: https://docs.google.com/spreadsheets/d/143vM7puNLnrNXMvNJI0zFamIFuWpqm5BMngdI10K6AM/edit#gid=0. There is also the official wiki section for MCreator plugins for further information on MCreator plugins://mcreator.net/wiki/section/mcreator-plugins but keep in mind that it is very incomplete and some information is outdated.

Thanks for reading my tutorial, hoped this helped :D

Edited by crispy_chips1234 on Wed, 06/17/2020 - 02:12
Last seen on 14:43, 2. Aug 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Goldorion that robot voice…
Thu, 06/18/2020 - 18:07

Goldorion that robot voice is terrible though.

Last seen on 01:42, 12. Feb 2024
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Omg plugin look like so nice…
Thu, 06/18/2020 - 20:39

Omg plugin look like so nice!! New ai task and procedure block its gonna open to so many possibilities! Is there any already created plugin that add ai task? I always try to go far and do what nobody else do in mcreator (and that the reason why i create like 20 topics and i never finished a mod yet (i always have a problem)). Mcreator will always surprise me.