User Tools

Site Tools


tutorial:cooking_recipe_type

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tutorial:cooking_recipe_type [2021/01/01 08:35] – This is just a minor revision due to some problems with registering the serializer programmingpenguinmctutorial:cooking_recipe_type [2022/02/07 12:40] – some typos fixed redgrapefruit
Line 3: Line 3:
 ====== Creating a custom cooking recipe type ====== ====== Creating a custom cooking recipe type ======
  
-Creating a cooking recipe type is just like creating a custom recipe type with extra steps. Vanilla minecraft has abstracts classes for furnaces and cooking recipe type so we'll use them to save some time and code! +Creating a cooking recipe type is just like creating a custom recipe type with extra steps. 
-If it is your first time creating a container block you should go check this tutorial before: [[tutorial:screenhandler]]+Vanilla minecraft abstracts classes for furnaces and cooking recipe types so we'll use them to save some time and code! 
 +If it is your first time creating a container blockyou should go check this tutorial before: [[tutorial:screenhandler]]
  
 The final result of this tutorial can be found here: https://github.com/Legorel/CookingRecipeExample The final result of this tutorial can be found here: https://github.com/Legorel/CookingRecipeExample
  
 ===== Adding the Block and BlockEntity===== ===== Adding the Block and BlockEntity=====
-First we need or furnace, for this our class will extends ''AbstractFurnaceBlock''. Some of the classes will be created later :+First we need our furnace, for this our class will extends ''AbstractFurnaceBlock''. Some of the classes will be created later :
  
 <code java TestFurnace.java> <code java TestFurnace.java>
Line 124: Line 125:
 ===== Creating the recipe serializer ===== ===== Creating the recipe serializer =====
  
-This is where it get different from a normal recipe type, you can make your own serializer if your furnace works differently from vanilla one or just register a new ''CookingRecipeSerializer'' to save some code :+This is where it gets different from a normal recipe type, you can make your own serializer if your furnace works differently from vanilla one or just register a new ''CookingRecipeSerializer'' to save some code :
  
 <code java CookingRecipeExample.java> <code java CookingRecipeExample.java>
Line 133: Line 134:
     static {     static {
         [...]         [...]
-         +        TEST_RECIPE_SERIALIZER = Registry.register(Registry.RECIPE_SERIALIZER, new Identifier(MODID, "test_furnace"), new CookingRecipeSerializer<>(TestRecipe::new, 200));
-        //You have to use RecipeSerializer.register for multiple recipes instead of the Registry.register method +
-        TEST_RECIPE_SERIALIZER = RecipeSerializer.register(MODID, "test_furnace", new CookingRecipeSerializer(TestRecipe::new, 200)); +
- +
-        +
     }     }
 } }
tutorial/cooking_recipe_type.txt · Last modified: 2022/02/07 12:40 by 127.0.0.1