Skip to content

Commit

Permalink
fix: check recipes in order of most to least input ingredients
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Feb 17, 2024
1 parent 305d6f9 commit e6cf2fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ private boolean hasOccupiedInputSlots() {

private Optional<FusingMachineRecipe> findValidRecipe() {
return level.getRecipeManager().getAllRecipesFor(ToolsRegistry.FUSING_MACHINE_RECIPE_TYPE.get()).stream()
.sorted((a, b) -> b.ingredients.size() - a.ingredients.size()) // prioritise recipes with more ingredients
.filter(this::recipeMatchesInput)
.findFirst();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ private boolean hasItemInAnySlot() {

private Optional<SuperCoolerRecipe> findValidRecipe() {
return level.getRecipeManager().getAllRecipesFor(ToolsRegistry.SUPER_COOLER_RECIPE_TYPE.get()).stream()
.sorted((a, b) -> b.ingredients.size() - a.ingredients.size()) // prioritise recipes with more ingredients
.filter(this::recipeMatchesInput)
.findFirst();
}
Expand Down

0 comments on commit e6cf2fc

Please sign in to comment.