tutorial:datagen_recipe
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:datagen_recipe [2023/06/05 17:44] – Change to FabricDataOutput mcrafterzz | tutorial:datagen_recipe [2023/06/05 18:08] (current) – Remove spaces mcrafterzz | ||
|---|---|---|---|
| Line 37: | Line 37: | ||
| @Override | @Override | ||
| protected void generateRecipes(Consumer< | protected void generateRecipes(Consumer< | ||
| - | ShapelessRecipeJsonBuilder.create(SIMPLE_ITEM).input(SIMPLE_BLOCK).offerTo(exporter); | + | ShapelessRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, |
| + | FabricRecipeProvider.conditionsFromItem(SIMPLE_ITEM)).criterion(FabricRecipeProvider.hasItem(SIMPLE_BLOCK), | ||
| + | FabricRecipeProvider.conditionsFromItem(SIMPLE_BLOCK)).offerTo(exporter); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Adding A Shaped Recipe ===== | ||
| + | In this example, we will create a shaped recipe where a stone block is crafted from '' | ||
| + | |||
| + | <code java> | ||
| + | public static Block SIMPLE_BLOCK = Registry.register(Registry.BLOCK, | ||
| + | public static BlockItem SIMPLE_ITEM = Registry.register(Registry.ITEM, | ||
| + | // ... | ||
| + | |||
| + | @Override | ||
| + | protected void generateRecipes(Consumer< | ||
| + | ShapedRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, | ||
| + | .input(' | ||
| + | .input(' | ||
| + | .criterion(FabricRecipeProvider.hasItem(SIMPLE_ITEM), | ||
| + | FabricRecipeProvider.conditionsFromItem(SIMPLE_ITEM)) | ||
| + | .criterion(FabricRecipeProvider.hasItem(SIMPLE_BLOCK), | ||
| + | FabricRecipeProvider.conditionsFromItem(SIMPLE_BLOCK)) | ||
| + | | ||
| } | } | ||
| </ | </ | ||
tutorial/datagen_recipe.1685987058.txt.gz · Last modified: 2023/06/05 17:44 by mcrafterzz