generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to 1.16.2 and fixed GLFW invalid key error
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/java/com/minenash/rebind_all_the_keys/mixin/InputKeyMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.minenash.rebind_all_the_keys.mixin; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.util.InputUtil; | ||
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.CallbackInfoReturnable; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(InputUtil.class) | ||
public class InputKeyMixin { | ||
|
||
@Inject(method = "isKeyPressed", at = @At("HEAD"), cancellable = true) | ||
private static void silenceError(long handle, int key, CallbackInfoReturnable<Boolean> callbackInfo) { | ||
if (key < -1) { | ||
callbackInfo.setReturnValue(false); | ||
callbackInfo.cancel(); | ||
} | ||
} | ||
} |