Fixes #18 - Reset cursor when screen changes

This commit is contained in:
MrMelon54 committed 2024-01-30 10:22:31 +00:00
1 parent be1ec18a31
commit b3579dc964
2 files changed
+26 -2

No files matched your search

@@ -0,0 +1,23 @@
package com.mrmelon54.DraggableLists.mixin;
import com.mojang.blaze3d.platform.Window;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public abstract class MinecraftMixin {
@Shadow
public abstract Window getWindow();
@Inject(method = "setScreen", at = @At("HEAD"))
private void injectedSetScreen(Screen screen, CallbackInfo ci) {
// reset cursor when screen changes
GLFW.glfwSetCursor(getWindow().getWindow(), GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR));
}
}
@@ -4,11 +4,12 @@
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
"packs.PackSelectionModelMixin",
"MinecraftMixin",
"packs.PackSelectionModel_EntryBaseMixin",
"packs.PackSelectionModelMixin",
"packs.PackSelectionScreenMixin",
"packs.TransferableSelectionListMixin",
"packs.TransferableSelectionList_PackEntryMixin",
"packs.TransferableSelectionListMixin",
"server.JoinMultiplayerScreenMixin",
"server.OnlineServerEntryMixin",
"server.ServerListMixin",