Skip to content

Commit 82a99ba

Browse files
committed
feat: add modFlower milling helper
1 parent 3cc4a76 commit 82a99ba

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/main/java/com/simibubi/create/foundation/data/recipe/MillingRecipeGen.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,7 @@ public class MillingRecipeGen extends ProcessingRecipeGen {
719719

720720
RU_YELLOW_SNOWBELLE = ruFlower("yellow_snowbelle", List.of(1f),
721721
List.of(Items.YELLOW_DYE), List.of(2))
722-
723-
;
722+
;
724723

725724
protected GeneratedRecipe metalOre(String name, ItemEntry<? extends Item> crushed, int duration) {
726725
return create(name + "_ore", b -> b.duration(duration)
@@ -847,6 +846,36 @@ protected GeneratedRecipe ruFlower(String input, List<Float> chances,
847846
}
848847
}
849848

849+
protected GeneratedRecipe modFlower(Mods mod, String input, List<Float> chances,
850+
List<Item> dyes, List<Integer> amounts){
851+
return switch (chances.size()) {
852+
// Milling recipe has a max of 4 outputs
853+
case 1 -> create(mod.recipeId(input), b -> b.duration(50)
854+
.require(mod, input)
855+
.output(chances.get(0), dyes.get(0), amounts.get(0))
856+
.whenModLoaded(mod.getId()));
857+
case 2 -> create(mod.recipeId(input), b -> b.duration(50)
858+
.require(mod, input)
859+
.output(chances.get(0), dyes.get(0), amounts.get(0))
860+
.output(chances.get(1), dyes.get(1), amounts.get(1))
861+
.whenModLoaded(mod.getId()));
862+
case 3 -> create(mod.recipeId(input), b -> b.duration(50)
863+
.require(mod, input)
864+
.output(chances.get(0), dyes.get(0), amounts.get(0))
865+
.output(chances.get(1), dyes.get(1), amounts.get(1))
866+
.output(chances.get(2), dyes.get(2), amounts.get(2))
867+
.whenModLoaded(mod.getId()));
868+
case 4 -> create(mod.recipeId(input), b -> b.duration(50)
869+
.require(mod, input)
870+
.output(chances.get(0), dyes.get(0), amounts.get(0))
871+
.output(chances.get(1), dyes.get(1), amounts.get(1))
872+
.output(chances.get(2), dyes.get(2), amounts.get(2))
873+
.output(chances.get(3), dyes.get(3), amounts.get(3))
874+
.whenModLoaded(mod.getId()));
875+
default -> null;
876+
};
877+
}
878+
850879
public MillingRecipeGen(PackOutput output) {
851880
super(output);
852881
}

0 commit comments

Comments
 (0)