Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/main/java/mezz/jei/gui/recipes/RecipesGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class RecipesGui extends GuiScreen implements IRecipesGui, IShowsRecipeFo
private int guiTop;

private boolean init = false;
private boolean openingGui = false;

public RecipesGui(IRecipeRegistry recipeRegistry, IngredientRegistry ingredientRegistry) {
this.logic = new RecipeGuiLogic(recipeRegistry, this, ingredientRegistry);
Expand Down Expand Up @@ -477,17 +478,27 @@ public void close() {
public <V> void show(IFocus<V> focus) {
focus = Focus.check(focus);

if (logic.setFocus(focus)) {
open();
openingGui = true;
try {
if (logic.setFocus(focus)) {
open();
}
} finally {
openingGui = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in a try-finally block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure it always gets set back to false, is it actually a concern? I don't know.

}
}

@Override
public void showCategories(List<String> recipeCategoryUids) {
ErrorUtil.checkNotEmpty(recipeCategoryUids, "recipeCategoryUids");

if (logic.setCategoryFocus(recipeCategoryUids)) {
open();
openingGui = true;
try {
if (logic.setCategoryFocus(recipeCategoryUids)) {
open();
}
} finally {
openingGui = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in a try-finally block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure it always gets set back to false, is it actually a concern? I don't know.

}
}

Expand Down Expand Up @@ -658,7 +669,9 @@ private List<String> searchButtonTooltip() {

@Override
public void onStateChange() {
updateLayout();
if (!openingGui) {
updateLayout();
}
}

@Nullable
Expand Down