diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-10-23 19:37:04 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-10-23 19:40:13 +0800 |
| commit | e644ebfbb3cb2a8a452693a710ae9beaaaef4c96 (patch) | |
| tree | 038a9d5ab6b09b6456bf9b82e1ad1e490ce0e7ee /runtime | |
| parent | 50205c79cdd5ceb97a2a154e8a70dd457a87733a (diff) | |
| download | RoughlyEnoughItems-e644ebfbb3cb2a8a452693a710ae9beaaaef4c96.tar.gz RoughlyEnoughItems-e644ebfbb3cb2a8a452693a710ae9beaaaef4c96.tar.bz2 RoughlyEnoughItems-e644ebfbb3cb2a8a452693a710ae9beaaaef4c96.zip | |
Fix #642
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListWidget.java | 23 | ||||
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java | 3 |
2 files changed, 22 insertions, 4 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListWidget.java index 495eac687..1763e2996 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryListWidget.java @@ -144,6 +144,21 @@ public class EntryListWidget extends WidgetWithBounds implements OverlayListWidg return fit; } + private boolean containsChecked(Point point) { + return containsChecked(point.x, point.y); + } + + private boolean containsChecked(double x, double y) { + if (!containsMouse(x, y)) return false; + Minecraft instance = Minecraft.getInstance(); + for (OverlayDecider decider : ScreenRegistry.getInstance().getDeciders(instance.screen)) { + InteractionResult result = decider.isInZone(x, y); + if (result != InteractionResult.PASS) + return result == InteractionResult.SUCCESS; + } + return true; + } + private static Rectangle updateInnerBounds(Rectangle bounds) { bounds = bounds.clone(); int widthReduction = (int) Math.round(bounds.width * (1 - ConfigObject.getInstance().getHorizontalEntriesBoundaries())); @@ -289,7 +304,7 @@ public class EntryListWidget extends WidgetWithBounds implements OverlayListWidg matrices.popPose(); } - if (containsMouse(mouseX, mouseY) && ClientHelper.getInstance().isCheating() && !minecraft.player.inventory.getCarried().isEmpty() && ClientHelperImpl.getInstance().canDeleteItems()) { + if (containsChecked(mouseX, mouseY) && ClientHelper.getInstance().isCheating() && !minecraft.player.inventory.getCarried().isEmpty() && ClientHelperImpl.getInstance().canDeleteItems()) { EntryStack<?> stack = EntryStacks.of(minecraft.player.inventory.getCarried().copy()); if (stack.getValueType() == FluidStack.class) { Item bucketItem = ((FluidStack) stack.getValue()).getFluid().getBucket(); @@ -334,7 +349,7 @@ public class EntryListWidget extends WidgetWithBounds implements OverlayListWidg @Override public boolean keyPressed(int int_1, int int_2, int int_3) { - if (containsMouse(PointHelper.ofMouse())) + if (containsChecked(PointHelper.ofMouse())) for (Widget widget : widgets) if (widget.keyPressed(int_1, int_2, int_3)) return true; @@ -464,7 +479,7 @@ public class EntryListWidget extends WidgetWithBounds implements OverlayListWidg @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { - if (containsMouse(mouseX, mouseY)) { + if (containsChecked(mouseX, mouseY)) { LocalPlayer player = minecraft.player; if (ClientHelper.getInstance().isCheating() && player != null && player.containerMenu != null && !player.inventory.getCarried().isEmpty() && ClientHelperImpl.getInstance().canDeleteItems()) { ClientHelper.getInstance().sendDeletePacket(); @@ -513,7 +528,7 @@ public class EntryListWidget extends WidgetWithBounds implements OverlayListWidg @Override public boolean containsMouse(double mouseX, double mouseY) { - return super.containsMouse(mouseX, mouseY) && bounds.contains(mouseX, mouseY); + return super.containsMouse(mouseX, mouseY) && containsChecked(mouseX, mouseY); } } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java index e91784f9f..883f62ec1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java @@ -27,7 +27,9 @@ import com.google.common.base.MoreObjects; import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; import me.shedaniel.rei.RoughlyEnoughItemsCore; +import me.shedaniel.rei.api.client.REIRuntime; import me.shedaniel.rei.api.client.config.ConfigObject; +import me.shedaniel.rei.api.client.overlay.ScreenOverlay; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.common.entry.EntryStack; @@ -93,6 +95,7 @@ public class EntryRegistryImpl implements EntryRegistry { entries = Lists.newCopyOnWriteArrayList(CollectionUtils.filterAndMap(reloadingRegistry, ((Predicate<HashedEntryStackWrapper>) HashedEntryStackWrapper::isEmpty).negate(), HashedEntryStackWrapper::unwrap)); reloadingRegistry = null; refilter(); + REIRuntime.getInstance().getOverlay().ifPresent(ScreenOverlay::queueReloadOverlay); } @Override |
