Java-tastic Mod-ilicious Minecraft-ium

That’s my fancy title for saying I’m taking a stab at learning how to mod Minecraft.  Really I don’t care to learn how to do it…but my little 8 year old wants to learn how and is asking me to teach him.  How can I say no to that?

In all honesty…I’m not sure he’s ready.  The stuff you have to know in order to do this successfully are a pretty tall order for an 8 year old whose only real knowledge about a computer is how to double click an icon and navigate URL’s in a web browser.  I’ve tried to install some deeper knowledge in him but so far there hasn’t been a real hunger to know how things work under the covers.  So what I’m going to be doing with this post is laying out what I think he’ll need to learn in order to achieve his end goal of making a mod for Minecraft.  I’ll be coming back to this post from time to time to add / update content as I find things out for myself that I want to pass along to him.  With that being typed…

Here’s the list of things in order of priority:

Knowledge of the File System

Since I’m a Windows guy…I won’t be going into Unix \ Linux \ Apple based OS’s.  A person who’s trying to figure out how to mod Minecraft MUST know how to navigate around a File System in Windows.  You have to be able to know what it means to create a directory, unzip a file, open a command prompt…etc…if a person doesn’t understand these basic concepts it will be impossible for them to make a mod.

Know what Java is

If the prospective modder doesn’t know what Java is and why it’s important to Minecraft, they probably shouldn’t try writing a mod.  Writing code without fundamentally understanding the langauge being used will cause problems.  Personally I know how to code in Java because it’s very similar to C# and I know that very well.  The minor differences I can find out how to handle easily enough by doing a quick search on the internet so that’s the same approach I’ll be taking when teaching my son.  It works for me.  😉

So not only do they need to know what Java is…but they’ll need to know how to install the JDK which is short for Java Development Kit.  It’s a little more than just the Java Runtime Environment in that it includes some tools used in developing Java code.

Know what an IDE for Java is

IDE is short for Integrated Development Environment.  Basically it’s the program you use to write code.  For most languages I use Visual Studio.  I’m used to it…I know all the keyboard shortcuts…I like it.  But for Java, it doesn’t really work so well…so I use the free Java specific one called Eclipse.  It seems to be the most popular and it’s fairly easy to muddle your way through it if you’re used to Visual Studio.  If you’re going to create a mod…you’re going to have to get familiar with an IDE.

Know what Forge is

There are other methods of modding Minecraft, but in my opinion the are a waste of time when you have a wonderfully built framework like Forge to build on top of already there just waiting to be used.  Using Forge will take a lot of the learning curve out as the modder won’t have to know how to actually hook into Minecraft…which is really the hard part.  Instead they’ll get to focus on the code for their new recipe’s, block’s, etc…which is really what the excercise is about.  If he gets interested in coding, then I’ll let him sink his teeth into figuring out how to hook into Minecraft however he wants, but I’m starting him off using Forge.

So along with knowing what Forge is and what it’s doing…he’ll have to know how to install the MDK for it which is short for Mod Development Kit.  Forge is super nice in that they set it up ahead of time to work with Eclipse so that’ll save some time as well.

This provides instructions which give an okay-ish experience on installing the Forge MDK…but there’s some gaps I’ll try to fill in here.

Gaps:

  • It gives a vague “make sure Java is installed” disclaimer at the top with some very basic stuff on how to get it ready…really if you can’t open up a command prompt and type in “java -version” without it producing an error…don’t even bother trying anything on this page yet…go back to your Java installation and get it figured out before doing anything more with Forge
  • It tells you to use this “gradlew” command for downloading source code for the various code libraries used in modding.  The 2nd one that I used for Eclipse was deceiving in that I thought it was pulling down Eclipse and installing it…that’s not the case…it is only pulling down the special package info Eclipse uses for projects…you still need to install Eclipse on your own.

Know where to find where Minecraft is running from

If you’re going to mod Minecraft you better know where to find it.  Although the Forge MDK does include it with it’s distribution so this one isn’t “as” important as the others…but I think it’s important knowledge regardless…

Mod Minecraft

Once we’re at this point…then it’s really up to him to figure out what he wants to make a mod of, what new blocks and recipes he needs, and then add them in…should be gravy from here.  🙂

This has some instruction to get you started, but the paths are all wrong…but if you can figure your way past that, the basic ideas that are being conveyed still seem to be relivant.  I was able to get my own mod created and injected into Minecraft after reading through it and making some correction for src paths.

My Experiement

Here’s the steps I went through to get a working mod that only spits out an “initialized” message in the Minecraft console.

  1. Installed JDK version 8u77 from here.
  2. Added the installed location for JDK to the system Path environment variable
  3. Installed Eclipse version Mars.2 (4.5.2) from here.
  4. Downloaded Forge MDK version 1.9 – 12.16.0.1816 from here.
  5. Unzipped the MDK onto the C: drive into a folder called “Forge”.  Ex: C:\Forge
  6. Opened a command prompt window and navigated to C:\Forge
  7. Execute the following command:
    gradlew setupDecompWorkspace --refresh-dependencies
  8. Execute the folloiwng command:
    gradlew eclipse
  9. Launched Eclipse and pointed at C:\Forge\eclipse for the working directory
  10. Locate the “examplemod” class that’s already created by looking in the Package Explorer and expanding MDKExample->src/main/java->com.example.examplemod.  From here you should see an ExampleMod.java file which will already work and spit out “DIRT BLOCK >> dirt.block” to the console…but I renamed mine to “Toffkins” and had it output something a little more specific to my mod.  “Congrats!  You’ve initialized the mod: [Toffkins] version: [1.0]”

That’s it…your first mod.  To try it out in Eclipse…just hit the little green “Run” arrow and it’ll launch Minecraft for you.  From here you can watch the console output right from Eclipse.  If you weed through all the spew…you’ll eventually see your mod’s output…or you can look within loaded Minecraft client and click the Mod button to see your new mod within the list of loaded mods.  Congrats…now go make it do something AMAZING and let me know what you’ve made.  🙂

Here’s a link of what I’m going to attempt next…which is adding a command to do something while logged into the game.  Small steps.  🙂

Update on 6/7/2016 – I’ve actually got my mod so I can type in commands while in game now.  I called it “Toffkins” and I’m going to make it a “Jarvis”-like thing for inside the Minecraft game.  Really I’m not going to be putting much more effort into this until someone starts asking me more questions in this area…but I’ve left it in a good spot where I can easily pick it back up and start doing cooler things.  Until then…

Advertisements
Java-tastic Mod-ilicious Minecraft-ium

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s