Skip to content

Commit cf1d917

Browse files
committed
Fix creative tab scrolling being broken
1 parent d6c1a18 commit cf1d917

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/de/siphalor/mousewheelie/client/mixin/gui/screen/MixinCreativeInventoryScreen.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ public MixinCreativeInventoryScreen(CreativeInventoryScreen.CreativeScreenHandle
5555
@Override
5656
public ScrollAction mouseWheelie_onMouseScrolledSpecial(double mouseX, double mouseY, double scrollAmount) {
5757
if (MWConfig.scrolling.scrollCreativeMenuTabs) {
58-
boolean yOverTopTabs = (-32 <= mouseY && mouseY <= 0);
59-
boolean yOverBottomTabs = (this.backgroundHeight <= mouseY && mouseY <= this.backgroundHeight + 32);
60-
boolean overTabs = (0 <= mouseX && mouseX <= this.backgroundWidth) && (yOverTopTabs || yOverBottomTabs);
58+
double relMouseY = mouseY - this.y;
59+
double relMouseX = mouseX - this.x;
60+
boolean yOverTopTabs = (-32 <= relMouseY && relMouseY <= 0);
61+
boolean yOverBottomTabs = (this.backgroundHeight <= relMouseY && relMouseY <= this.backgroundHeight + 32);
62+
boolean overTabs = (0 <= relMouseX && relMouseX <= this.backgroundWidth) && (yOverTopTabs || yOverBottomTabs);
6163

6264
if (overTabs) {
6365
if (FabricLoader.getInstance().isModLoaded("fabric") || FabricLoader.getInstance().isModLoaded("fabric-item-groups")) {

0 commit comments

Comments
 (0)