From 983677e958d8f92708c067f94a6af56b23daa553 Mon Sep 17 00:00:00 2001 From: VoidLeech Date: Thu, 12 Dec 2024 02:10:10 +0100 Subject: [PATCH] feat: add modFlower milling helper --- .../data/recipe/MillingRecipeGen.java | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/MillingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/MillingRecipeGen.java index 6b28a22d5..f0869c008 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/MillingRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/MillingRecipeGen.java @@ -720,8 +720,7 @@ public class MillingRecipeGen extends ProcessingRecipeGen { RU_YELLOW_SNOWBELLE = ruFlower("yellow_snowbelle", List.of(1f), List.of(Items.YELLOW_DYE), List.of(2)) - - ; + ; protected GeneratedRecipe metalOre(String name, ItemEntry crushed, int duration) { return create(name + "_ore", b -> b.duration(duration) @@ -848,6 +847,36 @@ public class MillingRecipeGen extends ProcessingRecipeGen { } } + protected GeneratedRecipe modFlower(Mods mod, String input, List chances, + List dyes, List amounts){ + return switch (chances.size()) { + // Milling recipe has a max of 4 outputs + case 1 -> create(mod.recipeId(input), b -> b.duration(50) + .require(mod, input) + .output(chances.get(0), dyes.get(0), amounts.get(0)) + .whenModLoaded(mod.getId())); + case 2 -> create(mod.recipeId(input), b -> b.duration(50) + .require(mod, input) + .output(chances.get(0), dyes.get(0), amounts.get(0)) + .output(chances.get(1), dyes.get(1), amounts.get(1)) + .whenModLoaded(mod.getId())); + case 3 -> create(mod.recipeId(input), b -> b.duration(50) + .require(mod, input) + .output(chances.get(0), dyes.get(0), amounts.get(0)) + .output(chances.get(1), dyes.get(1), amounts.get(1)) + .output(chances.get(2), dyes.get(2), amounts.get(2)) + .whenModLoaded(mod.getId())); + case 4 -> create(mod.recipeId(input), b -> b.duration(50) + .require(mod, input) + .output(chances.get(0), dyes.get(0), amounts.get(0)) + .output(chances.get(1), dyes.get(1), amounts.get(1)) + .output(chances.get(2), dyes.get(2), amounts.get(2)) + .output(chances.get(3), dyes.get(3), amounts.get(3)) + .whenModLoaded(mod.getId())); + default -> null; + }; + } + public MillingRecipeGen(PackOutput output) { super(output); }