Skip to content

Commit

Permalink
closes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
mrshmllow committed Oct 6, 2021
1 parent df12959 commit 796a57e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public abstract class Pins {

@Inject(method = "keyPressed", at = @At(value = "HEAD"), cancellable = true)
public void add(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
if (this.searchField == null) return;

if (keyCode == GLFW.GLFW_KEY_F) {
RecipeAlternativesWidget alternatesWidget = ((RecipeBookResultsAccessor) this.recipesArea).getAlternatesWidget();
List<RecipeAlternativesWidget.AlternativeButtonWidget> alternativeButtons = ((RecipeAlternativesWidgetAccessor) alternatesWidget).getAlternativeButtons();
Expand All @@ -43,14 +45,12 @@ public void add(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable
RecipeResultCollection recipeResultCollection = new RecipeResultCollection(Collections.singletonList(((AlternativeButtonWidgetAccessor) alternativeButton).getRecipe()));
recipeResultCollection.initialize(this.recipeBook);
BetterRecipeBook.pinnedRecipeManager.addOrRemoveFavourite(recipeResultCollection);
assert this.searchField != null;
this.searchField.changeFocus(false);
this.refreshResults(false);
cir.setReturnValue(true);
}
}

assert this.searchField != null;
if (!this.searchField.keyPressed(keyCode, scanCode, modifiers)) {
for (AnimatedResultButton resultButton : ((RecipeBookResultsAccessor) this.recipesArea).getResultButtons()) {
if (resultButton.isHovered()) {
Expand Down

0 comments on commit 796a57e

Please sign in to comment.