TOP > Tutorial list > Minecraft MOD Add Custom Item for 1.12.2
updated 27 April 2018 – posted 18 April 2018

This time is the tutorial of source for Minecraft JE 1.12.2.
There are two kinds of items of Minecraft.
・Items with Class · · · Pickle and Sword etc.
・Items without Class · · · Wood sticks and Ingots etc.
About each addition method, I will explain while watching the source of ChinjufuMod.
There are points to note about the source posted in the link in the article. In order to avoid confusion of explanation, I deleted unnecessary sources.
The source of ChinjufuMod is released on GitHub. If you are interested please visit there.
1. Add an Item with Class
First of all, let’s take a tutorial about adding an item that has a class (= design drawing of an item etc). I use ‘CHAWAN’ of CHinjufu MOD as an example.
1-1. Image of classes relationship
In ChinjufuMod[1.12.2], the classes for adding items are divided for each role. Each classes make relationship like the image by using reference.
Well, in 1.10.2, I created a relationship to put together everything in ChinjufuMod.java which instances of MOD. However, in 1.12.2, items are registered by using RegisterEvent. For that reason, I am changing to a form like the image above.
I think that it can be done in a form similar to 1.10.2, but I feel that it is easier to use RegisterEvent.
Also, the 1.12.2 recipes move to resources. RecipeHandler.java and CraftingChinjufuMod.java, which you do not use much, are dotted lines.
1-2. 10 sheets is a results of division for each role
The roles of each class are as follows.
ChinjufuMod.java | Create an instance of Mod |
Reference.java | Management of frequently referenced values |
ProxyInterface.java | Promises methods to handle in CommonProxy |
CommonProxy.java | Processing on server |
ClientProxy.java | Processing on client |
RegistrationHandler.java ※The link is described in 1-3 |
Register items and register items rendering |
TTimeItems.java | Manage items registration |
ItemChawan.java | Design of individual item |
RecipeHandler.java | Manage recipes ※1.12.2, you don’t use much |
CraftingChinjufuMod.java | Design of individual recipe ※1.12.2, you don’t use much |
First time Minecraft MOD producer may think that “Do you use 10 sheets?”. Also, if you want to do so, it is also possible to combine it into one sheet.
However, if you think about adding some items, it is easier to divide the class for each role.
1-3. Actual classes relationship and link to each source
In ChinjufuMod, to make it easier to manage the source, I am writing like the image.
The source is on the links of the image map. Recommend maximize the window.
To add an explanation, I am doing these things.
・Partitioned RegistrationHandler.java handling RegisterEvent.
・The part that registers items is the inner class of TTimeItems.java.
・The part that registers item rendering is the inner class of ClientProxy.java.
About the inner class, I think that it is easier to understand if you look at the source that posted on the link.
2. Add some Items
Next, there is a tutorial when there are multiple items to be added.
‘CHAWAN’ of the Chinjufu MOD burns ‘Modeled clay_CHAWAN’ and makes it. So, I will add ‘Modeled clay_CHAWAN’ here.
2-1. Classes relationship and link to each source
When you add some items, the relationship of the classes looks like the image in ChinjufuMod[1.12.2].
The source is on the links of the image map. Recommend maximize the window.
If you divide the class for each role in advance, only the 2 classes that changed red when new items are added. You do not have to touch others.
On the other hand, If you do not use references, you will need to write duplicate code in each classes.
3. Add an Item without Class
Next, let’s take a tutorial about adding an item without a class (= design drawing of an item etc). I use ‘Flour(KOMUGI)’ of Chinjufu MOD as an example.
3-1. Classes relationship and link to each source
In ChinjufuMod[1.12.2], the classes for adding items are divided for each role. Each classes make relationship like the image by using reference.
The source is on the links of the image map. Recommend maximize the window.
Summary
If you do a test after the tutorial so far, it should be like a image.
About what I changed to the way to use RegisterEvent.。
Initially, I was also looking for a method that traced 1.10.2 which I am accustomed to. However, because the register of Minecraft was changed, it worked on the client, but it did not work on the server.
Then I found the way of using RegisterEvent. I was able to confirm that it will work on multi server at once.
At the time of development, I heard “Minecraft 1.13 will come out”, I thought that releasing the 1.12.2 version was too late after 1.13 came out. Therefore, ChinjufuMod [1.12.2] is changing to a method using RegisterEvent which can be adopted immediately.
My position is that “What I release has meaning to be used by users.”. So, I think that it is necessary to judge “if it works, it is OK”
このチュートリアルは参考になりましたか? シェアはこちらをご利用ください。
Was this tutorial helpful? Please use here for market share.
当サイトは年間6,480円のサーバー代がかかるため、投げ銭をしてもらえると助かります。
This site costs 6,480 yen per year for server fee. It will be helpful if you make a donation.
Bitcoinで投げ銭をする Bitcoin donations
MONAで投げ銭をする MONA donations
