Skip to content

Commit 0622131

Browse files
Merge pull request #44 from CodeMonkeysMods/feat/add-items
feat: add furnace recipe
2 parents e98c120 + 90f08e6 commit 0622131

1 file changed

Lines changed: 31 additions & 13 deletions

File tree

src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@
1313
import net.minecraft.core.HolderLookup;
1414
import net.minecraft.data.recipes.RecipeOutput;
1515
import net.minecraft.data.recipes.RecipeProvider;
16-
import net.minecraft.tags.BlockTags;
1716
import net.minecraft.tags.ItemTags;
18-
import net.minecraft.world.item.ItemStack;
1917
import net.minecraft.world.item.Items;
2018
import net.minecraft.world.item.crafting.CraftingBookCategory;
21-
import net.minecraft.world.item.crafting.Ingredient;
2219

2320
public class ModRecipeProvider extends FabricRecipeProvider {
2421
/**
@@ -32,25 +29,32 @@ public ModRecipeProvider(FabricDataOutput output, CompletableFuture<HolderLookup
3229
}
3330

3431
/**
35-
* Creates a RecipeProvider that registers the mod's recipe set: a campfire cooking recipe
36-
* that cooks a porkchop into a cooked porkchop, a furnace cooking recipe that converts a
37-
* porkchop into an acacia boat, and a workbench crafting recipe that assembles a chest from
38-
* logs and sticks.
32+
* Create a RecipeProvider that registers the mod's recipe set to the provided exporter.
3933
*
40-
* Each recipe includes its unlock condition, crafting category, book category, processing time,
41-
* and is saved to the provided exporter under the mod-specific paths:
42-
* "campfire_pork_cooking", "furnace_pork_cooking", and "workbench_wood_chest".
34+
* <p>The produced provider registers these recipes:
35+
* - Campfire pork cooking: cooks a porkchop into a cooked porkchop and is saved as "campfire_pork_cooking".
36+
* - Workbench recipes:
37+
* - Armorers workbench (produces the armorers workbench block) saved as "workbench_armorers_workbench".
38+
* - Furnace workbench T1 (produces the furnace workbench T1 block) saved as "workbench_furnace_workbench_t1".
39+
* - Wood chest (crafts a chest from logs) saved as "workbench_wood_chest".
40+
* - Furnace T1 ingot: smelts copper ore into a copper ingot and is saved as "furnace_t1_copper_ingot".
4341
*
4442
* @param registryLookup provider for looking up game registries and tags used when building recipes
4543
* @param exporter destination used to write the generated recipe JSON files
46-
* @return a RecipeProvider that produces and saves the described recipes to the exporter
44+
* @return a RecipeProvider that generates and saves the described recipes to the exporter
4745
*/
4846
@Override
4947
protected RecipeProvider createRecipeProvider(HolderLookup.Provider registryLookup, RecipeOutput exporter) {
5048
return new RecipeProvider(registryLookup, exporter) {
5149
/**
52-
* Registers three mod-specific recipes with the recipe exporter:
53-
* a campfire pork cooking recipe producing cooked porkchop (unlocked by having a porkchop, saved as "campfire_pork_cooking"), a furnace pork cooking recipe producing an acacia boat (unlocked by having a porkchop, saved as "furnace_pork_cooking"), and a workbench recipe that crafts a chest from 5 logs and 10 sticks (unlocked by having logs, saved as "workbench_wood_chest").
50+
* Register the mod's recipes with the recipe exporter.
51+
*
52+
* <p>Registers the following recipes and their unlock conditions, categories, and export names:
53+
* - Campfire: porkchop → cooked porkchop (unlock: has porkchop; category: MISC; saved as "campfire_pork_cooking").
54+
* - Workbench (Armorers): 2 copper ingots, 10 logs, 5 stone tool materials → armorers workbench (unlock: has workbench; saved as "workbench_armorers_workbench").
55+
* - Workbench (Furnace T1): 6 logs, 6 stone tool materials → furnace workbench T1 (unlock: has workbench; saved as "workbench_furnace_workbench_t1").
56+
* - Workbench (Chests): 10 logs → chest (unlock: has logs; category: MISC; saved as "workbench_wood_chest").
57+
* - Furnace T1 (Ingots): copper ore → copper ingot (time: 10; unlock: has copper ore; saved as "furnace_t1_copper_ingot").
5458
*/
5559
@Override
5660
public void buildRecipes() {
@@ -65,6 +69,8 @@ public void buildRecipes() {
6569
.save(exporter, "campfire_pork_cooking");
6670

6771
// Workbench Recipes
72+
73+
// 1. Workbenches
6874
new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER)
6975
.input(Items.COPPER_INGOT, 2)
7076
.input(ItemTags.LOGS, registryLookup, 10)
@@ -74,6 +80,16 @@ public void buildRecipes() {
7480
.bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH)
7581
.save(exporter, "workbench_armorers_workbench");
7682

83+
new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER)
84+
.input(ItemTags.LOGS, registryLookup, 6)
85+
.input(ItemTags.STONE_TOOL_MATERIALS, registryLookup, 6)
86+
.output(ModBlocks.FURNACE_WORKBENCH_BLOCK_T1.asItem())
87+
.unlockedBy("has_workbench", has(ModBlocks.WORKBENCH_WORKBENCH_BLOCK.asItem()))
88+
.bookCategory(ModRecipeDisplay.WORKBENCH_SEARCH)
89+
.save(exporter, "workbench_furnace_workbench_t1");
90+
91+
92+
// 2. Chests
7793
new WorkbenchRecipeBuilder(ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER)
7894
.input(ItemTags.LOGS, registryLookup, 10)
7995
.output(Items.CHEST)
@@ -83,6 +99,8 @@ public void buildRecipes() {
8399
.save(exporter, "workbench_wood_chest");
84100

85101
// Furnace Recipes
102+
103+
// 1. Ingots
86104
new WorkbenchRecipeBuilder(ModRecipes.FURNACE_T1_TYPE, ModRecipes.FURNACE_SERIALIZER)
87105
.input(Items.COPPER_ORE)
88106
.output(Items.COPPER_INGOT)

0 commit comments

Comments
 (0)