Minecraft Modding – Setting Up Your Environment in Windows 10, Minecraft 16.4

minecraft

What is a “mod”?

Simply put, it’s a modification of the underlying code that runs the Minecraft game on your PC.  It allows developers to create new items, blocks, characters, etc. inside the Minecraft environment.  It is also perfectly legal and encouraged by Mojang (the game developers) in their licensing agreement:  “If you’ve bought the Game, you may play around with it and modify it.”

My Environment

Windows 10 64 bit; Minecraft 1.16.8 Java Edition  (Note: the latest version available for Minecraft Forge is 1.16.4)

Click here if you’d rather watch a full video of the installation..

There are four steps which I’ll describe in sections below:

  1. Install and set up Java
  2. Install Eclipse
  3. Install and configure Minecraft Forge
  4. Configure Eclipse environment

*It is assumed that you already have Minecraft 1.16.8 Java Edition installed on your PC.

(For modding Windows 8.1 64 bit; Minecraft 1.8.8)

Install and set up Java

Java is the programming language that we’ll use to make modifications to Minecraft.

AdoptOpenJDK makes it really easy to install JAVA without worrying about your environment variables on your Windows machine. Click on the link and choose ‘Open JDK 8’ and leave ‘HotSpot’ as the selected JVM:

JDK Screenshot

Click the Latest Release button and the executable file will be downloaded to your local machine. Open and run this file with all of the default settings.

Install Eclipse

Eclipse serves as the Development Environment for your Java code.  It provides built-in features that make programming much easier. Download Eclipse

I chose the Eclipse Installer package and chose the Windows x86_64 version. (Note: the installer will also install an updated version of Java which will cause errors with our Forge build. We will show you how to change that later)

Once that file has downloaded double-click on the file to run the Installer. When the installer loads, choose “Eclipse IDE for Java Developers” and click Install.

Install and configure Minecraft Forge

“Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other.”  It helps us create mods better and faster.  I spent a lot of time finding the correct files to download so my time spent is time saved for you.  Here’s the download link.  Find the ‘Download Recommended’ area on the right and click on the ‘Mdk’ button.


Be careful, the next screen will display a “Download” button in the middle of the screen.  It’s actually an ad and will download adware to your computer.
 Wait 5 seconds and a ‘Skip’ button will be displayed at the top right. Click on the ‘Skip’ button. This will download the mdk as a .zip file.

Right-click on the .zip file in Windows Explorer and ‘Extract All…’. Choose a folder where the files will be extracted. Mine is C:\MinecraftModding.  A window will popup showing you the contents of the extracted folder:

 

 

Configure Eclipse Environment

Last step and you should be ready to go.  By default, Eclipse should have installed a shortcut on your desktop. Double-click this icon or do a search for ‘Eclipse’ in the windows search bar to open Eclipse.

Eclipse will ask you to select a workspace.  Leave this as the default or choose your own Workspace. Make sure that you do not choose the same folder as the Forge extract above. Click Launch.

eclipse setup

Click on the ‘x’ next to Welcome to close the initial tab.

 

From the top menu click File->Import. Choose ‘Gradle->Existing Gradle Project’

Click Next twice and you will be asked to choose the ‘Project Root Directory’. Choose the folder where we extracted all of the Forge files above. Mine was C:\MinecraftModding.

Click Finish. This will take a few moments.

By default my Project Explorer didn’t show up in Eclipse. Click on the small icon on the left side of the screen to view the contents of the Project:

We need to run a Gradle task to setup our Forge project. If you don’t see a Gradle Tasks tab on your screen click on the small magnifying class in the upper right hand corner and type ‘Gradle Tasks’ in the search box.

You should see a list of Gradle Tasks for the project. Choose fg_runs and genEclipseRuns:

Double-click this task. An output window will appear with run times.

*Note: I ran into an issue with the downloadAssets tasks that kept giving an error. I resolved this by temporarily disabling Windows Firewall. It was preventing some of the files from downloading properly.

Once those tasks have completed, click File->Import->Run/Debug->Launch Configurations from the top menu in Eclipse.

Click Next.

Next to From Directory, choose the “Browse…” button and choose your MinecraftModding folder. Make sure your project is checked on the left column and you should see three launch configurations on the right: runClient.launch, runData.launch, and runServer.launch.

Make sure all are selected and click Finish.

Now we need to setup our Run Configurations. Click on the small black down arrow next to the Run button at the top of the Eclipse environment and choose “Run Configurations”:

In the left column, choose Java Application and runClient.

Click on the Environment tab on the right and make sure MC_VERSION is listed as 1.16.4:

 

Click Run at the bottom.

Note: if you’ve followed the steps above directly, you will receive this error:

Exception in thread “main” [09:02:55] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: java.lang.NoClassDefFoundError: jdk/nashorn/api/scripting/NashornScriptEngineFactory

This is related to the latest version of Java being installed with Eclipse. We need to change that.

The easiest way to change that is to click on search magnifying glass in the top of Eclipse and type ‘Preferences->Open the Preferences Dialog’

In the left column choose Java->Compiler and change the Compiler compliance level: to 1.8.

Choose Apply at the bottom of the Compiler section.

A prompt will ask you to Rebuild with the new settings. Click No.

We also need to change the Installed JREs. Click Installed JREs in the left column. You should see a long path listed. This is the JRE installed with Eclipse. We need to add the AdoptOpenJDK 8 that we installed at the very beginning.

Click on the Add… button. Click Next.

From this screen we need to set the JRE home: to the folder for AdoptOpenJDK install folder from above. Mine was C:\Program Files\AdoptOpenJDK\jdk-8.0.275.1-hotspot

Click Finish.

Make sure the correct JRE is selected and click Apply and Close at the bottom.

Click on the Run button at the top of Eclipse to run your project again.

 

Your project will now build and Minecraft should launch. You will see some information about Forge down in the left-hand corner.

You’ve done it! Your Windows 10 environment is now setup to create Minecraft Mods in Forge for 1.16.4.