From fe1aba56dedeb256353fe2d281dfe986b448909e Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Tue, 28 May 2024 16:09:49 +0200 Subject: Fix pet not being updated when selected with number keys (#1180) --- .../moulberry/notenoughupdates/events/SlotClickEvent.java | 11 +++++++++++ .../notenoughupdates/miscfeatures/PetInfoOverlay.java | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java index d8d3615d..f7a1e9b2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java @@ -30,6 +30,17 @@ public class SlotClickEvent extends NEUEvent { public final @NotNull Slot slot; public final int slotId; public int clickedButton; + /** + * Click types (along with the default keybind): + * + * + */ public int clickType; public boolean usePickblockInstead = false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index c823cf88..9d346638 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -691,7 +691,12 @@ public class PetInfoOverlay extends TextOverlay { @SubscribeEvent public void onStackClick(SlotClickEvent event) { - if (event.clickedButton != 0 && event.clickedButton != 1 && event.clickedButton != 2) return; + // 0 through 8 are the mouse as well as the keyboard buttons, allow all of those + if (event.clickedButton < 0 || event.clickedButton > 8) return; + // Ignore RMB clicks, which convert the pet to an item + if (event.clickedButton == 1 && event.clickType == 0) return; + // Ignore shift clicks, which don't work + if (event.clickType == 1) return; int slotIdMod = (event.slotId - 10) % 9; if (event.slotId >= 10 && event.slotId <= 43 && slotIdMod >= 0 && slotIdMod <= 6 && -- cgit