Fix not registering that a key is down just due to the gui screen not passing the press to the keybinding
@@ -41,9 +41,16 @@ public abstract class MekKeyHandler {
if (keyBinding.isKeyDown()) {
return true;
}
- InputMappings.Input key = keyBinding.getKey();
+ if (keyBinding.getKeyConflictContext().isActive() && keyBinding.getKeyModifier().isActive(keyBinding.getKeyConflictContext())) {
+ //Manually check in case keyBinding#pressed just never got a chance to be updated
+ return isKeyPressed(keyBinding);
+ }
//If we failed, due to us being a key modifier as our key, check the old way
- if (KeyModifier.isKeyCodeModifier(key)) {
+ return KeyModifier.isKeyCodeModifier(keyBinding.getKey()) && isKeyPressed(keyBinding);
+ }
+
+ private static boolean isKeyPressed(KeyBinding keyBinding) {
+ InputMappings.Input key = keyBinding.getKey();
int keyCode = key.getKeyCode();
if (keyCode != InputMappings.INPUT_INVALID.getKeyCode()) {
long windowHandle = Minecraft.getInstance().getMainWindow().getHandle();
@@ -56,7 +63,6 @@ public abstract class MekKeyHandler {
} catch (Exception ignored) {
}
}
- }
return false;
}
