Skip to content

Commit

Permalink
Disable wheel tweak on bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
YaLTeR committed Oct 29, 2024
1 parent c45bf2c commit e3e66e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/yalter/mousetweaks/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ public static boolean onMouseScrolled(Screen screen, double x, double y, double
if (selectedSlot == null || handler.isIgnored(selectedSlot))
return false;

ItemStack selectedSlotStack = selectedSlot.getItem();

// Bundles have their own scrolling, let's not interfere with it. Unfortunately, default Fabric hooks don't
// give us the return value of the screen's own scroll handler, which we could check to see if a bundle or some
// other item handled the scroll. So we hardcode the bundle here.
if (selectedSlotStack.getItem() instanceof BundleItem)
return false;

// If we're above a valid slot, always handle the scroll, even if no items are moved. This is to prevent
// surprising behavior when e.g. the player scrolls items out of a slot, the items run out and suddenly
// scrolling starts doing something else (being handled by another mod).
Expand Down Expand Up @@ -344,7 +352,6 @@ public static boolean onMouseScrolled(Screen screen, double x, double y, double
}

// Return if the selected slot is empty.
ItemStack selectedSlotStack = selectedSlot.getItem();
if (selectedSlotStack.isEmpty())
return true;

Expand Down

0 comments on commit e3e66e8

Please sign in to comment.