Minecraft Blogs / Tutorial

How to make your first Minecraft mod -- Part 2

  • 1,912 views, 2 today
  • 8
  • 5
barrowisp's Avatar barrowisp
Level 27 : Expert Explorer
35
In case you missed it: How to make your first Minecraft mod -- Part 1

Before we dive in...

Thx to @Acier for reminding me that URL shorteners won't work on PMC, so now I know how to insert images :)
Hi guys, I can't tell whether my attempts to insert screenshots are working. So I recommend you follow the links to my imgur gallery if you're having any difficulty finding the buttons/features I describe.

First steps with Forge

This blog post aims to provide a foolproof walk-through of a few key elements of Forge's tutorial: https://mcforge.readthedocs.io.
Bookmark their page, as it addresses many issues this blog will not. Moreover, there's more than one valid way to achieve the desired result; this post will focus on the simplest, which is probably not the most efficient or elegant. If you follow precisely the steps outlined here, you should soon have a functional mod, which you can then tinker with to your heart's content.
If you use Linux, Forge's tutorial will probably be more useful for you. If you use Windows, read on.

A note about placeholders

This tutorial will use "You" to represent the User profile you are logged in with; if you copy-paste paths from this tutorial, be sure to replace "You" with your own Windows username. This tutorial will use "yournewmod" to represent sections you should replace with the mod name you choose for your project.

1. Create a folder for your project

Navigate to C:/Users/You/Documentsand create a new folder. The name of this folder may be changed easily later. If you're logged in as Guest, the path to your project folder would be:
C:/Users/Guest/Documents/yournewmod

2. Obtain a "source distribution"

Visit https://files.minecraftforge.net and make sure the version selected is 1.12.2. In the large "Download Recommended" box, click on the small MDK box. A dialog box will appear, asking where you want to save the file, and what to name it. Choose any convenient location, but leave the name unchanged.
How to make your first Minecraft mod -- Part 2

3. Copy key files to your project folder

Open the "forge-1.12.2-...-mdk" folder (with or without unzipping it first) and copy-paste the following 5 files from this folder to the project folder you created in the first step:
  • the src folder
  • the gradle folder
  • gradlew
  • gradlew.bat
  • build.gradle

4. Import the gradle project

Open/Run the IntelliJ IDEA program. In the landing screen, click on "Import Project." A dialog box will appear, asking which file to import. Navigate to your project folder and select "build.gradle," then click OK. How to make your first Minecraft mod -- Part 2

5. Designate the JDK

In the next window, click in the "Gradle JVM" field and navigate to the JDK files you installed earlier. If you got version 8 update 212, select the folder named "jdk1.8.0_212." Click OK and wait for the build to finish, displaying the results in the bottom field.
How to make your first Minecraft mod -- Part 2

6. Set up the workspace

IntelliJ has a Project panel on the left, which can be toggled open to show the directory of project files. Now there's also a gradle panel, with an elephant icon. Click to open the gradle panel, and click the triangle next to "Tasks" to expand the list. Then click the triangle next to "forgegradle" and double-click the setupDecompWorkspace entry. Wait a minute or two for the build to finish, then click the Refresh button in the gradle panel.

7. Configure Run settings

After refreshing, double-click the genIntellijRuns entry. After a couple of seconds, open the "Edit configurations" window of Run settings"Edit configurations" window of Run settings and look approximately halfway down, for "Use classpath of module." Click on its dropdown field, and select the option that ends with .main , then click Apply.
If the settings you just finished editing were for the Minecraft Client, click on Minecraft Server and repeat the steps to set the classpath.

You can now Run the client, which will start the Launcher with your mod included. When you get to the landing menu, you can check whether your mod is present.


Hooray? Your mod now exists and is recognized as a mod! The next section will address how to make your mod DO something. :)
CreditThis blog series is nearly identical to the wiki article I'm writing at https://minecraft.gamepedia.com/Tutorials/Creating_Forge_mods
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome