Recipe Type (Furnace) – Architectury API Multiplatform Modding

In the last part I showed you how to create a custom furnace block, in this part we’re going to add a custom recipe type for our Ruby Furnace. The process I show is similar to fully custom recipe types, although there you need to implement more of the recipe handling yourself.

Additional Resources

The Tutorial Mod used here can be found on GitHub (state after this tutorial).
A video version can be found below.

Contents

  1. Creating the Recipe Class
  2. Registering the recipe type for our class
  3. Registering a serializer for our class
  4. Adding a recipe to our type
  5. Minecraft
  6. Video

Creating the Recipe Class

The first thing we need to do is creating a class for our recipe. Since we will be adding a recipe for our Ruby Furnace, we can use AbstractCookingRecipe as our superclass. This has the benefit of already handling some things for us, that are related to the interaction with a furnace-type block. In our class we then need to implement 4 methods next to the constructor:

In the constructor we can simply pass through all the arguments. Next we need to implement the getSerializer() method. The serializer tells the game how to interpret the recipe JSON-Files we will create later. I show you how to define this serializer later. Additionally we need to return our recipe type in the getType() method. We will register this also later. Next we need to implement the recipeBookCategory() method. The return value of this method determines the recipe book category this recipe shall be listed in. Since we don’t have a custom category for our Ruby Furnace, we use the regular furnace categories here. Finally we need to return the furnaceIcon(), which is the icon associated with our recipe type. This icon may be shown for example by recipe mods.

Registering the recipe type for our class

Next we are going to register a recipe type for our class. Similar to everything else we needed to register so far, we again use a DeferredRegister to register things to the game. In our case the class looks like this:

The RegistrySupplier RUBY_SMELTING is the one we used in our recipe class to return the recipe type. The two strings “ruby_smelting” highlighted in bold specify the name we later need to specify in our recipe JSON-Files. Make sure to call the initRecipeTypes() method from inside of your common mod init() method so that everything is registered properly.

Registering a serializer for our class

As explained above we also need to register a RecipeSerializer for our recipe type. We do this in a very similar way to the type as shown above, the class looks like this:

Again the RegistrySupplier we define here is the one we return inside our recipe class. We also need to specify the same name we used for our recipe type again when registering our serializer. Inside the constructor we need to pass the constructor of our recipe class. Furthermore we need to pass the default cooking time for our recipes, here 70 ticks (3.5 seconds). Again you need to make sure to call the initRecipeSerializers() method from your mods common init() method.

Adding a recipe to our type

Before we now add a recipe to our type, we want to actually use it inside of our Ruby Furnace. For this you need to replace the call of the superconstructor inside of our constructor with the following:

With that the game now knows to use our new type. We now need to add some recipes so that our furnace can actually process some items. Similar to default recipes we need to head to our recipe data folder resource/data/<modid>/recipe/ and create a .json-File there. The json definition for our custom Ruby Furnace recipe looks like this:

The only key difference to a regular furnace recipe is the different type at the beginning, everything else is identical, although we don’t specify a cooking time here, as we want to use the default one we specified in our code.

Minecraft

With that we have everything we need and can jump into the game to see if everything works:

Ruby Furnace Block GUI processing a recipe

Video

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

Related Content

Check out the entire series here.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top