From 62012c9c40a5fb6a511c05b20f4517cc1d8601a4 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 1 Apr 2019 19:34:19 +0200 Subject: [PATCH] Version 1.0.5 Fix incompatibility with REI --- gradle.properties | 4 ++-- .../siphalor/mousewheelie/client/mixin/MixinMouse.java | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 466903fd..00eb8784 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,12 +4,12 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use minecraft_version=19w13b - yarn_mappings=19w13b.1 + yarn_mappings=19w13b.8 loader_version=0.3.7.109 # Mod Properties mod_id = mousewheelie - mod_version = 1.0.4 + mod_version = 1.0.5 maven_group = de.siphalor archives_base_name = mousewheelie diff --git a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMouse.java b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMouse.java index 032f0052..ccac1d0d 100644 --- a/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMouse.java +++ b/src/main/java/de/siphalor/mousewheelie/client/mixin/MixinMouse.java @@ -18,9 +18,16 @@ public class MixinMouse { @Shadow @Final private MinecraftClient client; + @Shadow private double x; + + @Shadow private double y; + // Thanks to Danielshe @Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Screen;mouseScrolled(DDD)Z", ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT) - public void onMouseScrolled(long long_1, double double_1, double double_2, CallbackInfo callbackInfo, double scrollAmount, double mouseX, double mouseY) { + public void onMouseScrolled(long windowHandle, double double_1, double scroll, CallbackInfo callbackInfo) { + double mouseX = this.x * (double) this.client.window.getScaledWidth() / (double) this.client.window.getScaleFactor(); + double mouseY = this.y * (double) this.client.window.getScaledWidth() / (double) this.client.window.getScaleFactor(); + double scrollAmount = scroll * this.client.options.mouseWheelSensitivity; if(this.client.currentScreen instanceof IContainerScreen) { if(((IContainerScreen) this.client.currentScreen).mouseWheelie_onMouseScroll(mouseX, mouseY, scrollAmount)) { callbackInfo.cancel();