User Tools

Site Tools





  "type": "minecraft:smelting",
  "ingredient": {
    "tag": "minecraft:logs_that_burn"
  "result": "minecraft:charcoal",
  "experience": 0.15,
  "cookingtime": 200



配方类型起作用需要一个 Recipe 类和 RecipeSerializer 类。

Recipe 类定义了输入、输出、如何合成等。创建像木炭的例子的配方时,会创建一个你的 Recipe 类的实例,用于注册配方类型。

RecipeSerializer 用于序列化一个对象(这里是定义一个配方的 Recipe 类的实例)到一个封包(packet),然后从封包或者json对象反序列化到你的 Recipe 类的实例。RecipeSerializer 帮助我们更快地创建配方,而不需要我们自己为我们需要的每个配方实例化我们的 Recipe 类。


To test if different items in an inventory work as inputs of a recipe and get the expected output, we use the RecipeManager class. It has some usefull method such as getAllOfType returning a map of all the recipes of a certain type with their Identifier or getAllMatches returning a List of recipes usable with the inventory of a ScreenHandler.

The easiest way to add a RecipeType is to use some vanilla classes to save a lot of code. An example of this would be all the abstract classes related to cooking. Theses classes are used for the furnace, the smoker, the blast furnace and even the campfire. If your RecipeType behave the same has a vanilla RecipeType you should first try to extends the used classes if they exist(sometime a RecipeType for a block does't have classes that you can use and it is easier to create your RecipeType from scratch).


zh_cn/tutorial/recipe_types_introduction.txt · Last modified: 2023/04/20 11:33 by solidblock