aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/dulkirfabric
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/dulkirfabric')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/MouseMixin.java43
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java25
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java9
3 files changed, 77 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());
+ }
+
+}
+
diff --git a/src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java
new file mode 100644
index 0000000..0270251
--- /dev/null
+++ b/src/main/java/com/dulkirfabric/mixin/render/LoomScreenMixin.java
@@ -0,0 +1,25 @@
+package com.dulkirfabric.mixin.render;
+
+import com.dulkirfabric.features.InventoryScale;
+import net.minecraft.block.entity.BannerPattern;
+import net.minecraft.client.gui.DrawContext;
+import net.minecraft.client.gui.screen.ingame.LoomScreen;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NbtCompound;
+import net.minecraft.nbt.NbtList;
+import net.minecraft.registry.entry.RegistryEntry;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
+
+@Mixin(LoomScreen.class)
+public class LoomScreenMixin {
+ @Inject(method = "drawBanner", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
+ public void onCreateMatrix(DrawContext context, RegistryEntry<BannerPattern> pattern, int x, int y, CallbackInfo ci, NbtCompound nbtCompound, NbtList nbtList, ItemStack itemStack, MatrixStack matrixStack) {
+ matrixStack.scale(InventoryScale.INSTANCE.getScale(), InventoryScale.INSTANCE.getScale(), 1F);
+ }
+}
+
diff --git a/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java b/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java
new file mode 100644
index 0000000..9ab55ae
--- /dev/null
+++ b/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java
@@ -0,0 +1,9 @@
+package com.dulkirfabric.mixin.render;
+
+import net.minecraft.client.MinecraftClient;
+import org.spongepowered.asm.mixin.Mixin;
+
+@Mixin(MinecraftClient.class)
+public class MinecraftClientMixin {
+
+}