|
| 1 | +package com.rae.creatingspace.content.datagen.recipe; |
| 2 | + |
| 3 | +import com.rae.creatingspace.CreatingSpace; |
| 4 | +import com.rae.creatingspace.content.datagen.CSMetalSets; |
| 5 | +import com.rae.creatingspace.init.EngineMaterialInit; |
| 6 | +import com.rae.creatingspace.init.ingameobject.ItemInit; |
| 7 | +import com.simibubi.create.AllTags; |
| 8 | +import com.simibubi.create.foundation.data.recipe.PressingRecipeGen; |
| 9 | +import net.minecraft.advancements.Criterion; |
| 10 | +import net.minecraft.advancements.critereon.InventoryChangeTrigger; |
| 11 | +import net.minecraft.core.HolderLookup; |
| 12 | +import net.minecraft.data.PackOutput; |
| 13 | +import net.minecraft.data.recipes.RecipeCategory; |
| 14 | +import net.minecraft.data.recipes.RecipeOutput; |
| 15 | +import net.minecraft.data.recipes.ShapedRecipeBuilder; |
| 16 | +import net.minecraft.data.recipes.ShapelessRecipeBuilder; |
| 17 | +import net.minecraft.resources.ResourceLocation; |
| 18 | +import net.minecraft.world.item.Item; |
| 19 | + |
| 20 | +import java.util.concurrent.CompletableFuture; |
| 21 | + |
| 22 | +public class CSMetalRecipeHelper { |
| 23 | + |
| 24 | + public static void generateMetalRecipes(RecipeOutput output, CSMetalSets.MetalSet metal) { |
| 25 | + // 9 Nuggets → 1 Ingot |
| 26 | + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, metal.ingot()) |
| 27 | + .define('#', AllTags.commonItemTag("nuggets/" + metal.name())) |
| 28 | + .pattern("###") |
| 29 | + .pattern("###") |
| 30 | + .pattern("###") |
| 31 | + .unlockedBy("has_nugget", has(metal.nugget())) |
| 32 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_ingot_from_nuggets")); |
| 33 | + |
| 34 | + // 1 Ingot → 9 Nuggets |
| 35 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, metal.nugget(), 9) |
| 36 | + .requires(AllTags.commonItemTag("ingots/" + metal.name())) |
| 37 | + .unlockedBy("has_ingot", has(metal.ingot())) |
| 38 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_nugget")); |
| 39 | + |
| 40 | + // 9 Ingots → 1 Block |
| 41 | + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, metal.block()) |
| 42 | + .define('#', AllTags.commonItemTag("ingots/" + metal.name())) |
| 43 | + .pattern("###") |
| 44 | + .pattern("###") |
| 45 | + .pattern("###") |
| 46 | + .unlockedBy("has_ingot", has(metal.ingot())) |
| 47 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_block")); |
| 48 | + |
| 49 | + // 1 Block → 9 Ingots |
| 50 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, metal.ingot(), 9) |
| 51 | + .requires(AllTags.commonItemTag("storage_blocks/" + metal.name())) |
| 52 | + .unlockedBy("has_block", has(metal.block())) |
| 53 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_ingot_from_block")); |
| 54 | + } |
| 55 | + |
| 56 | + public static void generateMetalAlloyRecipes(RecipeOutput output, CSMetalSets.MetalSet metal) { |
| 57 | + // 9 Nuggets → 1 Ingot |
| 58 | + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, metal.ingot()) |
| 59 | + .define('#', AllTags.commonItemTag("nuggets/" + metal.name())) |
| 60 | + .pattern("###") |
| 61 | + .pattern("###") |
| 62 | + .pattern("###") |
| 63 | + .unlockedBy("has_nugget", has(metal.nugget())) |
| 64 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_ingot_from_nuggets")); |
| 65 | + |
| 66 | + // 1 Ingot → 9 Nuggets |
| 67 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, metal.nugget(), 9) |
| 68 | + .requires(AllTags.commonItemTag("ingots/" + metal.name())) |
| 69 | + .unlockedBy("has_ingot", has(metal.ingot())) |
| 70 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_nugget")); |
| 71 | + |
| 72 | + // 9 Ingots → 1 Block |
| 73 | + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, metal.block()) |
| 74 | + .define('#', AllTags.commonItemTag("ingots/" + metal.name())) |
| 75 | + .pattern("###") |
| 76 | + .pattern("###") |
| 77 | + .pattern("###") |
| 78 | + .unlockedBy("has_ingot", has(metal.ingot())) |
| 79 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_block")); |
| 80 | + |
| 81 | + // 1 Block → 9 Ingots |
| 82 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, metal.ingot(), 9) |
| 83 | + .requires(AllTags.commonItemTag("storage_blocks/" + metal.name())) |
| 84 | + .unlockedBy("has_block", has(metal.block())) |
| 85 | + .save(output, ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, metal.name() + "_ingot_from_block")); |
| 86 | + } |
| 87 | + |
| 88 | + public static void generateMetalPressingRecipes(RecipeOutput output, CSMetalSets.MetalSet metal) { |
| 89 | + |
| 90 | + } |
| 91 | + |
| 92 | + // helper for criteria |
| 93 | + private static Criterion<InventoryChangeTrigger.TriggerInstance> has(Item item) { |
| 94 | + return InventoryChangeTrigger.TriggerInstance.hasItems(item); |
| 95 | + } |
| 96 | + |
| 97 | + private ResourceLocation createLocation(String recipeName) { |
| 98 | + return ResourceLocation.fromNamespaceAndPath(CreatingSpace.MODID, recipeName); |
| 99 | + } |
| 100 | +} |
| 101 | + |
0 commit comments