Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/dev/cigarette/helper/KeybindHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public static void forceBlockInputs(Object module, InputBlocker blocker) {
public static void unblock() {
blockedInputs = null;
blockingModule = null;
for(MinecraftKeybind keybind : wrappedBindings) {
keybind.release();
}
updateKeyStates();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public boolean processMouse(int button, int action, int modifiers) {
for (MinecraftKeybind binding : blockedBindings) {
if (!binding.isMouse) continue;
if (!binding.isOfMouse(button)) continue;
System.out.println("Processing Mouse | button=" + button + " action=" + action);
binding.physicalAction(action);
return true;
}
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/dev/cigarette/mixin/KeyboardMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.cigarette.helper.KeybindHelper;
import net.minecraft.client.Keyboard;
import net.minecraft.client.MinecraftClient;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -17,9 +18,13 @@ private void onKey(long window, int key, int scancode, int action, int modifiers
ci.cancel();
return;
}
if (client.currentScreen == null && (KeybindHelper.handleKeyByGUI(client, key, scancode, action, modifiers) || KeybindHelper.handleBlockedKeyInputs(client, key, scancode, action, modifiers) || KeybindHelper.handleCustomKeys(client, key, scancode, action, modifiers))) {
ci.cancel();
return;
if (client.currentScreen == null) {
if (KeybindHelper.handleKeyByGUI(client, key, scancode, action, modifiers) || KeybindHelper.handleBlockedKeyInputs(client, key, scancode, action, modifiers) || KeybindHelper.handleCustomKeys(client, key, scancode, action, modifiers)) {
ci.cancel();
return;
}
} else if (action == GLFW.GLFW_RELEASE) {
KeybindHelper.handleCustomKeys(client, key, scancode, action, modifiers);
}
}
}
11 changes: 8 additions & 3 deletions src/main/java/dev/cigarette/mixin/MouseMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.cigarette.helper.KeybindHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Mouse;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -23,9 +24,13 @@ private void onMouseButton(long window, int button, int action, int mods, Callba
ci.cancel();
return;
}
if (client.currentScreen == null && (KeybindHelper.handleBlockedMouseInputs(client, button, action, mods) || KeybindHelper.handleCustomMouse(client, button, action, mods))) {
ci.cancel();
return;
if (client.currentScreen == null) {
if (KeybindHelper.handleBlockedMouseInputs(client, button, action, mods) || KeybindHelper.handleCustomMouse(client, button, action, mods)) {
ci.cancel();
return;
}
} else if (action == GLFW.GLFW_RELEASE) {
KeybindHelper.handleCustomMouse(client, button, action, mods);
}
}
}