44import cx .rain .mc .toast .generator .utility .Naming ;
55import net .minecraft .core .HolderLookup ;
66import net .minecraft .data .PackOutput ;
7- import net .minecraft .data .recipes .RecipeCategory ;
8- import net .minecraft .data .recipes .RecipeOutput ;
9- import net .minecraft .data .recipes .RecipeProvider ;
7+ import net .minecraft .data .recipes .*;
108import net .minecraft .world .item .Items ;
9+ import net .minecraft .world .item .crafting .*;
1110import net .minecraft .world .level .ItemLike ;
1211import org .jetbrains .annotations .NotNull ;
1312
@@ -44,30 +43,30 @@ protected void buildRecipes() {
4443 .pattern ("III" )
4544 .pattern ("I I" )
4645 .define ('I' , Items .IRON_NUGGET )
47- .unlockedBy ("iron_nugget" , has (Items .IRON_NUGGET ))
46+ .unlockedBy (getHasName ( Items . IRON_NUGGET ) , has (Items .IRON_NUGGET ))
4847 .save (output , Naming .modRecipe ("chainmail_helmet" ));
4948 shaped (RecipeCategory .COMBAT , Items .CHAINMAIL_CHESTPLATE )
5049 .group ("chainmail_armors" )
5150 .pattern ("I I" )
5251 .pattern ("III" )
5352 .pattern ("III" )
5453 .define ('I' , Items .IRON_NUGGET )
55- .unlockedBy ("iron_nugget" , has (Items .IRON_NUGGET ))
54+ .unlockedBy (getHasName ( Items . IRON_NUGGET ) , has (Items .IRON_NUGGET ))
5655 .save (output , Naming .modRecipe ("chainmail_chestplate" ));
5756 shaped (RecipeCategory .COMBAT , Items .CHAINMAIL_LEGGINGS )
5857 .group ("chainmail_armors" )
5958 .pattern ("III" )
6059 .pattern ("I I" )
6160 .pattern ("I I" )
6261 .define ('I' , Items .IRON_NUGGET )
63- .unlockedBy ("iron_nugget" , has (Items .IRON_NUGGET ))
62+ .unlockedBy (getHasName ( Items . IRON_NUGGET ) , has (Items .IRON_NUGGET ))
6463 .save (output , Naming .modRecipe ("chainmail_legging" ));
6564 shaped (RecipeCategory .COMBAT , Items .CHAINMAIL_BOOTS )
6665 .group ("chainmail_armors" )
6766 .pattern ("I I" )
6867 .pattern ("I I" )
6968 .define ('I' , Items .IRON_NUGGET )
70- .unlockedBy ("iron_nugget" , has (Items .IRON_NUGGET ))
69+ .unlockedBy (getHasName ( Items . IRON_NUGGET ) , has (Items .IRON_NUGGET ))
7170 .save (output , Naming .modRecipe ("chainmail_boots" ));
7271
7372 shaped (RecipeCategory .MISC , Items .ENCHANTED_GOLDEN_APPLE , 2 )
@@ -78,25 +77,22 @@ protected void buildRecipes() {
7877 .define ('B' , Items .GOLD_BLOCK )
7978 .define ('E' , Items .ENCHANTED_GOLDEN_APPLE )
8079 .define ('A' , Items .GOLDEN_APPLE )
81- .unlockedBy ("gold_block" , has (Items .GOLD_BLOCK ))
82- .unlockedBy ("enchanted_golden_apple" , has (Items .ENCHANTED_GOLDEN_APPLE ))
83- .unlockedBy ("golden_apple" , has (Items .GOLDEN_APPLE ))
80+ .unlockedBy (getHasName ( Items . GOLD_BLOCK ) , has (Items .GOLD_BLOCK ))
81+ .unlockedBy (getHasName ( Items . ENCHANTED_GOLDEN_APPLE ) , has (Items .ENCHANTED_GOLDEN_APPLE ))
82+ .unlockedBy (getHasName ( Items . GOLDEN_APPLE ) , has (Items .GOLDEN_APPLE ))
8483 .save (output , Naming .modRecipe ("enchanted_golden_apple" ));
8584
8685 shapeless (RecipeCategory .MISC , Items .GLOW_INK_SAC )
8786 .group ("misc" )
8887 .requires (Items .INK_SAC )
8988 .requires (ModTags .Items .GLOWING )
90- .unlockedBy ("ink" , has (Items .INK_SAC ))
91- .unlockedBy ("glowing " , has (ModTags .Items .GLOWING ))
89+ .unlockedBy (getHasName ( Items . INK_SAC ) , has (Items .INK_SAC ))
90+ .unlockedBy ("has_glowing " , has (ModTags .Items .GLOWING ))
9291 .save (output , Naming .modRecipe ("glow_ink_sac" ));
9392
94- oreSmelting (List .of (Items .RAW_IRON_BLOCK ), RecipeCategory .MISC , Items .IRON_BLOCK , 6 ,1600 , "raw_block_smelting" );
95- oreBlasting (List .of (Items .RAW_IRON_BLOCK ), RecipeCategory .MISC , Items .IRON_BLOCK , 6 ,800 , "raw_block_smelting" );
96- oreSmelting (List .of (Items .RAW_COPPER_BLOCK ), RecipeCategory .MISC , Items .COPPER_BLOCK , 6 ,1600 , "raw_block_smelting" );
97- oreBlasting (List .of (Items .RAW_COPPER_BLOCK ), RecipeCategory .MISC , Items .COPPER_BLOCK , 6 ,800 , "raw_block_smelting" );
98- oreSmelting (List .of (Items .RAW_GOLD_BLOCK ), RecipeCategory .MISC , Items .GOLD_BLOCK , 6 ,1600 , "raw_block_smelting" );
99- oreBlasting (List .of (Items .RAW_GOLD_BLOCK ), RecipeCategory .MISC , Items .GOLD_BLOCK , 6 ,800 , "raw_block_smelting" );
93+ oreProcessing (Items .RAW_IRON_BLOCK , Items .IRON_BLOCK , 6 ,1600 );
94+ oreProcessing (Items .RAW_COPPER_BLOCK , Items .COPPER_BLOCK , 6 ,1600 );
95+ oreProcessing (Items .RAW_GOLD_BLOCK , Items .GOLD_BLOCK , 6 ,1600 );
10096
10197 woodCutter (Items .OAK_LOG , Items .OAK_WOOD , Items .STRIPPED_OAK_LOG , Items .STRIPPED_OAK_WOOD , Items .OAK_PLANKS , Items .OAK_STAIRS , Items .OAK_SLAB );
10298 woodCutter (Items .SPRUCE_LOG , Items .SPRUCE_WOOD , Items .STRIPPED_SPRUCE_LOG , Items .STRIPPED_SPRUCE_WOOD , Items .SPRUCE_PLANKS , Items .SPRUCE_STAIRS , Items .SPRUCE_SLAB );
@@ -111,46 +107,76 @@ protected void buildRecipes() {
111107 woodCutter (Items .WARPED_STEM , Items .WARPED_HYPHAE , Items .STRIPPED_WARPED_STEM , Items .STRIPPED_WARPED_HYPHAE , Items .WARPED_PLANKS , Items .WARPED_STAIRS , Items .WARPED_SLAB );
112108
113109 {
114- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .STRIPPED_BAMBOO_BLOCK , Items . BAMBOO_BLOCK );
115- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_PLANKS , Items . STRIPPED_BAMBOO_BLOCK , 2 );
116- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_PLANKS , Items . BAMBOO_BLOCK , 2 );
117- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_MOSAIC , Items . STRIPPED_BAMBOO_BLOCK , 2 );
118- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_MOSAIC , Items . BAMBOO_BLOCK , 2 );
119- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_MOSAIC , Items . BAMBOO_PLANKS );
120- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_STAIRS , Items . BAMBOO_PLANKS );
121- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_SLAB , Items . BAMBOO_PLANKS , 2 );
122- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_MOSAIC_STAIRS , Items . BAMBOO_MOSAIC );
123- stonecutterResultFromBase ( RecipeCategory . BUILDING_BLOCKS , Items .BAMBOO_MOSAIC_SLAB , Items . BAMBOO_MOSAIC , 2 );
110+ stoneCutting ( Items . BAMBOO_BLOCK , Items .STRIPPED_BAMBOO_BLOCK , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
111+ stoneCutting ( Items . STRIPPED_BAMBOO_BLOCK , Items .BAMBOO_PLANKS , 2 , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
112+ stoneCutting ( Items . BAMBOO_BLOCK , Items .BAMBOO_PLANKS , 2 , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
113+ stoneCutting ( Items . STRIPPED_BAMBOO_BLOCK , Items .BAMBOO_MOSAIC , 2 , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
114+ stoneCutting ( Items . BAMBOO_BLOCK , Items .BAMBOO_MOSAIC , 2 , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
115+ stoneCutting ( Items . BAMBOO_PLANKS , Items .BAMBOO_MOSAIC , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
116+ stoneCutting ( Items . BAMBOO_PLANKS , Items .BAMBOO_STAIRS , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
117+ stoneCutting ( Items . BAMBOO_PLANKS , Items .BAMBOO_SLAB , 2 , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
118+ stoneCutting ( Items . BAMBOO_MOSAIC , Items .BAMBOO_MOSAIC_STAIRS , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
119+ stoneCutting ( Items . BAMBOO_MOSAIC , Items .BAMBOO_MOSAIC_SLAB , 2 , RecipeCategory . BUILDING_BLOCKS , "bamboo_cutting" );
124120 }
125121
126- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .WHITE_STAINED_GLASS_PANE , Items . WHITE_STAINED_GLASS , 4 );
127- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .ORANGE_STAINED_GLASS_PANE , Items . ORANGE_STAINED_GLASS , 4 );
128- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .MAGENTA_STAINED_GLASS_PANE , Items . MAGENTA_STAINED_GLASS , 4 );
129- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .LIGHT_BLUE_STAINED_GLASS_PANE , Items . LIGHT_BLUE_STAINED_GLASS , 4 );
130- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .YELLOW_STAINED_GLASS_PANE , Items . YELLOW_STAINED_GLASS , 4 );
131- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .LIME_STAINED_GLASS_PANE , Items . LIME_STAINED_GLASS , 4 );
132- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .PINK_STAINED_GLASS_PANE , Items . PINK_STAINED_GLASS , 4 );
133- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .GRAY_STAINED_GLASS_PANE , Items . GRAY_STAINED_GLASS , 4 );
134- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .LIGHT_GRAY_STAINED_GLASS_PANE , Items . LIGHT_GRAY_STAINED_GLASS , 4 );
135- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .CYAN_STAINED_GLASS_PANE , Items . CYAN_STAINED_GLASS , 4 );
136- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .PURPLE_STAINED_GLASS_PANE , Items . PURPLE_STAINED_GLASS , 4 );
137- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .BLUE_STAINED_GLASS_PANE , Items . BLUE_STAINED_GLASS , 4 );
138- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .BROWN_STAINED_GLASS_PANE , Items . BROWN_STAINED_GLASS , 4 );
139- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .GREEN_STAINED_GLASS_PANE , Items . GREEN_STAINED_GLASS , 4 );
140- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .RED_STAINED_GLASS_PANE , Items . RED_STAINED_GLASS , 4 );
141- stonecutterResultFromBase ( RecipeCategory . DECORATIONS , Items .BLACK_STAINED_GLASS_PANE , Items . BLACK_STAINED_GLASS , 4 );
142-
122+ stoneCutting ( Items . GLASS , Items .GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
123+ stoneCutting ( Items . WHITE_STAINED_GLASS , Items .WHITE_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
124+ stoneCutting ( Items . ORANGE_STAINED_GLASS , Items .ORANGE_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
125+ stoneCutting ( Items . MAGENTA_STAINED_GLASS , Items .MAGENTA_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
126+ stoneCutting ( Items . LIGHT_BLUE_STAINED_GLASS , Items .LIGHT_BLUE_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
127+ stoneCutting ( Items . YELLOW_STAINED_GLASS , Items .YELLOW_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
128+ stoneCutting ( Items . LIME_STAINED_GLASS , Items .LIME_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
129+ stoneCutting ( Items . PINK_STAINED_GLASS , Items .PINK_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
130+ stoneCutting ( Items . GRAY_STAINED_GLASS , Items .GRAY_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
131+ stoneCutting ( Items . LIGHT_GRAY_STAINED_GLASS , Items .LIGHT_GRAY_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
132+ stoneCutting ( Items . CYAN_STAINED_GLASS , Items .CYAN_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
133+ stoneCutting ( Items . PURPLE_STAINED_GLASS , Items .PURPLE_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
134+ stoneCutting ( Items . BLUE_STAINED_GLASS , Items .BLUE_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
135+ stoneCutting ( Items . BROWN_STAINED_GLASS , Items .BROWN_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
136+ stoneCutting ( Items . GREEN_STAINED_GLASS , Items .GREEN_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
137+ stoneCutting ( Items . RED_STAINED_GLASS , Items .RED_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
138+ stoneCutting ( Items . BLACK_STAINED_GLASS , Items . BLACK_STAINED_GLASS_PANE , 4 , RecipeCategory . DECORATIONS , "glass_cutting" );
143139 }
144140
145141 private void woodCutter (ItemLike log , ItemLike wood , ItemLike strippedLog , ItemLike strippedWood ,
146142 ItemLike planks , ItemLike stairs , ItemLike slab ) {
147- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , strippedLog , log );
148- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , strippedWood , wood );
149- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , planks , log , 4 );
150- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , planks , wood , 4 );
151- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , planks , strippedLog , 4 );
152- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , planks , strippedWood , 4 );
153- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , stairs , planks );
154- stonecutterResultFromBase (RecipeCategory .BUILDING_BLOCKS , slab , planks , 2 );
143+ stoneCutting (log , strippedLog , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
144+ stoneCutting (wood , strippedWood , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
145+ stoneCutting (log , planks , 4 , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
146+ stoneCutting (wood , planks , 4 , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
147+ stoneCutting (strippedLog , planks , 4 , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
148+ stoneCutting (strippedWood , planks , 4 , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
149+ stoneCutting (planks , stairs , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
150+ stoneCutting (planks , slab , 2 , RecipeCategory .BUILDING_BLOCKS , "wood_cutting" );
151+ }
152+
153+ private void oreProcessing (ItemLike material , ItemLike result , float experience , int normalCookingTime ) {
154+ smelting (material , result , experience , normalCookingTime , RecipeCategory .MISC , "raw_ore_block_smelting" );
155+ blasting (material , result , experience , normalCookingTime / 2 , RecipeCategory .MISC , "raw_ore_block_smelting" );
156+ }
157+
158+ private void stoneCutting (ItemLike material , ItemLike result , RecipeCategory category , String group ) {
159+ stoneCutting (material , result , 1 , category , group );
160+ }
161+
162+ private void stoneCutting (ItemLike material , ItemLike result , int resultCount , RecipeCategory category , String group ) {
163+ SingleItemRecipeBuilder .stonecutting (Ingredient .of (material ), category , result , resultCount )
164+ .unlockedBy (getHasName (material ), this .has (material ))
165+ .group (group )
166+ .save (output , Naming .modRecipe (getConversionRecipeName (result , material ) + "_stonecutting" ));
167+ }
168+
169+ private void smelting (ItemLike material , ItemLike result , float experience , int cookingTime , RecipeCategory category , String group ) {
170+ SimpleCookingRecipeBuilder .generic (Ingredient .of (material ), category , result , experience , cookingTime , RecipeSerializer .SMELTING_RECIPE , SmeltingRecipe ::new )
171+ .unlockedBy (getHasName (material ), has (material ))
172+ .group (group )
173+ .save (output , Naming .modRecipe (getSmeltingRecipeName (result ) + "_" + getItemName (material )));
174+ }
175+
176+ private void blasting (ItemLike material , ItemLike result , float experience , int cookingTime , RecipeCategory category , String group ) {
177+ SimpleCookingRecipeBuilder .generic (Ingredient .of (material ), category , result , experience , cookingTime , RecipeSerializer .BLASTING_RECIPE , BlastingRecipe ::new )
178+ .unlockedBy (getHasName (material ), has (material ))
179+ .group (group )
180+ .save (output , Naming .modRecipe (getBlastingRecipeName (result ) + "_" + getItemName (material )));
155181 }
156182}
0 commit comments