[Tutorial] MCreator Plugins Development 0 - Setup

Started by crispy_chips1234 on Sun, 06/07/2020 - 05:17

Topic category: Plugins and third-party tools

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 06:40, 15. Feb 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Nice tutorial, pls continue…
Sun, 06/07/2020 - 05:37

Nice tutorial, pls continue this. It can help a lot of people.

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Updated the formatting and…
Sun, 06/07/2020 - 06:25

Updated the formatting and added the plugin.json part :D

Last seen on 06:40, 15. Feb 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I think their is also a…
Sun, 06/07/2020 - 06:57

I think their is also a optional argument named "description" under info block.

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
hmm ok? I'm going to test it…
Sun, 06/07/2020 - 07:16

hmm ok?
I'm going to test it :D

Last seen on 06:40, 15. Feb 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I don't know where it…
Sun, 06/07/2020 - 07:22

I don't know where it displays but it is on MCreator wiki Developing MCreator plugins section.

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I have finalized the edits…
Sun, 06/07/2020 - 11:02

I have finalized the edits. This part of the tutorial is now considered complete.

Last seen on 17:09, 23. Jun 2021
Joined Aug 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Nice! tutorial! Iwill change…
Sun, 06/07/2020 - 13:12

Nice! tutorial! Iwill change some sctions of the Wiki page.

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
What should I do for part 2?…
Sun, 06/07/2020 - 13:35

What should I do for part 2?

1. New basic "code execution"procedure block that doesn't use Minecraft dependencies(like a procedure block that prints an empty line in the console, very simple)

2. New basic "code execution" procedure block that uses Minecraft dependencies (like placing a block at x y z)

3. New global trigger (probably the easiest, I only have to explain how to pass dependencies to MCreator)

4. New AI task (I haven't made any ai tasks before lol)

4. New AI task (I haven't…
Sun, 06/07/2020 - 18:55

4. New AI task (I haven't made any ai tasks before lol)

This was never shown before so it would be neat :D

Or trigger too, I don't think it was covered before, even though it is easy to add.

Last seen on 17:09, 23. Jun 2021
Joined Aug 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
4. New AI task (I haven't…
Sun, 06/07/2020 - 20:32

4. New AI task (I haven't made any ai tasks before lol)

This was never shown before so it would be neat :D

Wrong answer Klemen ;)

https://mcreator.net/wiki/create-new-ai-tasks

https://www.youtube.com/watch?v=J_nLaddI7z4
However, triggers have been never explained (even if they will be my two next tutorials).

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I have started the global…
Mon, 06/08/2020 - 10:35

I have started the global trigger tutorial.

Last seen on 05:24, 23. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Second part is set to be…
Wed, 06/17/2020 - 02:00

Second part is set to be released this weekend.