Minecraft MOD Add Recipes for 1.12.2

TOP > Tutorial list > Minecraft MOD Add Recipes for 1.12.2


posted 15 May 2018

This time is the tutorial of source for Minecraft JE 1.12.2.

In 1.12.2, there was a large specification change, such as moving the Crafting Table recipes to the resource. I will explain how to add recipes in 1.12.2 while watching ChinjufuMod’s source.

The source of ChinjufuMod is released on GitHub. If you are interested please visit there.

 

1. Crafting Table recipes to add in resources

In Minecraft 1.12.2, Crafting Table recipes are written in .json files and are included in resources.

Recipes are resources, so items and blocks are linked with RegistryName or UnlocalizedName. By the way, ChinjufuMod is using sources such as ‘ModelResourceLocation (item.getRegistryName (),” inventory “)’, and they are linked by RegistryName.

If there are many additional elements, it is good to copy and paste the .json file of the item package and rewrite it for recipe.

 

1-1. Add Shaped Recipes

First of all, it is a tutorial of Shaped recipes.

Not only the material used for craft, but also recipe that instructs the shape to be placed on the Crafting table is called a Shaped recipe. The Shaped recipe in 1.12.2 has the following source.

・Steel block
 recipes/block_steel_block.json

Shaped Recipe. Steel Block

・Empty box
 recipes/block_empty_box.json

Shaped Recipe. Empty box

“type”:・・・Announcement of recipe type, this time shaped
“group”:・・・Used for classification in the recipe book
“pattern”:・・・Indicate shape to put in 3 x 3 slots. Half spaces where nothing is placed
“key”:・・・Material corresponding to the alphabet used in “pattern”
“item”:・・・Material item. Block also handles as ItemBlock so instruct with item:
“data”:・・・Used when there are metadata values such as wood, logs, wool, etc.
“result”:・・・Instruct what can be done with craft
“count”:・・・Quantity of what can be done with craft

 

1-2. Add Shapeless Recipes

Next, it is a tutorial of Shapeless recipes。

A shapeless recipe is a recipe that instructs only the material of the craft and does not instruct the shape to put on the Crafting table.

・Raw beef hamburg
 recipes/item_kiji_burg.json

Add Shapeless Recipes Raw beef hamburg

“type”:・・・Announcement of recipe type, this time shapeless
“group”:・・・Used for classification in the recipe book
“ingredients”:・・・Instruct craft materials
“item”:・・・Material item. Block also handles as ItemBlock so instruct with item:
“data”:・・・Used when there are metadata values such as wood, logs, wool, etc.
“result”:・・・Instruct what can be done with craft
“count”:・・・Quantity of what can be done with craft

 

1-3. About special recipes

Some of the Crafting table recipes include the following special ones.

 

1-3-1. Recipes that consume durable values of an item

If you are thinking a craft that is close to real, such as knives for cutting vegetables or seasoning with bottles, you may want to make items that will reduce the durability value and capacity each time you repeat the craft. In such a case, it is a recipe that consumes durability values.

Writing in the recipe is to “consume the durable value of the item”. It is necessary to describe the maximum value of durable and process which consumes the durability value even in the Class.

In ChinjufuMod, I am consuming papers and durable values of Admiral Stamp_item, and I use it in a recipe that crafts Craft order (item_workorder).

・Craft order
 recipes/item_workorder.json

Recipes that consume durable values of an item. Craft order

By “data”: 32767, it becomes a recipe that consumes the durability value of the material.

 

1-3-2. Recipe using Ore dictionary

Aluminum, Tin, Sapphire, etc. there are many Mod to add material items to Minecraft. On the other hand, there is also Ore dictionary that makes these material items share.

Therefore, there are descriptions in the recipe using Ore dictionary as follows.

・Frying pan
 recipes/block_food_frypan.json

Recipe using Ore dictionary. Frying pan

By describing the material as {“type”: “forge: ore_dict”, “ore”: “ingotAluminium”}, it becomes a recipe using the Aluminum ingot of Ore dictionary.

Writing in the recipe is only to use “XYZ in Ore dictionary as a material”. Therefore, in order to register material items to be added in your MOD to Ore dictionary, you need to write separately in the Class.

 

1-3-3. Recipes with different pattern in the material item

Like a Chest that can be crafted with oak wood or birch wood, it is also possible to make a recipe that has different patterns in the material item.

SHIMENAWA, KAGAMIMOCHI and KADOMATSU of ChinjufuMod have different patterns in the material item, because the implementation of material items was delayed.

・KAGAMIMOCHI
 recipes/block_kagamimochi.json

Recipes with different pattern in the material item. KAGAMIMOCHI

In KAGAMIMOCHI, there are two patterns of using wheat and using rice. In the source I write “X”: [{“item”: “minecraft: wheat”, “data”: 0}, {“item”: “chinjufumod: item_kome”, “data”: 0}].

 

2. Shaped recipes to add in Classes

The recipe of 1.12.2 is basically added in resources, but it can be added in classes as well.

In ChinjufuMod, there are recipes that craft items of vanilla, and these are described by Classes.

As an example, I will take a recipe for making clay from grass blocks and a recipe for making an iron ingot from cartridges.

CraftingChinjufuMod.java

Shaped recipes to add in Classes. Cartridge to Iron ingot

RecipeHandler.java

ChinjufuMod.java

※Shapless recipes are omitted. Because the sources become complicated, and I am not using even at the ChinjufuMod.

 

3. Smelting recipes using a furnace added in Classes

Next is a tutorial to add Smelting recipes that you used in a furnace.

For Smelting recipes, you will add them in classes.

In the source you write material and smelted item, experience value gotten in smelting. If you want to include amount and metadata values for items, write them using a comma like (item, amount, metadata value).

As an example, I take up the recipe that Match becomes Bone meal and the recipe that Modeled clay_CHAWAN becomes CHAWAN.

SmeltingChinjufuMod.java

Smelting recipes using a furnace added in class. CHAWAN

RecipeHandler.java

ChinjufuMod.java

 

Summary

From 1.12.2 we started using resources to add recipes, so the tutorial also got longer.

I think that there are not many opportunities to use for adding Crafting table recipes by Classes. Let’s get used to how to add Crafting table recipes to add using resources and how to add Smelting recipes to add using Classes.

Regarding how to write the source, the place where ChinjufuMod is breaking new lines is different from that of vanilla.

minecraft/recipes/acacia_door.json

Description in vanilla 

{
   ”type“: “crafting_shaped”,
   ”group“: “wooden_door”,
   ”pattern“: [
      ”##“,
      ”##“,
      ”##
   ],
   ”key“: {
      ”#“: {
      ”item“: “minecraft:planks“,
      ”data“: 4
   }
   },
   ”result“: {
      ”item“: “minecraft:acacia_door“,
      ”count“: 3
   }
}


My description method

{
   ”type“: “crafting_shaped”,
   ”group“: “wooden_door”,
   ”pattern“: [
      ”##“,
      ”##“,
      ”##
   ],
   ”key“: {
      ”#“: { item“: “minecraft:planks“, data“: }
   },
   ”result“: { item“: “minecraft:acacia_door“, count“: }
}

Since Minecraft does not care much about the line breaks in the source, I prioritize my habit of “I am more readable”. In MOD production, I think that it will be easier to handle the source, by changing the position of line break and annotating it.


このチュートリアルは参考になりましたか? シェアはこちらをご利用ください。
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

¥
Personal Info

Terms

Donation Total: ¥100

MONAで投げ銭をする MONA donations
MONAで投げ銭をする MONA donations. tipmonaとは?

コメントを残す

メールアドレスが公開されることはありません。

コメント

お名前

ウェブサイトURL

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください