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 cir) { cir.setReturnValue( @@ -21,6 +24,9 @@ private static void onIsSelectAll(int keyCode, CallbackInfoReturnable c ); } + /** + * Remaps the key that is used by the Copy shortcut to be C on all keyboards. + */ @Inject(method = "isCopy", at = @At("HEAD"), cancellable = true) private static void onIsCopy(int keyCode, CallbackInfoReturnable cir) { cir.setReturnValue( @@ -31,6 +37,9 @@ private static void onIsCopy(int keyCode, CallbackInfoReturnable cir) { ); } + /** + * Remaps the key that is used by the Paste shortcut to be V on all keyboards. + */ @Inject(method = "isPaste", at = @At("HEAD"), cancellable = true) private static void onIsPaste(int keyCode, CallbackInfoReturnable cir) { cir.setReturnValue( @@ -41,6 +50,9 @@ private static void onIsPaste(int keyCode, CallbackInfoReturnable cir) ); } + /** + * Remaps the key that is used by the Cut shortcut to be X on all keyboards. + */ @Inject(method = "isCut", at = @At("HEAD"), cancellable = true) private static void onIsCut(int keyCode, CallbackInfoReturnable cir) { cir.setReturnValue(