Skip to content

Commit

Permalink
catalyst register
Browse files Browse the repository at this point in the history
  • Loading branch information
MCTian-mi committed Jul 7, 2024
1 parent ccb6e0a commit ed8c1ab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/supersymmetry/api/recipes/RecipeMapGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import gregtech.api.recipes.category.GTRecipeCategory;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -48,4 +52,18 @@ public Recipe findRecipe(long voltage, List<ItemStack> inputs, List<FluidStack>
.findFirst().ifPresent(recipe::set);
return recipe.get();
}

@Nonnull
@Override
public Map<GTRecipeCategory, List<Recipe>> getRecipesByCategory() {
Map<GTRecipeCategory, List<Recipe>> res = new Object2ObjectOpenHashMap<>();
for (RecipeMap<?> recipeMap : recipeMaps) {
recipeMap.getRecipesByCategory().forEach((category, recipes) -> {
List<Recipe> list = res.getOrDefault(category, new java.util.ArrayList<>());
list.addAll(recipes);
res.put(category, list);
});
}
return Collections.unmodifiableMap(res);
}
}

0 comments on commit ed8c1ab

Please sign in to comment.