To start off, I’ll walk you through getting set up to program Minecraft. This is the most boring part, I promise!

Part 2 covers setting up a Mac. If you’re using Windows, good news! You can jump straight to part 3. (Don’t worry Mac users, you get your own good news at the end of part 2!)

Install Java

If you’re running Yosemite, you have likely already installed Java from Apple. That version of Java may not work for CanaryMod. You can download the latest Java version.

Download the installer package from that link, run the installer and do the usual click through of each step.

Install Brackets

You’re going to need a good text editor for code. I happen to know about a nice editor that understands JavaScript and is completely free: Brackets. If you already have a code editor that you like using, feel free to use it! The demos and information that I’ll use here will be using Brackets, though.

When you download Brackets, you get a .dmg file. Open that, and Finder will open a window with the Brackets icon and a shortcut to your Applications folder. Drag the Brackets icon into your Applications folder.

Download the pre-configured package

Getting everything set up just right requires editing a few files. I’ve done that for you and put the result into a zip file that you can download.

For convenience while going through the class, I’d recommend putting that file on your desktop and then double clicking it to put the MerrySquid directory on your desktop.

Download CanaryMod

CanaryMod is the software we use to run a programmable Minecraft server. I’m not allowed to redistribute the CanaryMod/Minecraft Server software, though it is free. By using this software, you agree to Mojang’s license for the Minecraft Server.

You can download the proper version of CanaryMod via this link.

Put that .jar file into your MerrySquid folder.

Run CanaryMod

Double-click the CanaryMod jar file. You will probably see this dialog box:

Canary Can't Be Opened

Never fear! This is just Mac OS warning us that CanaryMod could do bad things to your computer and Apple doesn’t know if it’s trustworthy.

We have to trust the CanaryMod folks, otherwise we’re not going to get very far in this endeavor.

Tell Mac OS that it’s okay to run CanaryMod

Open System Preferences from the Apple menu. Then, select Security & Privacy.

System Preferences

The “General” tab of Security & Privacy tells the Mac which kinds of applications to trust. The bottom part of the dialog gives you a chance to open CanaryMod even though your Mac doesn’t know it’s trustworthy:

Security & Privacy

Go ahead and click “Open Anyway”.

Yes, you’re really, really sure

You’ll get another dialog asking if you want to open CanaryMod:

Are You Really Sure?

Click “Open”, and CanaryMod will finally launch. You’ll see a window pop up that says “Please wait while the libraries initialize”. After that, CanaryMod will exit, making it seem that everything that came before was for naught.

This window should pop up when CanaryMod has launched:

CanaryMod Running

Run Minecraft

Click Play!

Whoop whoop!

Connect to your newly running server

From Minecraft’s main window, choose “Multiplayer”. Click the “Add server” button. For the Server Name, enter ScriptCraft and for the Server Address enter localhost, then click “Done”. Your window should then look like this:

Connect To Your Server

Select your ScriptCraft server and click “Join Server”. Minecraft should start up.

Make yourself an operator

The JavaScript superpowers that ScriptCraft brings to Minecraft can’t be entrusted to just anyone that connects to the server. The easiest way to give yourself access to JavaScript is to make yourself an operator. To do that, switch over to the CanaryMod server and type /op YourUserName in the command box (replacing YourUserName with your actual Minecraft username):

Make Yourself An Operator

When you hit “return”, you’ll be an operator. You can test this by entering your first bit of JavaScript in the Minecraft window:

/js echo("hello, world!")

If Minecraft prints “hello, world!” for you, then your JavaScript is working!

Turn on Creative mode

For some reason, CanaryMod seems to want to set the game mode to survival. You can change that in the game by running:

/gamemode 1

Done!

You now have a flat, creative mode world that is ready for our (cue mad scientist voice) experiments.

Where To Go From Here