diff --git a/src/main/java/com/mdlc/universalshortcuts/mixin/KeyboardHandlerMixin.java b/src/main/java/com/mdlc/universalshortcuts/mixin/KeyboardHandlerMixin.java index 8ed3bf8..a20d40e 100644 --- a/src/main/java/com/mdlc/universalshortcuts/mixin/KeyboardHandlerMixin.java +++ b/src/main/java/com/mdlc/universalshortcuts/mixin/KeyboardHandlerMixin.java @@ -11,16 +11,30 @@ @Mixin(KeyboardHandler.class) public abstract class KeyboardHandlerMixin { + /** + * Remaps a chunk debug key. + *
+ * Chunk debug keys are not accessible in vanilla, but can be activated through modifications. + */ @ModifyVariable(method = "handleChunkDebugKeys", at = @At("HEAD"), argsOnly = true) private int remapChunkDebugKey(int keyCode) { return Utils.remapKeyCodeToQWERTY(keyCode); } + /** + * Remaps a debug key. + *
+ * The Toggle Narrator key is not remapped; see issue #3.
+ */
@ModifyVariable(method = "handleDebugKeys", at = @At("HEAD"), argsOnly = true)
private int remapDebugKey(int keyCode) {
return Utils.remapKeyCodeToQWERTY(keyCode);
}
+ /**
+ * Remaps the debug key that crashes the game when held for 10 seconds.
+ */
// We do not inject in InputConstants#isKeyDown because other mods might use it with an already remapped key code.
// This is also why this injector is so complicated. The @Slice is there to ensure we only match the right calls.
@ModifyArg(
@@ -31,7 +45,7 @@ private int remapDebugKey(int keyCode) {
to = @At(value = "FIELD", target = "Lnet/minecraft/client/KeyboardHandler;debugCrashKeyReportedCount:J", ordinal = 0)
)
)
- private int remapIsKeyDownArgument(int keyCode) {
+ private int remapDebugCrashKey(int keyCode) {
return Utils.remapKeyCodeToQWERTY(keyCode);
}
}
diff --git a/src/main/java/com/mdlc/universalshortcuts/mixin/ScreenMixin.java b/src/main/java/com/mdlc/universalshortcuts/mixin/ScreenMixin.java
index 65f583f..4731417 100644
--- a/src/main/java/com/mdlc/universalshortcuts/mixin/ScreenMixin.java
+++ b/src/main/java/com/mdlc/universalshortcuts/mixin/ScreenMixin.java
@@ -11,6 +11,9 @@
@Mixin(Screen.class)
public abstract class ScreenMixin extends AbstractContainerEventHandler {
+ /**
+ * Remaps the key that is used by the Select All shortcut to be A on all keyboards.
+ */
@Inject(method = "isSelectAll", at = @At("HEAD"), cancellable = true)
private static void onIsSelectAll(int keyCode, CallbackInfoReturnable