aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/dulkirfabric/mixin/MouseMixin.java
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-06-26 22:01:52 -0500
committeringlettronald <inglettronald@gmail.com>2023-06-26 22:01:52 -0500
commitcacc7c10365c4ff9c20adde0f2bef7edd3c1cda0 (patch)
tree3dc4f9a05385d084cb0d4c9c43ead22503b57cd9 /src/main/java/com/dulkirfabric/mixin/MouseMixin.java
parent4e6af3727fc930d00a78fe91e19ba46f2dc63a28 (diff)
downloadDulkirMod-Fabric-cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0.tar.gz
DulkirMod-Fabric-cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0.tar.bz2
DulkirMod-Fabric-cacc7c10365c4ff9c20adde0f2bef7edd3c1cda0.zip
fixed inventory scaling
Diffstat (limited to 'src/main/java/com/dulkirfabric/mixin/MouseMixin.java')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/MouseMixin.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/MouseMixin.java b/src/main/java/com/dulkirfabric/mixin/MouseMixin.java
new file mode 100644
index 0000000..d86985d
--- /dev/null
+++ b/src/main/java/com/dulkirfabric/mixin/MouseMixin.java
@@ -0,0 +1,43 @@
+package com.dulkirfabric.mixin;
+
+import com.dulkirfabric.features.InventoryScale;
+import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
+import net.minecraft.client.Mouse;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(Mouse.class)
+public class MouseMixin {
+
+ @ModifyExpressionValue(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledWidth()I"))
+ public int onMouseButtonWidth(int originalScaledWidth) {
+ return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale());
+ }
+
+ @ModifyExpressionValue(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledHeight()I"))
+ public int onMouseButtonHeight(int originalScaledHeight) {
+ return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
+ }
+
+ @ModifyExpressionValue(method = "onCursorPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledWidth()I"))
+ public int onCursorPosWidth(int originalScaledWidth) {
+ return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale());
+ }
+
+ @ModifyExpressionValue(method = "onCursorPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledHeight()I"))
+ public int onCursorPosHeight(int originalScaledHeight) {
+ return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
+ }
+
+ @ModifyExpressionValue(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledWidth()I"))
+ public int onMouseScrollWidth(int originalScaledWidth) {
+ return (int) (originalScaledWidth / InventoryScale.INSTANCE.getScale());
+ }
+
+ @ModifyExpressionValue(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledHeight()I"))
+ public int onMouseScrollHeight(int originalScaledHeight) {
+ return (int) (originalScaledHeight / InventoryScale.INSTANCE.getScale());
+ }
+
+}
+