Skip to content

Commit

Permalink
Fix #2897 Hovering over recipe tabs can ignore key inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Jul 18, 2022
1 parent 1e13ab9 commit 96f6117
Showing 1 changed file with 9 additions and 5 deletions.
Expand Up @@ -8,6 +8,7 @@
import mezz.jei.api.ingredients.IIngredientRenderer;
import mezz.jei.api.ingredients.ITypedIngredient;
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.common.config.KeyBindings;
import mezz.jei.common.gui.textures.Textures;
import mezz.jei.common.ingredients.RegisteredIngredients;
import mezz.jei.common.input.IKeyBindings;
Expand Down Expand Up @@ -41,12 +42,15 @@ public Optional<IUserInputHandler> handleUserInput(Screen screen, UserInput inpu
if (!isMouseOver(input.getMouseX(), input.getMouseY())) {
return Optional.empty();
}
if (!input.isSimulate()) {
logic.setRecipeCategory(category);
SoundManager soundHandler = Minecraft.getInstance().getSoundManager();
soundHandler.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
if (input.is(keyBindings.getLeftClick())) {
if (!input.isSimulate()) {
logic.setRecipeCategory(category);
SoundManager soundHandler = Minecraft.getInstance().getSoundManager();
soundHandler.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
return Optional.of(this);
}
return Optional.of(this);
return Optional.empty();
}

@Override
Expand Down

0 comments on commit 96f6117

Please sign in to comment.