loading...

Setting up a Minecraft mod environment in VSCode (It's easier than you think!)

drazisil profile image Joe Becher ・2 min read

Hi! This is my documented journey to create a Minecraft Forge mod. It's been a while since I created one, and I want to see if I still remember how things work.

In addition, I'd like to try to do this using VSCode, instead of the usual IDEs recommended for this. Let's see how it goes!

First, let's download Forge. The files can be found at http://files.minecraftforge.net/, and I think I want the MDK, but let's see if the docs tell us.

Yep, the MDK. Ok, downloading the MDK for 1.12.2 - 14.23.5.2836...

Oh, before we get too far along, I'm planning to track my progress with git commits and this readme. That way, if things get broken or strange, I can use git to backup, and you and I get a nice history we can look back on.

Ok, the MDK is downloaded, let's unzip it.

The docs say to only copy build.gradle, gradlew.bat, gradlew, and the gradle directory. I'll leave out gradlew.bat since I'm developing on Linux.

The next step is to run gradlew setupDecompWorkspace. Since this is Linux, the correct command is ./gradlew setupDecompWorkspace, since the working directory isn't in the path.

Ok, it looks like I don't have the java compiler (or JDK) installed on this computer. Your instructions to get a JDK installed for likely differ, so I'll leave this part out. DuckDuckGo is your friend.

OpenJDK 8 installed and ./gradlew setupDecompWorkspace is successful.

The two commands we want for testing are:

  • ./gradlew runClient
  • ./gradlew runServer

Before we do that, we need a mod. Forge comes with a sample mod, but the instructions don't tell us to copy that. Let's do that though, so we have a starting place, and we can test this setup works

Copied the src directory from our unzipped MDK directory.

[19:59:27] [Client thread/INFO] [examplemod]: DIRT BLOCK >> minecraft:dirt

Great, it works! At this time, before we commit we probably want to create a `.gitignore and add a couple of things to it.

Before I get too far into modding, I want to know that we can build our mod correctly as well. I'm going to to use MultiMC because it works all 3 major operating systems and makes creating Minecraft instances with the exact versions and mods you want so easy.

Here goes ./gradlew build

[20:08:03] [Client thread/INFO] [examplemod]: DIRT BLOCK >> minecraft:dirt

Perfect! At this point, let's calls this version 0.1.0

This post was created as part of the README for my Panda's mod, but given my habit of not completing things I thought I'd share this part here in case it helped others. Thoughts and feedback welcome.

Discussion

pic
Editor guide
Collapse
alfanzain profile image
alfanzain

Mumbling mumbling no screenshot of the result.

Collapse
drazisil profile image
Joe Becher Author

Fair complaint. It does exactly nothing yet, what would you like a screen shot of? 😊

Collapse
rachelsoderberg profile image
Rachel Soderberg

I would like to see a screen shot of nothing, then!!! /sarcasm

Thread Thread
drazisil profile image
Thread Thread
alfanzain profile image
alfanzain

that is what I'm talking about! :3

Thread Thread
rachelsoderberg profile image
Rachel Soderberg

I am pleased :D