Make assigning recipe book groups to item groups easier
haykam821 opened this issue ยท 1 comments
Currently, the logic that determines a recipe book group for a recipe looks something like this:
private static RecipeBookGroup getGroupForRecipe(Recipe<?> recipe) {
RecipeType<?> type = recipe.getType();
if (type == RecipeType.CRAFTING) {
ItemStack output = recipe.getOutput();
ItemGroup itemGroup = output.getItem().getGroup();
if (itemGroup == ItemGroup.BUILDING_BLOCKS) {
return RecipeBookGroup.CRAFTING_BUILDING_BLOCKS;
} else if (itemGroup == ItemGroup.TOOLS || itemGroup == ItemGroup.COMBAT) {
return RecipeBookGroup.CRAFTING_EQUIPMENT;
} else if (itemGroup == ItemGroup.REDSTONE) {
return RecipeBookGroup.CRAFTING_REDSTONE;
} else {
return RecipeBookGroup.CRAFTING_MISC;
}
} else {
return RecipeBookGroup.UNKNOWN;
}
}
If a mod chooses to add its items to a custom item group, then its recipes will be under the CRAFTING_MISC
recipe book group. The mixins required to fix this issue, especially for multiple item groups corresponding to the vanilla item groups, are not ideal and would benefit from inclusion in Fabric API.