|
38 | 38 | import aztech.modern_industrialization.machines.init.MIMachineRecipeTypes; |
39 | 39 | import aztech.modern_industrialization.machines.init.MachineTier; |
40 | 40 | import aztech.modern_industrialization.machines.recipe.MachineRecipe; |
41 | | -import aztech.modern_industrialization.machines.recipe.RecipeConversions; |
42 | 41 | import aztech.modern_industrialization.thirdparty.fabrictransfer.api.fluid.FluidVariant; |
43 | 42 | import aztech.modern_industrialization.util.TextHelper; |
44 | 43 | import java.util.ArrayList; |
45 | 44 | import java.util.Comparator; |
46 | 45 | import java.util.List; |
47 | | -import java.util.Objects; |
48 | 46 | import java.util.function.Consumer; |
49 | 47 | import net.minecraft.ChatFormatting; |
| 48 | +import net.minecraft.client.Minecraft; |
50 | 49 | import net.minecraft.core.RegistryAccess; |
51 | 50 | import net.minecraft.core.registries.BuiltInRegistries; |
52 | 51 | import net.minecraft.network.chat.Component; |
53 | 52 | import net.minecraft.network.chat.Style; |
54 | 53 | import net.minecraft.resources.ResourceLocation; |
55 | 54 | import net.minecraft.world.item.crafting.RecipeHolder; |
56 | 55 | import net.minecraft.world.item.crafting.RecipeManager; |
57 | | -import net.minecraft.world.item.crafting.RecipeType; |
58 | 56 | import net.minecraft.world.level.ItemLike; |
59 | | -import net.minecraft.world.level.block.ComposterBlock; |
60 | 57 |
|
61 | 58 | public class MachineCategory extends ViewerCategory<RecipeHolder<MachineRecipe>> { |
62 | 59 | public static MachineCategory create(MachineCategoryParams params) { |
@@ -96,41 +93,11 @@ public void buildWorkstations(WorkstationConsumer consumer) { |
96 | 93 |
|
97 | 94 | @Override |
98 | 95 | public void buildRecipes(RecipeManager recipeManager, RegistryAccess registryAccess, Consumer<RecipeHolder<MachineRecipe>> consumer) { |
99 | | - var machineRecipes = recipeManager.getRecipes().stream() |
100 | | - .filter(r -> r.value() instanceof MachineRecipe) |
101 | | - .map(r -> (RecipeHolder<MachineRecipe>) r) |
102 | | - .toList(); |
103 | | - |
104 | | - // regular recipes |
105 | | - machineRecipes.stream() |
106 | | - .filter(r -> params.recipePredicate.test(r.value())) |
| 96 | + MIMachineRecipeTypes.getRecipeTypes().stream() |
| 97 | + .flatMap(type -> type.getRecipes(Minecraft.getInstance().level).stream()) |
| 98 | + .filter(recipe -> params.recipePredicate.test(recipe.value())) |
107 | 99 | .sorted(Comparator.comparing(RecipeHolder::id)) |
108 | 100 | .forEach(consumer); |
109 | | - |
110 | | - // converted recipes |
111 | | - if (params.category.getNamespace().equals(MI.ID)) { |
112 | | - switch (params.category.getPath()) { |
113 | | - case "bronze_furnace" -> { |
114 | | - recipeManager.getAllRecipesFor(RecipeType.SMELTING) |
115 | | - .stream() |
116 | | - .map(r -> RecipeConversions.ofSmelting(r, MIMachineRecipeTypes.FURNACE, registryAccess)) |
117 | | - .forEach(consumer); |
118 | | - } |
119 | | - case "bronze_cutting_machine" -> { |
120 | | - recipeManager.getAllRecipesFor(RecipeType.STONECUTTING) |
121 | | - .stream() |
122 | | - .map(r -> RecipeConversions.ofStonecutting(r, MIMachineRecipeTypes.CUTTING_MACHINE, registryAccess)) |
123 | | - .forEach(consumer); |
124 | | - } |
125 | | - case "centrifuge" -> { |
126 | | - ComposterBlock.COMPOSTABLES.keySet() |
127 | | - .stream() |
128 | | - .map(RecipeConversions::ofCompostable) |
129 | | - .filter(Objects::nonNull) |
130 | | - .forEach(consumer); |
131 | | - } |
132 | | - } |
133 | | - } |
134 | 101 | } |
135 | 102 |
|
136 | 103 | @Override |
|
0 commit comments