RecipeProvider .java

net.minecraft.data.recipes.RecipeProvider (class, 1233 lines): members: nineBlockStorageRecipesRecipesWithCustomUnpacking, FamilyStonecutterRecipeProvider.

net.minecraft.data.recipesclass1,233 linescommon47.5 KB

API Surface (104)

void accept(final ResourceKey<Recipe<?>> id, final Recipe<?> recipe, final @Nullable AdvancementHolder advancementHolder)
Advancement.Builder advancement()
<S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> key)
<S> Stream<Holder.Reference<S>> listContextElements(final ResourceKey<? extends Registry<? extends S>> key)
void generateForEnabledBlockFamilies(final FeatureFlagSet flagSet)
void oneToOneConversionRecipe(final ItemLike product, final ItemLike resource, final @Nullable String group)
void oneToOneConversionRecipe(final ItemLike product, final ItemLike resource, final @Nullable String group, final int productCount)
void oreSmelting(final List<ItemLike> smeltables, final RecipeCategory craftingCategory, final CookingBookCategory cookingCategory, final ItemLike result, final float experience, final int cookingTime, final String group)
void oreBlasting(final List<ItemLike> smeltables, final RecipeCategory craftingCategory, final CookingBookCategory cookingCategory, final ItemLike result, final float experience, final int cookingTime, final String group)
<T extends AbstractCookingRecipe> void oreCooking(final AbstractCookingRecipe.Factory<T> factory, final List<ItemLike> smeltables, final RecipeCategory craftingCategory, final CookingBookCategory cookingCategory, final ItemLike result, final float experience, final int cookingTime, final String group, final String fromDesc)
void netheriteSmithing(final Item base, final RecipeCategory category, final Item result)
void trimSmithing(final Item trimTemplate, final ResourceKey<TrimPattern> patternId, final ResourceKey<Recipe<?>> id)
void twoByTwoPacker(final RecipeCategory category, final ItemLike result, final ItemLike ingredient)
void threeByThreePacker(final RecipeCategory category, final ItemLike result, final ItemLike ingredient, final String unlockedBy)
void threeByThreePacker(final RecipeCategory category, final ItemLike result, final ItemLike ingredient)
void planksFromLog(final ItemLike result, final TagKey<Item> logs, final int count)
void planksFromLogs(final ItemLike result, final TagKey<Item> logs, final int count)
void woodFromLogs(final ItemLike result, final ItemLike log)
void woodenBoat(final ItemLike result, final ItemLike planks)
void chestBoat(final ItemLike chestBoat, final ItemLike boat)
RecipeBuilder buttonBuilder(final ItemLike result, final Ingredient base)
RecipeBuilder doorBuilder(final ItemLike result, final Ingredient base)
RecipeBuilder fenceBuilder(final ItemLike result, final Ingredient base)
RecipeBuilder fenceGateBuilder(final ItemLike result, final Ingredient planks)
void pressurePlate(final ItemLike result, final ItemLike base)
RecipeBuilder pressurePlateBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
void slab(final RecipeCategory category, final ItemLike result, final ItemLike base)
void shelf(final ItemLike result, final ItemLike strippedLogs)
RecipeBuilder slabBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
RecipeBuilder stairBuilder(final ItemLike result, final Ingredient base)
RecipeBuilder trapdoorBuilder(final ItemLike result, final Ingredient base)
RecipeBuilder signBuilder(final ItemLike result, final Ingredient planks)
RecipeBuilder hangingSignBuilder(final ItemLike result, final Ingredient ingredient)
void colorItemWithDye(final List<Item> dyes, final List<Item> items, final String groupName, final RecipeCategory category)
void colorWithDye(final List<Item> dyes, final List<Item> dyedItems, final @Nullable Item uncoloredItem, final String groupName, final RecipeCategory category)
void carpet(final ItemLike result, final ItemLike sourceItem)
void bedFromPlanksAndWool(final ItemLike result, final ItemLike wool)
void banner(final ItemLike result, final ItemLike wool)
void stainedGlassFromGlassAndDye(final ItemLike result, final ItemLike dye)
void dryGhast(final ItemLike result)
void harness(final ItemLike result, final ItemLike wool)
void stainedGlassPaneFromStainedGlass(final ItemLike result, final ItemLike stainedGlass)
void stainedGlassPaneFromGlassPaneAndDye(final ItemLike result, final ItemLike dye)
void coloredTerracottaFromTerracottaAndDye(final ItemLike result, final ItemLike dye)
void concretePowder(final ItemLike result, final ItemLike dye)
void candle(final ItemLike result, final ItemLike dye)
void wall(final RecipeCategory category, final ItemLike result, final ItemLike base)
RecipeBuilder wallBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
RecipeBuilder bricksBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
RecipeBuilder tilesBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
RecipeBuilder pillarBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
void polished(final RecipeCategory category, final ItemLike result, final ItemLike base)
RecipeBuilder polishedBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
void cut(final RecipeCategory category, final ItemLike result, final ItemLike base)
ShapedRecipeBuilder cutBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
void chiseled(final RecipeCategory category, final ItemLike result, final ItemLike base)
void mosaicBuilder(final RecipeCategory category, final ItemLike result, final ItemLike base)
ShapedRecipeBuilder chiseledBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
ShapedRecipeBuilder carpetBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base)
void stonecutterResultFromBase(final RecipeCategory category, final ItemLike result, final ItemLike base)
void stonecutterResultFromBase(final RecipeCategory category, final ItemLike result, final ItemLike base, final int count)
void smeltingResultFromBase(final ItemLike result, final ItemLike base)
void nineBlockStorageRecipes(final RecipeCategory unpackedFormCategory, final ItemLike unpackedForm, final RecipeCategory packedFormCategory, final ItemLike packedForm)
void nineBlockStorageRecipesWithCustomPacking(final RecipeCategory unpackedFormCategory, final ItemLike unpackedForm, final RecipeCategory packedFormCategory, final ItemLike packedForm, final String packingRecipeId, final String packingRecipeGroup)
void nineBlockStorageRecipesRecipesWithCustomUnpacking(final RecipeCategory unpackedFormCategory, final ItemLike unpackedForm, final RecipeCategory packedFormCategory, final ItemLike packedForm, final String unpackingRecipeId, final String unpackingRecipeGroup)
void nineBlockStorageRecipes(final RecipeCategory unpackedFormCategory, final ItemLike unpackedForm, final RecipeCategory packedFormCategory, final ItemLike packedForm, final String packingRecipeId, final @Nullable String packingRecipeGroup, final String unpackingRecipeId, final @Nullable String unpackingRecipeGroup)
void copySmithingTemplate(final ItemLike smithingTemplate, final ItemLike baseMaterial)
void copySmithingTemplate(final ItemLike smithingTemplate, final Ingredient baseMaterials)
<T extends AbstractCookingRecipe> void cookRecipes(final String source, final AbstractCookingRecipe.Factory<T> factory, final int cookingTime)
<T extends AbstractCookingRecipe> void simpleCookingRecipe(final String source, final AbstractCookingRecipe.Factory<T> factory, final int cookingTime, final ItemLike base, final ItemLike result, final float experience)
void waxRecipes(final FeatureFlagSet flagSet)
void grate(final Block grateBlock, final Block material)
void copperBulb(final Block copperBulb, final Block copperMaterial)
void waxedChiseled(final Block result, final Block material)
void suspiciousStew(final Item item, final SuspiciousEffectHolder effectHolder)
void dyedItem(final Item target, final String group)
void dyedShulkerBoxRecipe(final Item dye, final Item dyedResult)
void dyedBundleRecipe(final Item dye, final Item dyedResult)
void cushionRecipe(final Item woolSlab, final Item result)
void generateRecipes(final BlockFamily family, final FeatureFlagSet flagSet)
void generateCraftingRecipe(final BlockFamily family, final BlockFamily.Variant variant, final Block result, final ItemLike base)
void generateSmeltingRecipe(final BlockFamily.Variant variant, final Block result, final ItemLike base)
void generateStonecutterRecipe(final BlockFamily family, final BlockFamily.Variant variant, final Block base)
Block getBaseBlockForCrafting(final BlockFamily family, final BlockFamily.Variant variant)
String getCraftingCriterionName(final BlockFamily family, final BlockFamily.Variant variant, final ItemLike base)
Criterion<EnterBlockTrigger.TriggerInstance> insideOf(final Block block)
Criterion<BredAnimalsTrigger.TriggerInstance> bredAnimal()
Criterion<InventoryChangeTrigger.TriggerInstance> has(final MinMaxBounds.Ints count, final ItemLike item)
Criterion<InventoryChangeTrigger.TriggerInstance> has(final ItemLike item)
Criterion<InventoryChangeTrigger.TriggerInstance> has(final TagKey<Item> tag)
Criterion<InventoryChangeTrigger.TriggerInstance> inventoryTrigger(final ItemPredicate.Builder... predicates)
Criterion<InventoryChangeTrigger.TriggerInstance> inventoryTrigger(final ItemPredicate... predicates)
String getHasName(final ItemLike baseBlock)
String getItemName(final ItemLike itemLike)
String getSimpleRecipeName(final ItemLike itemLike)
String getConversionRecipeName(final ItemLike product, final ItemLike material)
String getSmeltingRecipeName(final ItemLike product)
String getBlastingRecipeName(final ItemLike product)
Ingredient tag(final TagKey<Item> id)
ShapedRecipeBuilder shaped(final RecipeCategory category, final ItemLike item)
ShapedRecipeBuilder shaped(final RecipeCategory category, final ItemLike item, final int count)
ShapelessRecipeBuilder shapeless(final RecipeCategory category, final ItemStackTemplate result)
ShapelessRecipeBuilder shapeless(final RecipeCategory category, final ItemLike item)
ShapelessRecipeBuilder shapeless(final RecipeCategory category, final ItemLike item, final int count)

Fields & Constants (24)

SHAPE_BUILDERS
STONECUTTER_RECIPE_BUILDERS
items
trimPatterns
output
advancementOutput
smeltables
craftingCategory
cookingCategory
result
experience
cookingTime
factory
group
groupName
packedFormCategory
unpackedFormCategory
unpackedForm
packedForm
packingRecipeId
unpackingRecipeId
packingRecipeGroup
source
base

String literals (44)

"_from_smelting"
"_from_blasting"
"has_netherite_ingot"
"_smithing"
"has_smithing_trim_template"
"planks"
"has_log"
"has_logs"
"bark"
"boat"
"in_water"
"chest_boat"
"has_boat"
"shelf"
"sign"
"hanging_sign"
"has_needed_dye"
"dye_"
"carpet"
"banner"
"_duplicate"
"stained_glass"
"has_glass"
"dry_ghast"

Code Graph: Dependencies (54)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

RecipeProvider.java1233 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.data.recipes;
2
3
import com.google.common.collect.ImmutableMap;
4
import com.mojang.datafixers.util.Pair;
5
import java.util.Arrays;
6
import java.util.List;
7
import java.util.Map;
8
import java.util.Optional;
9
import java.util.stream.Stream;
10
import net.minecraft.advancements.Advancement;
11
import net.minecraft.advancements.AdvancementHolder;
12
import net.minecraft.advancements.predicates.ItemPredicate;
13
import net.minecraft.advancements.predicates.MinMaxBounds;
14
import net.minecraft.advancements.triggers.BredAnimalsTrigger;
15
import net.minecraft.advancements.triggers.CriteriaTriggers;
16
import net.minecraft.advancements.triggers.Criterion;
17
import net.minecraft.advancements.triggers.EnterBlockTrigger;
18
import net.minecraft.advancements.triggers.InventoryChangeTrigger;
19
import net.minecraft.core.Holder;
20
import net.minecraft.core.HolderGetter;
21
import net.minecraft.core.HolderSet;
22
import net.minecraft.core.Registry;
23
import net.minecraft.core.component.DataComponentPatch;
24
import net.minecraft.core.component.DataComponents;
25
import net.minecraft.core.registries.BuiltInRegistries;
26
import net.minecraft.core.registries.Registries;
27
import net.minecraft.data.BlockFamilies;
28
import net.minecraft.data.BlockFamily;
29
import net.minecraft.data.worldgen.BootstrapContext;
30
import net.minecraft.resources.Identifier;
31
import net.minecraft.resources.ResourceKey;
32
import net.minecraft.tags.ItemTags;
33
import net.minecraft.tags.TagKey;
34
import net.minecraft.world.flag.FeatureFlagSet;
35
import net.minecraft.world.item.HoneycombItem;
36
import net.minecraft.world.item.Item;
37
import net.minecraft.world.item.ItemStackTemplate;
38
import net.minecraft.world.item.Items;
39
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
40
import net.minecraft.world.item.crafting.BannerDuplicateRecipe;
41
import net.minecraft.world.item.crafting.BlastingRecipe;
42
import net.minecraft.world.item.crafting.CookingBookCategory;
43
import net.minecraft.world.item.crafting.DyeRecipe;
44
import net.minecraft.world.item.crafting.Ingredient;
45
import net.minecraft.world.item.crafting.Recipe;
46
import net.minecraft.world.item.crafting.SmeltingRecipe;
47
import net.minecraft.world.item.equipment.trim.TrimPattern;
48
import net.minecraft.world.level.ItemLike;
49
import net.minecraft.world.level.block.Block;
50
import net.minecraft.world.level.block.Blocks;
51
import net.minecraft.world.level.block.SuspiciousEffectHolder;
52
import org.jspecify.annotations.Nullable;
53
54
/**
55
 * Access widened by fabric-data-generation-api-v1 to accessible
56
 */
57
public abstract class RecipeProvider {
58
	private final HolderGetter<Item> items;
59
	private final HolderGetter<TrimPattern> trimPatterns;
60
	protected final RecipeOutput output;
61
	protected final BootstrapContext<Advancement> advancementOutput;
62
	private static final Map<BlockFamily.Variant, RecipeProvider.FamilyCraftingRecipeProvider> SHAPE_BUILDERS = ImmutableMap.<BlockFamily.Variant, RecipeProvider.FamilyCraftingRecipeProvider>builder()
63
		.put(BlockFamily.Variant.BUTTON, (context, result, base) -> context.buttonBuilder(result, Ingredient.of(base)))
64
		.put(BlockFamily.Variant.CHISELED, (context, result, base) -> context.chiseledBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
65
		.put(BlockFamily.Variant.CARPET, (context, result, base) -> context.carpetBuilder(RecipeCategory.DECORATIONS, result, Ingredient.of(base)))
66
		.put(BlockFamily.Variant.CUT, (context, result, base) -> context.cutBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
67
		.put(BlockFamily.Variant.DOOR, (context, result, base) -> context.doorBuilder(result, Ingredient.of(base)))
68
		.put(BlockFamily.Variant.CUSTOM_FENCE, (context, result, base) -> context.fenceBuilder(result, Ingredient.of(base)))
69
		.put(BlockFamily.Variant.FENCE, (context, result, base) -> context.fenceBuilder(result, Ingredient.of(base)))
70
		.put(BlockFamily.Variant.CUSTOM_FENCE_GATE, (context, result, base) -> context.fenceGateBuilder(result, Ingredient.of(base)))
71
		.put(BlockFamily.Variant.FENCE_GATE, (context, result, base) -> context.fenceGateBuilder(result, Ingredient.of(base)))
72
		.put(BlockFamily.Variant.SIGN, (context, result, base) -> context.signBuilder(result, Ingredient.of(base)))
73
		.put(BlockFamily.Variant.CUSTOM_HANGING_SIGN, (context, result, base) -> context.hangingSignBuilder(result, Ingredient.of(base)))
74
		.put(BlockFamily.Variant.HANGING_SIGN, (context, result, base) -> context.hangingSignBuilder(result, Ingredient.of(base)))
75
		.put(BlockFamily.Variant.SLAB, (context, result, base) -> context.slabBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
76
		.put(BlockFamily.Variant.STAIRS, (context, result, base) -> context.stairBuilder(result, Ingredient.of(base)))
77
		.put(BlockFamily.Variant.PRESSURE_PLATE, (context, result, base) -> context.pressurePlateBuilder(RecipeCategory.REDSTONE, result, Ingredient.of(base)))
78
		.put(BlockFamily.Variant.POLISHED, (context, result, base) -> context.polishedBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
79
		.put(BlockFamily.Variant.TRAPDOOR, (context, result, base) -> context.trapdoorBuilder(result, Ingredient.of(base)))
80
		.put(BlockFamily.Variant.WALL, (context, result, base) -> context.wallBuilder(RecipeCategory.DECORATIONS, result, Ingredient.of(base)))
81
		.put(BlockFamily.Variant.BRICKS, (context, result, base) -> context.bricksBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
82
		.put(BlockFamily.Variant.TILES, (context, result, base) -> context.tilesBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
83
		.put(BlockFamily.Variant.PILLAR, (context, result, base) -> context.pillarBuilder(RecipeCategory.BUILDING_BLOCKS, result, Ingredient.of(base)))
84
		.build();
85
	private static final Map<BlockFamily.Variant, RecipeProvider.FamilyStonecutterRecipeProvider> STONECUTTER_RECIPE_BUILDERS = ImmutableMap.<BlockFamily.Variant, RecipeProvider.FamilyStonecutterRecipeProvider>builder()
86
		.put(BlockFamily.Variant.SLAB, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 2))
87
		.put(BlockFamily.Variant.STAIRS, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
88
		.put(BlockFamily.Variant.BRICKS, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
89
		.put(BlockFamily.Variant.WALL, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.DECORATIONS, result, base, 1))
90
		.put(BlockFamily.Variant.CHISELED, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
91
		.put(BlockFamily.Variant.POLISHED, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
92
		.put(BlockFamily.Variant.CUT, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
93
		.put(BlockFamily.Variant.TILES, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
94
		.put(BlockFamily.Variant.PILLAR, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
95
		.put(BlockFamily.Variant.COBBLED, (context, result, base) -> context.stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, result, base, 1))
96
		.build();
97
98
	protected RecipeProvider(final BootstrapContext<Recipe<?>> recipeOutput, final BootstrapContext<Advancement> advancementOutput) {
99
		this.advancementOutput = advancementOutput;
100
		this.output = new RecipeOutput() {
101
			@Override
102
			public void accept(final ResourceKey<Recipe<?>> id, final Recipe<?> recipe, final @Nullable AdvancementHolder advancementHolder) {
103
				recipeOutput.register(id, recipe);
104
				if (advancementHolder != null) {
105
					this.acceptAdvancement(advancementHolder);
106
				}
107
			}
108
109
			private void acceptAdvancement(final AdvancementHolder advancementHolder) {
110
				advancementHolder.register(advancementOutput);
111
			}
112
113
			@Override
114
			public Advancement.Builder advancement() {
115
				return Advancement.Builder.recipeAdvancement().parent(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT);
116
			}
117
118
			@Override
119
			public <S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> key) {
120
				return recipeOutput.lookup(key);
121
			}
122
123
			@Deprecated
124
			@Override
125
			public <S> Stream<Holder.Reference<S>> listContextElements(final ResourceKey<? extends Registry<? extends S>> key) {
126
				return recipeOutput.listContextElements(key);
127
			}
128
		};
129
		this.items = recipeOutput.lookup(Registries.ITEM);
130
		this.trimPatterns = recipeOutput.lookup(Registries.TRIM_PATTERN);
131
	}
132
133
	/**
134
	 * Access widened by fabric-data-generation-api-v1 to accessible
135
	 */
136
	public abstract void buildRecipes();
137
138
	/**
139
	 * Access widened by fabric-data-generation-api-v1 to accessible
140
	 */
141
	public void generateForEnabledBlockFamilies(final FeatureFlagSet flagSet) {
142
		BlockFamilies.getAllFamilies().forEach(family -> this.generateRecipes(family, flagSet));
143
	}
144
145
	/**
146
	 * Access widened by fabric-data-generation-api-v1 to accessible
147
	 */
148
	public void oneToOneConversionRecipe(final ItemLike product, final ItemLike resource, final @Nullable String group) {
149
		this.oneToOneConversionRecipe(product, resource, group, 1);
150
	}
151
152
	/**
153
	 * Access widened by fabric-data-generation-api-v1 to accessible
154
	 */
155
	public void oneToOneConversionRecipe(final ItemLike product, final ItemLike resource, final @Nullable String group, final int productCount) {
156
		this.shapeless(RecipeCategory.MISC, product, productCount)
157
			.requires(resource)
158
			.group(group)
159
			.unlockedBy(getHasName(resource), this.has(resource))
160
			.save(this.output, getConversionRecipeName(product, resource));
161
	}
162
163
	/**
164
	 * Access widened by fabric-data-generation-api-v1 to accessible
165
	 */
166
	public void oreSmelting(
167
		final List<ItemLike> smeltables,
168
		final RecipeCategory craftingCategory,
169
		final CookingBookCategory cookingCategory,
170
		final ItemLike result,
171
		final float experience,
172
		final int cookingTime,
173
		final String group
174
	) {
175
		this.oreCooking(SmeltingRecipe::new, smeltables, craftingCategory, cookingCategory, result, experience, cookingTime, group, "_from_smelting");
176
	}
177
178
	/**
179
	 * Access widened by fabric-data-generation-api-v1 to accessible
180
	 */
181
	public void oreBlasting(
182
		final List<ItemLike> smeltables,
183
		final RecipeCategory craftingCategory,
184
		final CookingBookCategory cookingCategory,
185
		final ItemLike result,
186
		final float experience,
187
		final int cookingTime,
188
		final String group
189
	) {
190
		this.oreCooking(BlastingRecipe::new, smeltables, craftingCategory, cookingCategory, result, experience, cookingTime, group, "_from_blasting");
191
	}
192
193
	/**
194
	 * Access widened by fabric-data-generation-api-v1 to accessible
195
	 */
196
	public final <T extends AbstractCookingRecipe> void oreCooking(
197
		final AbstractCookingRecipe.Factory<T> factory,
198
		final List<ItemLike> smeltables,
199
		final RecipeCategory craftingCategory,
200
		final CookingBookCategory cookingCategory,
201
		final ItemLike result,
202
		final float experience,
203
		final int cookingTime,
204
		final String group,
205
		final String fromDesc
206
	) {
207
		for (ItemLike item : smeltables) {
208
			SimpleCookingRecipeBuilder.generic(Ingredient.of(item), craftingCategory, cookingCategory, result, experience, cookingTime, factory)
209
				.group(group)
210
				.unlockedBy(getHasName(item), this.has(item))
211
				.save(this.output, getItemName(result) + fromDesc + "_" + getItemName(item));
212
		}
213
	}
214
215
	/**
216
	 * Access widened by fabric-data-generation-api-v1 to accessible
217
	 */
218
	public void netheriteSmithing(final Item base, final RecipeCategory category, final Item result) {
219
		SmithingTransformRecipeBuilder.smithing(
220
				Ingredient.of(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE), Ingredient.of(base), this.tag(ItemTags.NETHERITE_TOOL_MATERIALS), category, result
221
			)
222
			.unlocks("has_netherite_ingot", this.has(ItemTags.NETHERITE_TOOL_MATERIALS))
223
			.save(this.output, getItemName(result) + "_smithing");
224
	}
225
226
	/**
227
	 * Access widened by fabric-data-generation-api-v1 to accessible
228
	 */
229
	public void trimSmithing(final Item trimTemplate, final ResourceKey<TrimPattern> patternId, final ResourceKey<Recipe<?>> id) {
230
		Holder.Reference<TrimPattern> pattern = this.trimPatterns.getOrThrow(patternId);
231
		SmithingTrimRecipeBuilder.smithingTrim(
232
				Ingredient.of(trimTemplate), this.tag(ItemTags.TRIMMABLE_ARMOR), this.tag(ItemTags.TRIM_MATERIALS), pattern, RecipeCategory.MISC
233
			)
234
			.unlocks("has_smithing_trim_template", this.has(trimTemplate))
235
			.save(this.output, id);
236
	}
237
238
	/**
239
	 * Access widened by fabric-data-generation-api-v1 to accessible
240
	 */
241
	public void twoByTwoPacker(final RecipeCategory category, final ItemLike result, final ItemLike ingredient) {
242
		this.shaped(category, result, 1)
243
			.define('#', ingredient)
244
			.pattern("##")
245
			.pattern("##")
246
			.unlockedBy(getHasName(ingredient), this.has(ingredient))
247
			.save(this.output);
248
	}
249
250
	/**
251
	 * Access widened by fabric-data-generation-api-v1 to accessible
252
	 */
253
	public void threeByThreePacker(final RecipeCategory category, final ItemLike result, final ItemLike ingredient, final String unlockedBy) {
254
		this.shapeless(category, result).requires(ingredient, 9).unlockedBy(unlockedBy, this.has(ingredient)).save(this.output);
255
	}
256
257
	/**
258
	 * Access widened by fabric-data-generation-api-v1 to accessible
259
	 */
260
	public void threeByThreePacker(final RecipeCategory category, final ItemLike result, final ItemLike ingredient) {
261
		this.threeByThreePacker(category, result, ingredient, getHasName(ingredient));
262
	}
263
264
	/**
265
	 * Access widened by fabric-data-generation-api-v1 to accessible
266
	 */
267
	public void planksFromLog(final ItemLike result, final TagKey<Item> logs, final int count) {
268
		this.shapeless(RecipeCategory.BUILDING_BLOCKS, result, count).requires(logs).group("planks").unlockedBy("has_log", this.has(logs)).save(this.output);
269
	}
270
271
	/**
272
	 * Access widened by fabric-data-generation-api-v1 to accessible
273
	 */
274
	public void planksFromLogs(final ItemLike result, final TagKey<Item> logs, final int count) {
275
		this.shapeless(RecipeCategory.BUILDING_BLOCKS, result, count).requires(logs).group("planks").unlockedBy("has_logs", this.has(logs)).save(this.output);
276
	}
277
278
	/**
279
	 * Access widened by fabric-data-generation-api-v1 to accessible
280
	 */
281
	public void woodFromLogs(final ItemLike result, final ItemLike log) {
282
		this.shaped(RecipeCategory.BUILDING_BLOCKS, result, 3)
283
			.define('#', log)
284
			.pattern("##")
285
			.pattern("##")
286
			.group("bark")
287
			.unlockedBy("has_log", this.has(log))
288
			.save(this.output);
289
	}
290
291
	/**
292
	 * Access widened by fabric-data-generation-api-v1 to accessible
293
	 */
294
	public void woodenBoat(final ItemLike result, final ItemLike planks) {
295
		this.shaped(RecipeCategory.TRANSPORTATION, result)
296
			.define('#', planks)
297
			.pattern("# #")
298
			.pattern("###")
299
			.group("boat")
300
			.unlockedBy("in_water", insideOf(Blocks.WATER))
301
			.save(this.output);
302
	}
303
304
	/**
305
	 * Access widened by fabric-data-generation-api-v1 to accessible
306
	 */
307
	public void chestBoat(final ItemLike chestBoat, final ItemLike boat) {
308
		this.shapeless(RecipeCategory.TRANSPORTATION, chestBoat)
309
			.requires(Blocks.CHEST)
310
			.requires(boat)
311
			.group("chest_boat")
312
			.unlockedBy("has_boat", this.has(ItemTags.BOATS))
313
			.save(this.output);
314
	}
315
316
	/**
317
	 * Access widened by fabric-data-generation-api-v1 to accessible
318
	 */
319
	public final RecipeBuilder buttonBuilder(final ItemLike result, final Ingredient base) {
320
		return this.shapeless(RecipeCategory.REDSTONE, result).requires(base);
321
	}
322
323
	/**
324
	 * Access widened by fabric-data-generation-api-v1 to accessible
325
	 */
326
	public RecipeBuilder doorBuilder(final ItemLike result, final Ingredient base) {
327
		return this.shaped(RecipeCategory.REDSTONE, result, 3).define('#', base).pattern("##").pattern("##").pattern("##");
328
	}
329
330
	/**
331
	 * Access widened by fabric-data-generation-api-v1 to accessible
332
	 */
333
	public final RecipeBuilder fenceBuilder(final ItemLike result, final Ingredient base) {
334
		int count = result == Blocks.NETHER_BRICK_FENCE ? 6 : 3;
335
		Item base2 = result == Blocks.NETHER_BRICK_FENCE ? Items.NETHER_BRICK : Items.STICK;
336
		return this.shaped(RecipeCategory.DECORATIONS, result, count).define('W', base).define('#', base2).pattern("W#W").pattern("W#W");
337
	}
338
339
	/**
340
	 * Access widened by fabric-data-generation-api-v1 to accessible
341
	 */
342
	public final RecipeBuilder fenceGateBuilder(final ItemLike result, final Ingredient planks) {
343
		return this.shaped(RecipeCategory.REDSTONE, result).define('#', Items.STICK).define('W', planks).pattern("#W#").pattern("#W#");
344
	}
345
346
	/**
347
	 * Access widened by fabric-data-generation-api-v1 to accessible
348
	 */
349
	public void pressurePlate(final ItemLike result, final ItemLike base) {
350
		this.pressurePlateBuilder(RecipeCategory.REDSTONE, result, Ingredient.of(base)).unlockedBy(getHasName(base), this.has(base)).save(this.output);
351
	}
352
353
	/**
354
	 * Access widened by fabric-data-generation-api-v1 to accessible
355
	 */
356
	public final RecipeBuilder pressurePlateBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
357
		return this.shaped(category, result).define('#', base).pattern("##");
358
	}
359
360
	/**
361
	 * Access widened by fabric-data-generation-api-v1 to accessible
362
	 */
363
	public void slab(final RecipeCategory category, final ItemLike result, final ItemLike base) {
364
		this.slabBuilder(category, result, Ingredient.of(base)).unlockedBy(getHasName(base), this.has(base)).save(this.output);
365
	}
366
367
	/**
368
	 * Access widened by fabric-data-generation-api-v1 to accessible
369
	 */
370
	public void shelf(final ItemLike result, final ItemLike strippedLogs) {
371
		this.shaped(RecipeCategory.DECORATIONS, result, 6)
372
			.define('#', strippedLogs)
373
			.pattern("###")
374
			.pattern("   ")
375
			.pattern("###")
376
			.group("shelf")
377
			.unlockedBy(getHasName(strippedLogs), this.has(strippedLogs))
378
			.save(this.output);
379
	}
380
381
	/**
382
	 * Access widened by fabric-data-generation-api-v1 to accessible
383
	 */
384
	public RecipeBuilder slabBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
385
		return this.shaped(category, result, 6).define('#', base).pattern("###");
386
	}
387
388
	/**
389
	 * Access widened by fabric-data-generation-api-v1 to accessible
390
	 */
391
	public RecipeBuilder stairBuilder(final ItemLike result, final Ingredient base) {
392
		return this.shaped(RecipeCategory.BUILDING_BLOCKS, result, 4).define('#', base).pattern("#  ").pattern("## ").pattern("###");
393
	}
394
395
	/**
396
	 * Access widened by fabric-data-generation-api-v1 to accessible
397
	 */
398
	public RecipeBuilder trapdoorBuilder(final ItemLike result, final Ingredient base) {
399
		return this.shaped(RecipeCategory.REDSTONE, result, 2).define('#', base).pattern("###").pattern("###");
400
	}
401
402
	/**
403
	 * Access widened by fabric-data-generation-api-v1 to accessible
404
	 */
405
	public final RecipeBuilder signBuilder(final ItemLike result, final Ingredient planks) {
406
		return this.shaped(RecipeCategory.DECORATIONS, result, 3)
407
			.group("sign")
408
			.define('#', planks)
409
			.define('X', Items.STICK)
410
			.pattern("###")
411
			.pattern("###")
412
			.pattern(" X ");
413
	}
414
415
	/**
416
	 * Access widened by fabric-data-generation-api-v1 to accessible
417
	 */
418
	public RecipeBuilder hangingSignBuilder(final ItemLike result, final Ingredient ingredient) {
419
		return this.shaped(RecipeCategory.DECORATIONS, result, 6)
420
			.group("hanging_sign")
421
			.define('#', ingredient)
422
			.define('X', Items.IRON_CHAIN)
423
			.pattern("X X")
424
			.pattern("###")
425
			.pattern("###");
426
	}
427
428
	/**
429
	 * Access widened by fabric-data-generation-api-v1 to accessible
430
	 */
431
	public void colorItemWithDye(final List<Item> dyes, final List<Item> items, final String groupName, final RecipeCategory category) {
432
		this.colorWithDye(dyes, items, null, groupName, category);
433
	}
434
435
	/**
436
	 * Access widened by fabric-data-generation-api-v1 to accessible
437
	 */
438
	public void colorWithDye(
439
		final List<Item> dyes, final List<Item> dyedItems, final @Nullable Item uncoloredItem, final String groupName, final RecipeCategory category
440
	) {
441
		for (int dyeIndex = 0; dyeIndex < dyes.size(); dyeIndex++) {
442
			Item dye = dyes.get(dyeIndex);
443
			Item dyedItem = dyedItems.get(dyeIndex);
444
			Stream<Item> sourceItems = dyedItems.stream().filter(b -> !b.equals(dyedItem));
445
			if (uncoloredItem != null) {
446
				sourceItems = Stream.concat(sourceItems, Stream.of(uncoloredItem));
447
			}
448
449
			this.shapeless(category, dyedItem)
450
				.requires(dye)
451
				.requires(Ingredient.of(sourceItems))
452
				.group(groupName)
453
				.unlockedBy("has_needed_dye", this.has(dye))
454
				.save(this.output, "dye_" + getItemName(dyedItem));
455
		}
456
	}
457
458
	/**
459
	 * Access widened by fabric-data-generation-api-v1 to accessible
460
	 */
461
	public void carpet(final ItemLike result, final ItemLike sourceItem) {
462
		this.shaped(RecipeCategory.DECORATIONS, result, 3)
463
			.define('#', sourceItem)
464
			.pattern("##")
465
			.group("carpet")
466
			.unlockedBy(getHasName(sourceItem), this.has(sourceItem))
467
			.save(this.output);
468
	}
469
470
	/**
471
	 * Access widened by fabric-data-generation-api-v1 to accessible
472
	 */
473
	public void bedFromPlanksAndWool(final ItemLike result, final ItemLike wool) {
474
		this.shaped(RecipeCategory.DECORATIONS, result)
475
			.define('#', wool)
476
			.define('X', ItemTags.PLANKS)
477
			.pattern("###")
478
			.pattern("XXX")
479
			.group("bed")
480
			.unlockedBy(getHasName(wool), this.has(wool))
481
			.save(this.output);
482
	}
483
484
	/**
485
	 * Access widened by fabric-data-generation-api-v1 to accessible
486
	 */
487
	public void banner(final ItemLike result, final ItemLike wool) {
488
		this.shaped(RecipeCategory.DECORATIONS, result)
489
			.define('#', wool)
490
			.define('|', Items.STICK)
491
			.pattern("###")
492
			.pattern("###")
493
			.pattern(" | ")
494
			.group("banner")
495
			.unlockedBy(getHasName(wool), this.has(wool))
496
			.save(this.output);
497
		SpecialRecipeBuilder.special(() -> new BannerDuplicateRecipe(Ingredient.of(result), new ItemStackTemplate(result.asItem())))
498
			.save(this.output, getItemName(result) + "_duplicate");
499
	}
500
501
	/**
502
	 * Access widened by fabric-data-generation-api-v1 to accessible
503
	 */
504
	public void stainedGlassFromGlassAndDye(final ItemLike result, final ItemLike dye) {
505
		this.shaped(RecipeCategory.BUILDING_BLOCKS, result, 8)
506
			.define('#', Blocks.GLASS)
507
			.define('X', dye)
508
			.pattern("###")
509
			.pattern("#X#")
510
			.pattern("###")
511
			.group("stained_glass")
512
			.unlockedBy("has_glass", this.has(Blocks.GLASS))
513
			.save(this.output);
514
	}
515
516
	/**
517
	 * Access widened by fabric-data-generation-api-v1 to accessible
518
	 */
519
	public void dryGhast(final ItemLike result) {
520
		this.shaped(RecipeCategory.BUILDING_BLOCKS, result, 1)
521
			.define('#', Items.GHAST_TEAR)
522
			.define('X', Items.SOUL_SAND)
523
			.pattern("###")
524
			.pattern("#X#")
525
			.pattern("###")
526
			.group("dry_ghast")
527
			.unlockedBy(getHasName(Items.GHAST_TEAR), this.has(Items.GHAST_TEAR))
528
			.save(this.output);
529
	}
530
531
	/**
532
	 * Access widened by fabric-data-generation-api-v1 to accessible
533
	 */
534
	public void harness(final ItemLike result, final ItemLike wool) {
535
		this.shaped(RecipeCategory.COMBAT, result)
536
			.define('#', wool)
537
			.define('G', Items.GLASS)
538
			.define('L', Items.LEATHER)
539
			.pattern("LLL")
540
			.pattern("G#G")
541
			.group("harness")
542
			.unlockedBy("has_dried_ghast", this.has(Blocks.DRIED_GHAST))
543
			.save(this.output);
544
	}
545
546
	/**
547
	 * Access widened by fabric-data-generation-api-v1 to accessible
548
	 */
549
	public void stainedGlassPaneFromStainedGlass(final ItemLike result, final ItemLike stainedGlass) {
550
		this.shaped(RecipeCategory.DECORATIONS, result, 16)
551
			.define('#', stainedGlass)
552
			.pattern("###")
553
			.pattern("###")
554
			.group("stained_glass_pane")
555
			.unlockedBy("has_glass", this.has(stainedGlass))
556
			.save(this.output);
557
	}
558
559
	/**
560
	 * Access widened by fabric-data-generation-api-v1 to accessible
561
	 */
562
	public void stainedGlassPaneFromGlassPaneAndDye(final ItemLike result, final ItemLike dye) {
563
		this.shaped(RecipeCategory.DECORATIONS, result, 8)
564
			.define('#', Blocks.GLASS_PANE)
565
			.define('$', dye)
566
			.pattern("###")
567
			.pattern("#$#")
568
			.pattern("###")
569
			.group("stained_glass_pane")
570
			.unlockedBy("has_glass_pane", this.has(Blocks.GLASS_PANE))
571
			.unlockedBy(getHasName(dye), this.has(dye))
572
			.save(this.output, getConversionRecipeName(result, Blocks.GLASS_PANE));
573
	}
574
575
	/**
576
	 * Access widened by fabric-data-generation-api-v1 to accessible
577
	 */
578
	public void coloredTerracottaFromTerracottaAndDye(final ItemLike result, final ItemLike dye) {
579
		this.shaped(RecipeCategory.BUILDING_BLOCKS, result, 8)
580
			.define('#', Blocks.TERRACOTTA)
581
			.define('X', dye)
582
			.pattern("###")
583
			.pattern("#X#")
584
			.pattern("###")
585
			.group("stained_terracotta")
586
			.unlockedBy("has_terracotta", this.has(Blocks.TERRACOTTA))
587
			.save(this.output);
588
	}
589
590
	/**
591
	 * Access widened by fabric-data-generation-api-v1 to accessible
592
	 */
593
	public void concretePowder(final ItemLike result, final ItemLike dye) {
594
		this.shapeless(RecipeCategory.BUILDING_BLOCKS, result, 8)
595
			.requires(dye)
596
			.requires(Blocks.SAND, 4)
597
			.requires(Blocks.GRAVEL, 4)
598
			.group("concrete_powder")
599
			.unlockedBy("has_sand", this.has(Blocks.SAND))
600
			.unlockedBy("has_gravel", this.has(Blocks.GRAVEL))
601
			.save(this.output);
602
	}
603
604
	/**
605
	 * Access widened by fabric-data-generation-api-v1 to accessible
606
	 */
607
	public void candle(final ItemLike result, final ItemLike dye) {
608
		this.shapeless(RecipeCategory.DECORATIONS, result)
609
			.requires(Blocks.CANDLE)
610
			.requires(dye)
611
			.group("dyed_candle")
612
			.unlockedBy(getHasName(dye), this.has(dye))
613
			.save(this.output);
614
	}
615
616
	/**
617
	 * Access widened by fabric-data-generation-api-v1 to accessible
618
	 */
619
	public void wall(final RecipeCategory category, final ItemLike result, final ItemLike base) {
620
		this.wallBuilder(category, result, Ingredient.of(base)).unlockedBy(getHasName(base), this.has(base)).save(this.output);
621
	}
622
623
	/**
624
	 * Access widened by fabric-data-generation-api-v1 to accessible
625
	 */
626
	public final RecipeBuilder wallBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
627
		return this.shaped(category, result, 6).define('#', base).pattern("###").pattern("###");
628
	}
629
630
	/**
631
	 * Access widened by fabric-data-generation-api-v1 to accessible
632
	 */
633
	public final RecipeBuilder bricksBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
634
		return this.shaped(category, result, 4).define('#', base).pattern("##").pattern("##");
635
	}
636
637
	/**
638
	 * Access widened by fabric-data-generation-api-v1 to accessible
639
	 */
640
	public final RecipeBuilder tilesBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
641
		return this.shaped(category, result, 4).define('#', base).pattern("##").pattern("##");
642
	}
643
644
	/**
645
	 * Access widened by fabric-data-generation-api-v1 to accessible
646
	 */
647
	public final RecipeBuilder pillarBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
648
		return this.shaped(category, result, 2).define('#', base).pattern("#").pattern("#");
649
	}
650
651
	/**
652
	 * Access widened by fabric-data-generation-api-v1 to accessible
653
	 */
654
	public void polished(final RecipeCategory category, final ItemLike result, final ItemLike base) {
655
		this.polishedBuilder(category, result, Ingredient.of(base)).unlockedBy(getHasName(base), this.has(base)).save(this.output);
656
	}
657
658
	/**
659
	 * Access widened by fabric-data-generation-api-v1 to accessible
660
	 */
661
	public final RecipeBuilder polishedBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
662
		return this.shaped(category, result, 4).define('S', base).pattern("SS").pattern("SS");
663
	}
664
665
	/**
666
	 * Access widened by fabric-data-generation-api-v1 to accessible
667
	 */
668
	public void cut(final RecipeCategory category, final ItemLike result, final ItemLike base) {
669
		this.cutBuilder(category, result, Ingredient.of(base)).unlockedBy(getHasName(base), this.has(base)).save(this.output);
670
	}
671
672
	/**
673
	 * Access widened by fabric-data-generation-api-v1 to accessible
674
	 */
675
	public final ShapedRecipeBuilder cutBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
676
		return this.shaped(category, result, 4).define('#', base).pattern("##").pattern("##");
677
	}
678
679
	/**
680
	 * Access widened by fabric-data-generation-api-v1 to accessible
681
	 */
682
	public void chiseled(final RecipeCategory category, final ItemLike result, final ItemLike base) {
683
		this.chiseledBuilder(category, result, Ingredient.of(base)).unlockedBy(getHasName(base), this.has(base)).save(this.output);
684
	}
685
686
	/**
687
	 * Access widened by fabric-data-generation-api-v1 to accessible
688
	 */
689
	public void mosaicBuilder(final RecipeCategory category, final ItemLike result, final ItemLike base) {
690
		this.shaped(category, result).define('#', base).pattern("#").pattern("#").unlockedBy(getHasName(base), this.has(base)).save(this.output);
691
	}
692
693
	/**
694
	 * Access widened by fabric-data-generation-api-v1 to accessible
695
	 */
696
	public ShapedRecipeBuilder chiseledBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
697
		return this.shaped(category, result).define('#', base).pattern("#").pattern("#");
698
	}
699
700
	/**
701
	 * Access widened by fabric-data-generation-api-v1 to accessible
702
	 */
703
	public ShapedRecipeBuilder carpetBuilder(final RecipeCategory category, final ItemLike result, final Ingredient base) {
704
		return this.shaped(category, result, 3).define('#', base).pattern("##").group("carpet");
705
	}
706
707
	/**
708
	 * Access widened by fabric-data-generation-api-v1 to accessible
709
	 */
710
	public void stonecutterResultFromBase(final RecipeCategory category, final ItemLike result, final ItemLike base) {
711
		this.stonecutterResultFromBase(category, result, base, 1);
712
	}
713
714
	/**
715
	 * Access widened by fabric-data-generation-api-v1 to accessible
716
	 */
717
	public void stonecutterResultFromBase(final RecipeCategory category, final ItemLike result, final ItemLike base, final int count) {
718
		SingleItemRecipeBuilder.stonecutting(Ingredient.of(base), category, result, count)
719
			.unlockedBy(getHasName(base), this.has(base))
720
			.save(this.output, getConversionRecipeName(result, base) + "_stonecutting");
721
	}
722
723
	/**
724
	 * Access widened by fabric-data-generation-api-v1 to accessible
725
	 */
726
	public final void smeltingResultFromBase(final ItemLike result, final ItemLike base) {
727
		SimpleCookingRecipeBuilder.smelting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, CookingBookCategory.BLOCKS, result, 0.1F, 200)
728
			.unlockedBy(getHasName(base), this.has(base))
729
			.save(this.output);
730
	}
731
732
	/**
733
	 * Access widened by fabric-data-generation-api-v1 to accessible
734
	 */
735
	public void nineBlockStorageRecipes(
736
		final RecipeCategory unpackedFormCategory, final ItemLike unpackedForm, final RecipeCategory packedFormCategory, final ItemLike packedForm
737
	) {
738
		this.nineBlockStorageRecipes(
739
			unpackedFormCategory, unpackedForm, packedFormCategory, packedForm, getSimpleRecipeName(packedForm), null, getSimpleRecipeName(unpackedForm), null
740
		);
741
	}
742
743
	/**
744
	 * Access widened by fabric-data-generation-api-v1 to accessible
745
	 */
746
	public void nineBlockStorageRecipesWithCustomPacking(
747
		final RecipeCategory unpackedFormCategory,
748
		final ItemLike unpackedForm,
749
		final RecipeCategory packedFormCategory,
750
		final ItemLike packedForm,
751
		final String packingRecipeId,
752
		final String packingRecipeGroup
753
	) {
754
		this.nineBlockStorageRecipes(
755
			unpackedFormCategory, unpackedForm, packedFormCategory, packedForm, packingRecipeId, packingRecipeGroup, getSimpleRecipeName(unpackedForm), null
756
		);
757
	}
758
759
	/**
760
	 * Access widened by fabric-data-generation-api-v1 to accessible
761
	 */
762
	public void nineBlockStorageRecipesRecipesWithCustomUnpacking(
763
		final RecipeCategory unpackedFormCategory,
764
		final ItemLike unpackedForm,
765
		final RecipeCategory packedFormCategory,
766
		final ItemLike packedForm,
767
		final String unpackingRecipeId,
768
		final String unpackingRecipeGroup
769
	) {
770
		this.nineBlockStorageRecipes(
771
			unpackedFormCategory, unpackedForm, packedFormCategory, packedForm, getSimpleRecipeName(packedForm), null, unpackingRecipeId, unpackingRecipeGroup
772
		);
773
	}
774
775
	/**
776
	 * Access widened by fabric-data-generation-api-v1 to accessible
777
	 */
778
	public final void nineBlockStorageRecipes(
779
		final RecipeCategory unpackedFormCategory,
780
		final ItemLike unpackedForm,
781
		final RecipeCategory packedFormCategory,
782
		final ItemLike packedForm,
783
		final String packingRecipeId,
784
		final @Nullable String packingRecipeGroup,
785
		final String unpackingRecipeId,
786
		final @Nullable String unpackingRecipeGroup
787
	) {
788
		this.shapeless(unpackedFormCategory, unpackedForm, 9)
789
			.requires(packedForm)
790
			.group(unpackingRecipeGroup)
791
			.unlockedBy(getHasName(packedForm), this.has(packedForm))
792
			.save(this.output, ResourceKey.create(Registries.RECIPE, Identifier.parse(unpackingRecipeId)));
793
		this.shaped(packedFormCategory, packedForm)
794
			.define('#', unpackedForm)
795
			.pattern("###")
796
			.pattern("###")
797
			.pattern("###")
798
			.group(packingRecipeGroup)
799
			.unlockedBy(getHasName(unpackedForm), this.has(unpackedForm))
800
			.save(this.output, ResourceKey.create(Registries.RECIPE, Identifier.parse(packingRecipeId)));
801
	}
802
803
	/**
804
	 * Access widened by fabric-data-generation-api-v1 to accessible
805
	 */
806
	public void copySmithingTemplate(final ItemLike smithingTemplate, final ItemLike baseMaterial) {
807
		this.shaped(RecipeCategory.MISC, smithingTemplate, 2)
808
			.define('#', Items.DIAMOND)
809
			.define('C', baseMaterial)
810
			.define('S', smithingTemplate)
811
			.pattern("#S#")
812
			.pattern("#C#")
813
			.pattern("###")
814
			.unlockedBy(getHasName(smithingTemplate), this.has(smithingTemplate))
815
			.save(this.output);
816
	}
817
818
	/**
819
	 * Access widened by fabric-data-generation-api-v1 to accessible
820
	 */
821
	public void copySmithingTemplate(final ItemLike smithingTemplate, final Ingredient baseMaterials) {
822
		this.shaped(RecipeCategory.MISC, smithingTemplate, 2)
823
			.define('#', Items.DIAMOND)
824
			.define('C', baseMaterials)
825
			.define('S', smithingTemplate)
826
			.pattern("#S#")
827
			.pattern("#C#")
828
			.pattern("###")
829
			.unlockedBy(getHasName(smithingTemplate), this.has(smithingTemplate))
830
			.save(this.output);
831
	}
832
833
	/**
834
	 * Access widened by fabric-data-generation-api-v1 to accessible
835
	 */
836
	public <T extends AbstractCookingRecipe> void cookRecipes(final String source, final AbstractCookingRecipe.Factory<T> factory, final int cookingTime) {
837
		this.simpleCookingRecipe(source, factory, cookingTime, Items.BEEF, Items.COOKED_BEEF, 0.35F);
838
		this.simpleCookingRecipe(source, factory, cookingTime, Items.CHICKEN, Items.COOKED_CHICKEN, 0.35F);
839
		this.simpleCookingRecipe(source, factory, cookingTime, Items.COD, Items.COOKED_COD, 0.35F);
840
		this.simpleCookingRecipe(source, factory, cookingTime, Items.KELP, Items.DRIED_KELP, 0.1F);
841
		this.simpleCookingRecipe(source, factory, cookingTime, Items.SALMON, Items.COOKED_SALMON, 0.35F);
842
		this.simpleCookingRecipe(source, factory, cookingTime, Items.MUTTON, Items.COOKED_MUTTON, 0.35F);
843
		this.simpleCookingRecipe(source, factory, cookingTime, Items.PORKCHOP, Items.COOKED_PORKCHOP, 0.35F);
844
		this.simpleCookingRecipe(source, factory, cookingTime, Items.POTATO, Items.BAKED_POTATO, 0.35F);
845
		this.simpleCookingRecipe(source, factory, cookingTime, Items.RABBIT, Items.COOKED_RABBIT, 0.35F);
846
	}
847
848
	/**
849
	 * Access widened by fabric-data-generation-api-v1 to accessible
850
	 */
851
	public final <T extends AbstractCookingRecipe> void simpleCookingRecipe(
852
		final String source,
853
		final AbstractCookingRecipe.Factory<T> factory,
854
		final int cookingTime,
855
		final ItemLike base,
856
		final ItemLike result,
857
		final float experience
858
	) {
859
		SimpleCookingRecipeBuilder.generic(Ingredient.of(base), RecipeCategory.FOOD, CookingBookCategory.FOOD, result, experience, cookingTime, factory)
860
			.unlockedBy(getHasName(base), this.has(base))
861
			.save(this.output, getItemName(result) + "_from_" + source);
862
	}
863
864
	/**
865
	 * Access widened by fabric-data-generation-api-v1 to accessible
866
	 */
867
	public void waxRecipes(final FeatureFlagSet flagSet) {
868
		HoneycombItem.WAXABLES
869
			.get()
870
			.forEach(
871
				(block, waxedBlock) -> {
872
					if (waxedBlock.requiredFeatures().isSubsetOf(flagSet)) {
873
						Pair<RecipeCategory, String> pair = HoneycombItem.WAXED_RECIPES
874
							.getOrDefault(waxedBlock, Pair.of(RecipeCategory.BUILDING_BLOCKS, getItemName(waxedBlock)));
875
						RecipeCategory recipeCategory = pair.getFirst();
876
						String group = pair.getSecond();
877
						this.shapeless(recipeCategory, waxedBlock)
878
							.requires(block)
879
							.requires(Items.HONEYCOMB)
880
							.group(group)
881
							.unlockedBy(getHasName(block), this.has(block))
882
							.save(this.output, getConversionRecipeName(waxedBlock, Items.HONEYCOMB));
883
					}
884
				}
885
			);
886
	}
887
888
	/**
889
	 * Access widened by fabric-data-generation-api-v1 to accessible
890
	 */
891
	public void grate(final Block grateBlock, final Block material) {
892
		this.shaped(RecipeCategory.BUILDING_BLOCKS, grateBlock, 4)
893
			.define('M', material)
894
			.pattern(" M ")
895
			.pattern("M M")
896
			.pattern(" M ")
897
			.group(getItemName(grateBlock))
898
			.unlockedBy(getHasName(material), this.has(material))
899
			.save(this.output);
900
	}
901
902
	/**
903
	 * Access widened by fabric-data-generation-api-v1 to accessible
904
	 */
905
	public void copperBulb(final Block copperBulb, final Block copperMaterial) {
906
		this.shaped(RecipeCategory.REDSTONE, copperBulb, 4)
907
			.define('C', copperMaterial)
908
			.define('R', Items.REDSTONE)
909
			.define('B', Items.BLAZE_ROD)
910
			.pattern(" C ")
911
			.pattern("CBC")
912
			.pattern(" R ")
913
			.unlockedBy(getHasName(copperMaterial), this.has(copperMaterial))
914
			.group(getItemName(copperBulb))
915
			.save(this.output);
916
	}
917
918
	/**
919
	 * Access widened by fabric-data-generation-api-v1 to accessible
920
	 */
921
	public void waxedChiseled(final Block result, final Block material) {
922
		this.shaped(RecipeCategory.BUILDING_BLOCKS, result)
923
			.define('M', material)
924
			.pattern(" M ")
925
			.pattern(" M ")
926
			.group(getItemName(result))
927
			.unlockedBy(getHasName(material), this.has(material))
928
			.save(this.output);
929
	}
930
931
	/**
932
	 * Access widened by fabric-data-generation-api-v1 to accessible
933
	 */
934
	public void suspiciousStew(final Item item, final SuspiciousEffectHolder effectHolder) {
935
		ItemStackTemplate stew = new ItemStackTemplate(
936
			Items.SUSPICIOUS_STEW, DataComponentPatch.builder().set(DataComponents.SUSPICIOUS_STEW_EFFECTS, effectHolder.getSuspiciousEffects()).build()
937
		);
938
		this.shapeless(RecipeCategory.FOOD, stew)
939
			.requires(Items.BOWL)
940
			.requires(ItemTags.MUSHROOMS)
941
			.requires(ItemTags.MUSHROOMS)
942
			.requires(item)
943
			.group("suspicious_stew")
944
			.unlockedBy(getHasName(item), this.has(item))
945
			.save(this.output, getItemName(stew.item().value()) + "_from_" + getItemName(item));
946
	}
947
948
	/**
949
	 * Access widened by fabric-data-generation-api-v1 to accessible
950
	 */
951
	public void dyedItem(final Item target, final String group) {
952
		CustomCraftingRecipeBuilder.customCrafting(
953
				RecipeCategory.MISC,
954
				(commonInfo, bookInfo) -> new DyeRecipe(commonInfo, bookInfo, Ingredient.of(target), this.tag(ItemTags.DYES), new ItemStackTemplate(target))
955
			)
956
			.unlockedBy(getHasName(target), this.has(target))
957
			.group(group)
958
			.save(this.output, getItemName(target) + "_dyed");
959
	}
960
961
	/**
962
	 * Access widened by fabric-data-generation-api-v1 to accessible
963
	 */
964
	public void dyedShulkerBoxRecipe(final Item dye, final Item dyedResult) {
965
		TransmuteRecipeBuilder.transmute(RecipeCategory.DECORATIONS, this.tag(ItemTags.SHULKER_BOXES), Ingredient.of(dye), dyedResult)
966
			.group("shulker_box_dye")
967
			.unlockedBy("has_shulker_box", this.has(ItemTags.SHULKER_BOXES))
968
			.save(this.output);
969
	}
970
971
	/**
972
	 * Access widened by fabric-data-generation-api-v1 to accessible
973
	 */
974
	public void dyedBundleRecipe(final Item dye, final Item dyedResult) {
975
		TransmuteRecipeBuilder.transmute(RecipeCategory.TOOLS, this.tag(ItemTags.BUNDLES), Ingredient.of(dye), dyedResult)
976
			.group("bundle_dye")
977
			.unlockedBy(getHasName(dye), this.has(dye))
978
			.save(this.output);
979
	}
980
981
	/**
982
	 * Access widened by fabric-data-generation-api-v1 to accessible
983
	 */
984
	public void cushionRecipe(final Item woolSlab, final Item result) {
985
		this.shaped(RecipeCategory.DECORATIONS, result, 1)
986
			.define('#', woolSlab)
987
			.group("cushion")
988
			.unlockedBy(getHasName(woolSlab), this.has(woolSlab))
989
			.pattern("###")
990
			.save(this.output);
991
	}
992
993
	/**
994
	 * Access widened by fabric-data-generation-api-v1 to accessible
995
	 */
996
	public void generateRecipes(final BlockFamily family, final FeatureFlagSet flagSet) {
997
		family.getVariants().forEach((variant, result) -> {
998
			if (result.requiredFeatures().isSubsetOf(flagSet)) {
999
				if (family.shouldGenerateCraftingRecipe()) {
1000
					this.generateCraftingRecipe(family, variant, result, this.getBaseBlockForCrafting(family, variant));
1001
				}
1002
1003
				if (family.shouldGenerateSmeltingRecipe()) {
1004
					this.generateSmeltingRecipe(variant, result, this.getBaseBlockForCrafting(family, variant));
1005
				}
1006
1007
				if (family.shouldGenerateStonecutterRecipe()) {
1008
					this.generateStonecutterRecipe(family, variant, family.getBaseBlock());
1009
				}
1010
			}
1011
		});
1012
	}
1013
1014
	/**
1015
	 * Access widened by fabric-data-generation-api-v1 to accessible
1016
	 */
1017
	public final void generateCraftingRecipe(final BlockFamily family, final BlockFamily.Variant variant, final Block result, final ItemLike base) {
1018
		RecipeProvider.FamilyCraftingRecipeProvider recipeFunction = SHAPE_BUILDERS.get(variant);
1019
		if (recipeFunction != null) {
1020
			RecipeBuilder builder = recipeFunction.create(this, result, base);
1021
			family.getRecipeGroupPrefix().ifPresent(prefix -> builder.group(variant.getPrefixedRecipeGroup(prefix)));
1022
			builder.unlockedBy(this.getCraftingCriterionName(family, variant, base), this.has(base));
1023
			builder.save(this.output);
1024
		}
1025
	}
1026
1027
	/**
1028
	 * Access widened by fabric-data-generation-api-v1 to accessible
1029
	 */
1030
	public final void generateSmeltingRecipe(final BlockFamily.Variant variant, final Block result, final ItemLike base) {
1031
		if (variant == BlockFamily.Variant.CRACKED) {
1032
			this.smeltingResultFromBase(result, base);
1033
		}
1034
1035
		if (variant == BlockFamily.Variant.COBBLED) {
1036
			this.smeltingResultFromBase(base, result);
1037
		}
1038
	}
1039
1040
	/**
1041
	 * Access widened by fabric-data-generation-api-v1 to accessible
1042
	 */
1043
	public final void generateStonecutterRecipe(final BlockFamily family, final BlockFamily.Variant variant, final Block base) {
1044
		RecipeProvider.FamilyStonecutterRecipeProvider recipeFunction = STONECUTTER_RECIPE_BUILDERS.get(variant);
1045
		if (recipeFunction != null) {
1046
			recipeFunction.create(this, family.get(variant), base);
1047
		}
1048
1049
		if (variant == BlockFamily.Variant.POLISHED
1050
			|| variant == BlockFamily.Variant.CUT
1051
			|| variant == BlockFamily.Variant.BRICKS
1052
			|| variant == BlockFamily.Variant.TILES
1053
			|| variant == BlockFamily.Variant.PILLAR
1054
			|| variant == BlockFamily.Variant.COBBLED) {
1055
			BlockFamily childVariantFamily = BlockFamilies.getFamily(family.get(variant));
1056
			if (childVariantFamily != null) {
1057
				childVariantFamily.getVariants().forEach((childVariant, r) -> this.generateStonecutterRecipe(childVariantFamily, childVariant, base));
1058
			}
1059
		}
1060
	}
1061
1062
	/**
1063
	 * Access widened by fabric-data-generation-api-v1 to accessible
1064
	 */
1065
	public final Block getBaseBlockForCrafting(final BlockFamily family, final BlockFamily.Variant variant) {
1066
		BlockFamily.Variant baseVariant = variant.getBaseVariantForCrafting();
1067
		if (baseVariant != null) {
1068
			if (!family.getVariants().containsKey(baseVariant)) {
1069
				throw new IllegalStateException(baseVariant.name() + " is not defined for the family.");
1070
			} else {
1071
				return family.get(baseVariant);
1072
			}
1073
		} else {
1074
			return family.getBaseBlock();
1075
		}
1076
	}
1077
1078
	/**
1079
	 * Access widened by fabric-data-generation-api-v1 to accessible
1080
	 */
1081
	public final String getCraftingCriterionName(final BlockFamily family, final BlockFamily.Variant variant, final ItemLike base) {
1082
		return base != family.getBaseBlock()
1083
			? "has_" + variant.getBaseVariantForCrafting().getRecipeGroup()
1084
			: family.getRecipeUnlockedBy().orElseGet(() -> getHasName(base));
1085
	}
1086
1087
	/**
1088
	 * Access widened by fabric-data-generation-api-v1 to accessible
1089
	 */
1090
	public static Criterion<EnterBlockTrigger.TriggerInstance> insideOf(final Block block) {
1091
		return CriteriaTriggers.ENTER_BLOCK
1092
			.createCriterion(new EnterBlockTrigger.TriggerInstance(Optional.empty(), Optional.of(HolderSet.direct(block.builtInRegistryHolder())), Optional.empty()));
1093
	}
1094
1095
	/**
1096
	 * Access widened by fabric-data-generation-api-v1 to accessible
1097
	 */
1098
	public Criterion<BredAnimalsTrigger.TriggerInstance> bredAnimal() {
1099
		return CriteriaTriggers.BRED_ANIMALS
1100
			.createCriterion(new BredAnimalsTrigger.TriggerInstance(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
1101
	}
1102
1103
	/**
1104
	 * Access widened by fabric-data-generation-api-v1 to accessible
1105
	 */
1106
	public final Criterion<InventoryChangeTrigger.TriggerInstance> has(final MinMaxBounds.Ints count, final ItemLike item) {
1107
		return inventoryTrigger(ItemPredicate.Builder.item().of(this.items, item).withCount(count));
1108
	}
1109
1110
	/**
1111
	 * Access widened by fabric-data-generation-api-v1 to accessible
1112
	 */
1113
	public Criterion<InventoryChangeTrigger.TriggerInstance> has(final ItemLike item) {
1114
		return inventoryTrigger(ItemPredicate.Builder.item().of(this.items, item));
1115
	}
1116
1117
	/**
1118
	 * Access widened by fabric-data-generation-api-v1 to accessible
1119
	 */
1120
	public Criterion<InventoryChangeTrigger.TriggerInstance> has(final TagKey<Item> tag) {
1121
		return inventoryTrigger(ItemPredicate.Builder.item().of(this.items, tag));
1122
	}
1123
1124
	/**
1125
	 * Access widened by fabric-data-generation-api-v1 to accessible
1126
	 */
1127
	public static Criterion<InventoryChangeTrigger.TriggerInstance> inventoryTrigger(final ItemPredicate.Builder... predicates) {
1128
		return inventoryTrigger(Arrays.stream(predicates).map(ItemPredicate.Builder::build).toArray(ItemPredicate[]::new));
1129
	}
1130
1131
	/**
1132
	 * Access widened by fabric-data-generation-api-v1 to accessible
1133
	 */
1134
	public static Criterion<InventoryChangeTrigger.TriggerInstance> inventoryTrigger(final ItemPredicate... predicates) {
1135
		return CriteriaTriggers.INVENTORY_CHANGED
1136
			.createCriterion(new InventoryChangeTrigger.TriggerInstance(Optional.empty(), InventoryChangeTrigger.TriggerInstance.Slots.ANY, List.of(predicates)));
1137
	}
1138
1139
	/**
1140
	 * Access widened by fabric-data-generation-api-v1 to accessible
1141
	 */
1142
	public static String getHasName(final ItemLike baseBlock) {
1143
		return "has_" + getItemName(baseBlock);
1144
	}
1145
1146
	/**
1147
	 * Access widened by fabric-data-generation-api-v1 to accessible
1148
	 */
1149
	public static String getItemName(final ItemLike itemLike) {
1150
		return BuiltInRegistries.ITEM.getKey(itemLike.asItem()).getPath();
1151
	}
1152
1153
	/**
1154
	 * Access widened by fabric-data-generation-api-v1 to accessible
1155
	 */
1156
	public static String getSimpleRecipeName(final ItemLike itemLike) {
1157
		return getItemName(itemLike);
1158
	}
1159
1160
	/**
1161
	 * Access widened by fabric-data-generation-api-v1 to accessible
1162
	 */
1163
	public static String getConversionRecipeName(final ItemLike product, final ItemLike material) {
1164
		return getItemName(product) + "_from_" + getItemName(material);
1165
	}
1166
1167
	/**
1168
	 * Access widened by fabric-data-generation-api-v1 to accessible
1169
	 */
1170
	public static String getSmeltingRecipeName(final ItemLike product) {
1171
		return getItemName(product) + "_from_smelting";
1172
	}
1173
1174
	/**
1175
	 * Access widened by fabric-data-generation-api-v1 to accessible
1176
	 */
1177
	public static String getBlastingRecipeName(final ItemLike product) {
1178
		return getItemName(product) + "_from_blasting";
1179
	}
1180
1181
	/**
1182
	 * Access widened by fabric-data-generation-api-v1 to accessible
1183
	 */
1184
	public Ingredient tag(final TagKey<Item> id) {
1185
		return Ingredient.of(this.items.getOrThrow(id));
1186
	}
1187
1188
	/**
1189
	 * Access widened by fabric-data-generation-api-v1 to accessible
1190
	 */
1191
	public ShapedRecipeBuilder shaped(final RecipeCategory category, final ItemLike item) {
1192
		return ShapedRecipeBuilder.shaped(this.items, category, item);
1193
	}
1194
1195
	/**
1196
	 * Access widened by fabric-data-generation-api-v1 to accessible
1197
	 */
1198
	public ShapedRecipeBuilder shaped(final RecipeCategory category, final ItemLike item, final int count) {
1199
		return ShapedRecipeBuilder.shaped(this.items, category, item, count);
1200
	}
1201
1202
	/**
1203
	 * Access widened by fabric-data-generation-api-v1 to accessible
1204
	 */
1205
	public ShapelessRecipeBuilder shapeless(final RecipeCategory category, final ItemStackTemplate result) {
1206
		return ShapelessRecipeBuilder.shapeless(this.items, category, result);
1207
	}
1208
1209
	/**
1210
	 * Access widened by fabric-data-generation-api-v1 to accessible
1211
	 */
1212
	public ShapelessRecipeBuilder shapeless(final RecipeCategory category, final ItemLike item) {
1213
		return ShapelessRecipeBuilder.shapeless(this.items, category, item);
1214
	}
1215
1216
	/**
1217
	 * Access widened by fabric-data-generation-api-v1 to accessible
1218
	 */
1219
	public ShapelessRecipeBuilder shapeless(final RecipeCategory category, final ItemLike item, final int count) {
1220
		return ShapelessRecipeBuilder.shapeless(this.items, category, item, count);
1221
	}
1222
1223
	@FunctionalInterface
1224
	private interface FamilyCraftingRecipeProvider {
1225
		RecipeBuilder create(RecipeProvider context, ItemLike result, ItemLike base);
1226
	}
1227
1228
	@FunctionalInterface
1229
	private interface FamilyStonecutterRecipeProvider {
1230
		void create(RecipeProvider context, ItemLike result, ItemLike base);
1231
	}
1232
}
1233

Decompiled Minecraft 26.3 source of RecipeProvider (net/minecraft/data/recipes/RecipeProvider.java) with Mojang official mappings, stored verbatim on the site.