[Java] [Java] Create a Minecraft Mod 1.14.4 [Introduction]

7 minute read

TL;DR

・I want to create something that has a “moving” feeling ・Let’s try the popular game Minecraft MOD creation! ・It’s ideal because it’s surprisingly easy** to create graphical things! ・Let’s actually make a tutorial ・I want the neighborhood to become more exciting (actual)

(This article is a series of introduction articles)

Introduction

Hello everyone! Do you enjoy writing the code? Congratulations to anyone who has enjoyed writing! great! Much… welcome to everyone! Please read the article and find new excitement.

In a series of articles, I’d like to introduce you to making mods for Minecraft, which is a super popular game that you should know.

Unknown person A game where you can survive, build buildings, and live freely in a world made up of cubic blocks. Developed by Mojang. ([Official](https://www.minecraft.net/ja-jp/about-minecraft))

What is

<summary>MOD? </summary> Abbreviation for Modification. Mod. Remodeling data mainly used in PC games. Although it may seem like a little rephrasing in Japanese, it is a more popular culture [source] overseas as users participate in the game to liven up the game. Please be assured that the use of mods is [officially allowed] in Minecraft (https://www.minecraft.net/ja-jp/terms/r3/#4-minecraft-java-edition).

Capture.PNG Capture2.PNG ** Various new mods are adding new things **

I think some people may feel that “It’s difficult to make a game…”, but in reality, making a mod is “introducing something that moves in the game”, so I do not make a game* *It’s not as difficult as you think**. I think it’s important that you try it first without touching yourself. Also, in this article, I intend to write carefully in a manner that is kind to beginners (please feel free to ask questions if you do not understand them!).

The goal is to create a tutorial-like mod for the first time from 0, and actually introduce it to Minecraft. The goal is to get a clear idea of what to do for the mod you want to create when you finish.

Finally, before moving on to a comment, let me mention a few important points. First of all, when working on Modding, please be sure to check your development environment and the version of Minecraft itself and Minecraft Forge (see below) on the reference site. Different versions have different (and sometimes very different) implementations. Unfortunately, I can only share my knowledge of Modding in one not so new version here. Unless you have a definite goal, we recommend this as it suits the environment in this article and avoids unnecessary trouble. Secondly, I’m sorry to unplug the ladder, but very unfortunately, I can’t say that the reference material for Mdding in Minecraft is complete at all. Especially **There are almost no Japanese materials. Therefore, I find it difficult to find what I want to know, so I think it may be difficult. I will write the tips etc. in such a case in another article, but the problem solving ability is also a skill of the engineer, so please do your best. And hopefully (including this article)** Please keep a record of your findings! ** Even if you treat the same thing, it’s worth rehashing in your own words. It will help someone someday. And third, I’m a beginner to explain Java, so please be aware that it may be inaccurate regarding the language.

The introduction is long, but let’s start Modding from the next section!

Environment

Environment

First, prepare a development environment. This article uses the following versions of tools.

| tool / library | version | |:-:|:-:| | OS | Winsows 10 Home | | JDK | 8u212 | | Minecraft | 1.14.4 | | Minecraft Forge | 1.14.4 (28.1.0) | | InteliJ IDEA | 2020.1.3 (CE) | I’m using a fairly old version of each, including the version of Minecraft, but this is because I did it in the same environment as the reference article. You can use a newer version if you need it (if you are confident), but you should handle compatibility issues yourself. Also, please read the article on the assumption that some or all of the following statements do not apply.

JDK (Java Development Kit)

Minecraft (Java edition) runs on Java, so a Java development environment is required. After agreeing to the terms, download here. Capture.PNG (It’s quite below)

However, since you need Oracle profile (account) for downloading, if you don’t have it (or maybe not, create one). men d When registering, you will be asked to enter the company name and department, but if you are a student, you may use “student” as the department/position, the school name as the company name, and the school address as the address.

Run the downloaded exe to install.

InteliJ IDEA

Next, get the integrated development environment. After agreeing to the terms, download from here.Capture.PNG

Run the downloaded exe to install. It’s a hassle to install it again, so I can’t show the detailed screen (I’m sorry), but basically there is no need to change anything. The initial setting screen will appear when you start up for the first time, but this is also appropriate. You may turn off the provision of data for improving functions.

Also, the language is English by default, so let’s make it Japanese (→Reference Article). After that, I will proceed with the story as Japanese.

Minecraft Forge MDK

Finally, you will get the Minecraft Forge Development Kit, which is the de facto standard prerequisite mod in Minecraft Mod area. Forge is an API that comprehensively provides various functions used when developing and introducing Mods. After agreeing to the terms, download here. Capture.PNG I think maybe Recommended (or better) is recommended, but as mentioned above, I will adapt the version to the reference article. Click the Show all Versions button at the bottom to expand it. Capture2.PNG Download the appropriate Mdk. Unzip the downloaded Zip file.

Create a project folder in any location (for example, D:\projects\mc_example_mod, and replace the path as needed). Copy the following items from the Forge folder that was expanded earlier to the project folder. (You may copy the extracted folder or rename it and use it as it is. README etc. are excluded here.)

D:\projects\mc_example_mod
├ build.gradle
├ gradlew
├ gradlew.bat
├ gradle
│ └ wrapper
│ └ gradle-wrapper.jar
│ └ gradle-wrapper.properties
└ src
└ main
├ java
│ └ com
│ └ example
│ └ examplemod
│ └ ExampleMod.java
└ resources
├ META-INF
│ └ mods.toml
└ pack.mcmeta

Execution configuration

Create a run configuration for IntelliJ IDEA. Start PowerShell, change to the project directory, and execute the following command.

PS D:\projects\mc_example_mod> .\gradlew genIntellijRuns

When BUILD SUCCESS FUL is displayed, you are done. It will take a long time, so be patient.

Import Gradle project

Start Intel iJ and click “Open” to open the project directory. You will be prompted to “Import Gradle Project” in the popup notification at the bottom right or the event log at the bottom. Click this.

If you miss a notificationOpen the search for actions with ctrl+shift+"a", search for "Import Gradle Project" and select it.

In the window that opens, click “OK” without making any changes. Wait for the import to start. When finished is displayed and the import is completed, I think Gradle is displayed on the right side of the screen.

Start-up

Right-click on mc_example_mod\Tasks\fg_runs\runClient from the Gradle menu -> run, and finally Minecraft that is displayed for debugging instead of the familiar Minecraft screen … starts. Capture.PNG Capture.PNG Capture2.PNG

**Congratulations! !! You are a great Modder! **

Summary

First of all, I introduced the preparation of the development environment as a preliminary preparation. Finally, I will proceed with mod creation, but if you write everything, the article will be too long, so I will write a separate article for each topic. I will link to each article one by one, so I hope you will read them one by one in order.

Digression

folding
Actually, I tried Modding before (probably 1.7), but I was frustrated at that time. I felt like I wanted to do something in a moment, but when I met the [reference article](https://qiita.com/Hiroya_W/items/2af8fcacab5feaf880b6), I decided to try again. Because it was written very carefully, this time I was able to learn the basic content without frustration. thank you very much. Well, if you go beyond the basics of the Sutras and try to do something you want to do, you can find articles that could be helpful without finding a tutorial. Moreover, if you notice it, Micra's unofficial Japan forum may be closed. It was a great shock for me as a Micra kids at the time. I think the mod creator was originally a small community, but I felt lonely because I couldn't feel the liveliness of the whole community without a forum. That's why I am writing this article with all my heart. I hope that even one person will be interested in reading this. I'm not really confident of completing the mod, but I think I'd like to play around with it for a while and then publish the completed mod.

Reference article

Minecraft 1.14.4 Forge Mod Part 1 [Preparation of development environment IntelliJ IDEA]

Contents of each explanation

[Introduction] ← Imakoco 0. Basic file 1. Add Item 2. Add Block 3. Add Creative Tab 4. Add Tool 5. Add armor 6. Add recipe 7. Add progress 8. Addition and generation of ore 9. Tree addition and generation 99. Mod output [Extra]

~~Explanation of addition ~~
~~ · Addition of food ・Add tags (separate) ・Addition of features (separation) ・Add Config~~

→ ** The article of 1.14.4 will be written as a commentary article of 1.16.1 as a break. **