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:47] – Added recipe category 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(RecipeCategory.BUILDING_BLOCKS, | + | 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.1685987224.txt.gz · Last modified: 2023/06/05 17:47 by mcrafterzz