diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java index 1f44adaa4..8ab4f5e3d 100644 --- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java @@ -134,6 +134,11 @@ public class ContainerScreenOverlay extends Widget { public boolean changeFocus(boolean boolean_1) { return false; } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY); + } }); widgets.add(buttonRight = new ButtonWidget(rectangle.x + rectangle.width - 18, rectangle.y + (RoughlyEnoughItemsCore.getConfigManager().getConfig().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + 5, 16, 16, new TranslatableText("text.rei.right_arrow")) { @Override @@ -153,6 +158,11 @@ public class ContainerScreenOverlay extends Widget { public boolean changeFocus(boolean boolean_1) { return false; } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY); + } }); } @@ -203,6 +213,11 @@ public class ContainerScreenOverlay extends Widget { public boolean changeFocus(boolean boolean_1) { return false; } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY); + } }); if (RoughlyEnoughItemsCore.getConfigManager().getConfig().doesShowUtilsButtons()) { widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 55 : 35, 10, 20, 20, "") { @@ -226,6 +241,11 @@ public class ContainerScreenOverlay extends Widget { public boolean changeFocus(boolean boolean_1) { return false; } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY); + } }); int xxx = RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? window.getScaledWidth() - 30 : 10; for (Weather weather : Weather.values()) { @@ -253,6 +273,11 @@ public class ContainerScreenOverlay extends Widget { public boolean changeFocus(boolean boolean_1) { return false; } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY); + } }); xxx += RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel() ? -25 : 25; } @@ -307,6 +332,11 @@ public class ContainerScreenOverlay extends Widget { setBlitOffset(300); super.lateRender(mouseX, mouseY, delta); } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return isNotInExclusionZones(mouseX, mouseY) && super.containsMouse(mouseX, mouseY); + } }); else toggleButtonWidget = null; @@ -594,7 +624,7 @@ public class ContainerScreenOverlay extends Widget { public boolean isInside(double mouseX, double mouseY) { if (!rectangle.contains(mouseX, mouseY)) return false; - for (DisplayHelper.DisplayBoundsHandler handler : RoughlyEnoughItemsCore.getDisplayHelper().getSortedBoundsHandlers(MinecraftClient.getInstance().currentScreen.getClass())) { + for (DisplayHelper.DisplayBoundsHandler<?> handler : RoughlyEnoughItemsCore.getDisplayHelper().getSortedBoundsHandlers(MinecraftClient.getInstance().currentScreen.getClass())) { ActionResult in = handler.isInZone(!RoughlyEnoughItemsCore.getConfigManager().getConfig().isLeftHandSidePanel(), mouseX, mouseY); if (in != ActionResult.PASS) return in == ActionResult.SUCCESS; @@ -602,6 +632,18 @@ public class ContainerScreenOverlay extends Widget { return true; } + public boolean isNotInExclusionZones(double mouseX, double mouseY) { + for (DisplayHelper.DisplayBoundsHandler<?> handler : RoughlyEnoughItemsCore.getDisplayHelper().getSortedBoundsHandlers(MinecraftClient.getInstance().currentScreen.getClass())) { + ActionResult in = handler.isInZone(true, mouseX, mouseY); + if (in != ActionResult.PASS) + return in == ActionResult.SUCCESS; + in = handler.isInZone(false, mouseX, mouseY); + if (in != ActionResult.PASS) + return in == ActionResult.SUCCESS; + } + return true; + } + public boolean isInside(Point point) { return isInside(point.getX(), point.getY()); } |
