Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Jun 10, 2024
1 parent 0744785 commit 7b3e0d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
33 changes: 17 additions & 16 deletions Forge/src/main/java/mezz/jei/forge/platform/BrewingRecipeMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import mezz.jei.api.runtime.IIngredientManager;
import mezz.jei.library.util.BrewingRecipeMakerCommon;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.alchemy.PotionBrewing;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.brewing.BrewingRecipe;
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
import net.minecraftforge.common.brewing.IBrewingRecipe;
import net.minecraftforge.common.brewing.VanillaBrewingRecipe;
import org.apache.logging.log4j.LogManager;
Expand All @@ -16,36 +16,37 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class BrewingRecipeMaker {
private static final Logger LOGGER = LogManager.getLogger();

public static List<IJeiBrewingRecipe> getBrewingRecipes(IIngredientManager ingredientManager, IVanillaRecipeFactory vanillaRecipeFactory) {
Collection<IBrewingRecipe> brewingRecipes = BrewingRecipeRegistry.getRecipes();
public static List<IJeiBrewingRecipe> getBrewingRecipes(
IIngredientManager ingredientManager,
IVanillaRecipeFactory vanillaRecipeFactory,
PotionBrewing potionBrewing
) {
Collection<IBrewingRecipe> brewingRecipes = potionBrewing.getRecipes();

Set<IJeiBrewingRecipe> recipes = brewingRecipes.stream()
.filter(VanillaBrewingRecipe.class::isInstance)
.map(VanillaBrewingRecipe.class::cast)
.findFirst()
.map(vanillaBrewingRecipe ->
BrewingRecipeMakerCommon.getVanillaBrewingRecipes(
vanillaRecipeFactory,
ingredientManager,
vanillaBrewingRecipe::getOutput
)
)
.orElseGet(HashSet::new);
Set<IJeiBrewingRecipe> recipes = BrewingRecipeMakerCommon.getVanillaBrewingRecipes(
vanillaRecipeFactory,
ingredientManager,
potionBrewing
);

addModdedBrewingRecipes(
vanillaRecipeFactory,
brewingRecipes,
recipes
);

return new ArrayList<>(recipes);
List<IJeiBrewingRecipe> recipeList = new ArrayList<>(recipes);
recipeList.sort(Comparator.comparingInt(IJeiBrewingRecipe::getBrewingSteps));

return recipeList;
}

private static void addModdedBrewingRecipes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ public boolean isHandled(SmithingRecipe recipe) {

@Override
public List<IJeiBrewingRecipe> getBrewingRecipes(IIngredientManager ingredientManager, IVanillaRecipeFactory vanillaRecipeFactory, PotionBrewing potionBrewing) {
return BrewingRecipeMaker.getBrewingRecipes(ingredientManager, vanillaRecipeFactory);
return BrewingRecipeMaker.getBrewingRecipes(ingredientManager, vanillaRecipeFactory, potionBrewing);
}
}
4 changes: 0 additions & 4 deletions ForgeApi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ minecraft {
// no runs are configured for API
}

tasks.jar {
finalizedBy("reobfJar")
}

val sourcesJar = tasks.named<Jar>("sourcesJar")

artifacts {
Expand Down

0 comments on commit 7b3e0d6

Please sign in to comment.