Configuring Sublime to Automatically Compile Minecraft Command Code

sublime_text_2016-07-25_13-58-00
Sublime after compiling Minecraft Code into a one-command using Smelt.

Sublime is an incredibly powerful text editor. Learning how to use it effectively is key to keeping your Minecraft commands maintainable.

Build systems is a feature of Sublime. It allows us to run our files through external programs, for example…Smelt.

Why would I want to do this?

The answer is very simple:

To deploy and test code as quickly and as efficiently as possible.

The longer answer?

By writing code in a text editor, syncing immediately becomes an issue. With this tool, we ensure our code makes it into the game without error. You will shift your attention to where it needs to be: creating awesome custom maps.

 

Instructions

I will give you the step-by-step instructions first, then explain what each configuration option means.

  1. Install Sublime, Minecraft Syntax Highlighter, and Smelt
  2. Ensure you’ve properly configured Smelt (read instructions thoroughly)
  3. From Sublime’s main window:
    1. Tools -> Build System -> New Build System…
  4. A document will open with a document which looks like this:
    sublime_text_2016-07-25_14-15-22
  5. Replace all the text above with this:
    {
    "shell_cmd": "smelt compile $file --copy",
    "shell": true,
    "selector": "source.mcc"
    }
  6. Save this file (File -> Save) as “Smelt”

You’ve now configured Sublime to recognize <files>.mcc as Minecraft Code. Here is a break down of what the configuration file does:

“shell_cmd”: “smelt compile $file –copy”
This is the command we’re going to run through a command prompt (shell), which…if you did your reading…you already know. $file directs the shell to the file you currently have open, which plays beautifully in how Smelt works.

“shell”: true
This settings tells Sublime we want to run a shell command.

“selector”: “source.mcc”
This setting tells Sublime to look at what syntax is being used for the file currently open. In our case, we’re looking for <file>.mcc.

Conclusion

Configuring build systems is a essential part of many programming languages. What you’ve really done is asked Sublime to run your CODE through a COMPILER. The only other step is to paste your compiled code into a Command Block and activate it.