diff --git a/src/main/java/mezz/jei/gui/GuiEventHandler.java b/src/main/java/mezz/jei/gui/GuiEventHandler.java index 5350dfbd2..2321727e9 100644 --- a/src/main/java/mezz/jei/gui/GuiEventHandler.java +++ b/src/main/java/mezz/jei/gui/GuiEventHandler.java @@ -17,11 +17,13 @@ public class GuiEventHandler { private final IngredientListOverlay ingredientListOverlay; + private final GuiScreenHelper guiScreenHelper; private final LeftAreaDispatcher leftAreaDispatcher; private final RecipeRegistry recipeRegistry; private boolean drawnOnBackground = false; - public GuiEventHandler(LeftAreaDispatcher leftAreaDispatcher, IngredientListOverlay ingredientListOverlay, RecipeRegistry recipeRegistry) { + public GuiEventHandler(GuiScreenHelper guiScreenHelper, LeftAreaDispatcher leftAreaDispatcher, IngredientListOverlay ingredientListOverlay, RecipeRegistry recipeRegistry) { + this.guiScreenHelper = guiScreenHelper; this.leftAreaDispatcher = leftAreaDispatcher; this.ingredientListOverlay = ingredientListOverlay; this.recipeRegistry = recipeRegistry; @@ -31,28 +33,29 @@ public GuiEventHandler(LeftAreaDispatcher leftAreaDispatcher, IngredientListOver public void onOverlayToggle(OverlayToggleEvent event) { GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen; ingredientListOverlay.updateScreen(currentScreen, true); - leftAreaDispatcher.updateScreen(currentScreen); + leftAreaDispatcher.updateScreen(currentScreen, false); } @SubscribeEvent public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) { GuiScreen gui = event.getGui(); ingredientListOverlay.updateScreen(gui, false); - leftAreaDispatcher.updateScreen(gui); + leftAreaDispatcher.updateScreen(gui, false); } @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { GuiScreen gui = event.getGui(); ingredientListOverlay.updateScreen(gui, false); - leftAreaDispatcher.updateScreen(gui); + leftAreaDispatcher.updateScreen(gui, false); } @SubscribeEvent public void onDrawBackgroundEventPost(GuiScreenEvent.BackgroundDrawnEvent event) { GuiScreen gui = event.getGui(); - ingredientListOverlay.updateScreen(gui, false); - leftAreaDispatcher.updateScreen(gui); + boolean exclusionAreasChanged = guiScreenHelper.updateGuiExclusionAreas(); + ingredientListOverlay.updateScreen(gui, exclusionAreasChanged); + leftAreaDispatcher.updateScreen(gui, exclusionAreasChanged); drawnOnBackground = true; ingredientListOverlay.drawScreen(gui.mc, event.getMouseX(), event.getMouseY(), gui.mc.getRenderPartialTicks()); @@ -74,7 +77,7 @@ public void onDrawScreenEventPost(GuiScreenEvent.DrawScreenEvent.Post event) { GuiScreen gui = event.getGui(); ingredientListOverlay.updateScreen(gui, false); - leftAreaDispatcher.updateScreen(gui); + leftAreaDispatcher.updateScreen(gui, false); if (!drawnOnBackground) { ingredientListOverlay.drawScreen(gui.mc, event.getMouseX(), event.getMouseY(), gui.mc.getRenderPartialTicks()); diff --git a/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java b/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java index 9aff325ad..bd49d97eb 100644 --- a/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java +++ b/src/main/java/mezz/jei/gui/overlay/IngredientListOverlay.java @@ -95,8 +95,7 @@ public void updateScreen(@Nullable GuiScreen guiScreen, boolean forceUpdate) { this.ghostIngredientDragManager.stopDrag(); } } else { - boolean exclusionAreasChanged = guiScreenHelper.updateGuiExclusionAreas(); - if (exclusionAreasChanged || this.guiProperties == null || !GuiProperties.areEqual(this.guiProperties, guiProperties) || forceUpdate) { + if (forceUpdate || this.guiProperties == null || !GuiProperties.areEqual(this.guiProperties, guiProperties)) { this.guiProperties = guiProperties; this.displayArea = getDisplayArea(guiProperties); diff --git a/src/main/java/mezz/jei/gui/overlay/bookmarks/LeftAreaDispatcher.java b/src/main/java/mezz/jei/gui/overlay/bookmarks/LeftAreaDispatcher.java index fb7eb0eb7..7bfea1628 100644 --- a/src/main/java/mezz/jei/gui/overlay/bookmarks/LeftAreaDispatcher.java +++ b/src/main/java/mezz/jei/gui/overlay/bookmarks/LeftAreaDispatcher.java @@ -66,7 +66,7 @@ public void drawTooltips(Minecraft minecraft, int mouseX, int mouseY) { } } - public void updateScreen(@Nullable GuiScreen guiScreen) { + public void updateScreen(@Nullable GuiScreen guiScreen, boolean forceUpdate) { canShow = false; if (hasContent()) { IGuiProperties currentGuiProperties = guiScreenHelper.getGuiProperties(guiScreen); @@ -74,8 +74,7 @@ public void updateScreen(@Nullable GuiScreen guiScreen) { guiProperties = null; } else { ILeftAreaContent content = contents.get(current); - boolean exclusionAreasChanged = guiScreenHelper.updateGuiExclusionAreas(); - if (exclusionAreasChanged || !GuiProperties.areEqual(guiProperties, currentGuiProperties)) { + if (forceUpdate || !GuiProperties.areEqual(guiProperties, currentGuiProperties)) { Set guiExclusionAreas = guiScreenHelper.getGuiExclusionAreas(); guiProperties = currentGuiProperties; makeDisplayArea(guiProperties); diff --git a/src/main/java/mezz/jei/startup/JeiStarter.java b/src/main/java/mezz/jei/startup/JeiStarter.java index f7b5117da..b2fdb7980 100644 --- a/src/main/java/mezz/jei/startup/JeiStarter.java +++ b/src/main/java/mezz/jei/startup/JeiStarter.java @@ -109,7 +109,7 @@ public void start(List plugins) { LeftAreaDispatcher leftAreaDispatcher = new LeftAreaDispatcher(guiScreenHelper); leftAreaDispatcher.addContent(bookmarkOverlay); - GuiEventHandler guiEventHandler = new GuiEventHandler(leftAreaDispatcher, ingredientListOverlay, recipeRegistry); + GuiEventHandler guiEventHandler = new GuiEventHandler(guiScreenHelper, leftAreaDispatcher, ingredientListOverlay, recipeRegistry); Internal.setGuiEventHandler(guiEventHandler); InputHandler inputHandler = new InputHandler(jeiRuntime, ingredientRegistry, ingredientListOverlay, guiScreenHelper, leftAreaDispatcher, bookmarkList); Internal.setInputHandler(inputHandler);