diff options
author | Lulonaut <lulonaut@lulonaut.dev> | 2024-05-28 16:09:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 16:09:49 +0200 |
commit | fe1aba56dedeb256353fe2d281dfe986b448909e (patch) | |
tree | 224fce28d7e658d2dab92ec1dfaaf70bf18f4a71 | |
parent | a64f285a122663649fa8bfff4871ed6e22fc964c (diff) | |
download | NotEnoughUpdates-fe1aba56dedeb256353fe2d281dfe986b448909e.tar.gz NotEnoughUpdates-fe1aba56dedeb256353fe2d281dfe986b448909e.tar.bz2 NotEnoughUpdates-fe1aba56dedeb256353fe2d281dfe986b448909e.zip |
Fix pet not being updated when selected with number keys (#1180)
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java | 11 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java | 7 |
2 files changed, 17 insertions, 1 deletions
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): + * + * <ul> + * <li>0 : mouse click (either LMB or RMB)</li> + * <li>1 : Shift mouse click</li> + * <li>2 : hotbar keybind (0-9) -> see clickedButton</li> + * <li>3 : pick block (middle mouse button)</li> + * <li>4 : drop block (Q)</li> + * </ul> + */ 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 && |