diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/screen/MixinCreativeInventoryScreen.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/screen/MixinCreativeInventoryScreen.java index cc9e0a19..dde3bdc7 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/screen/MixinCreativeInventoryScreen.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/gui/screen/MixinCreativeInventoryScreen.java @@ -55,9 +55,11 @@ public MixinCreativeInventoryScreen(CreativeInventoryScreen.CreativeScreenHandle @Override public ScrollAction mouseWheelie_onMouseScrolledSpecial(double mouseX, double mouseY, double scrollAmount) { if (MWConfig.scrolling.scrollCreativeMenuTabs) { - boolean yOverTopTabs = (-32 <= mouseY && mouseY <= 0); - boolean yOverBottomTabs = (this.backgroundHeight <= mouseY && mouseY <= this.backgroundHeight + 32); - boolean overTabs = (0 <= mouseX && mouseX <= this.backgroundWidth) && (yOverTopTabs || yOverBottomTabs); + double relMouseY = mouseY - this.y; + double relMouseX = mouseX - this.x; + boolean yOverTopTabs = (-32 <= relMouseY && relMouseY <= 0); + boolean yOverBottomTabs = (this.backgroundHeight <= relMouseY && relMouseY <= this.backgroundHeight + 32); + boolean overTabs = (0 <= relMouseX && relMouseX <= this.backgroundWidth) && (yOverTopTabs || yOverBottomTabs); if (overTabs) { if (FabricLoader.getInstance().isModLoaded("fabric") || FabricLoader.getInstance().isModLoaded("fabric-item-groups")) {