Allow raw key handlers to cancel keybindings (required for #305)

So that when you press e.g. Ctrl+Z, it doesn't trigger the keybinding bound to
Z (currently full brightness).
This commit is contained in:
Jonas Herzig
2020-11-06 14:10:26 +01:00
parent ccb08d37a7
commit 28facc430e
8 changed files with 73 additions and 62 deletions

View File

@@ -97,9 +97,8 @@ public class ReplayModSimplePathing extends EventRegistrations implements Module
settingsRegistry.set(Setting.AUTO_SYNC, active);
settingsRegistry.save();
});
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () -> {
if (guiPathing != null) guiPathing.deleteButtonPressed();
});
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () ->
guiPathing != null && guiPathing.deleteButtonPressed());
keyPositionKeyframe = core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.positionkeyframe", Keyboard.KEY_I, () -> {
if (guiPathing != null) guiPathing.toggleKeyframe(SPPath.POSITION, false);
}, true);

View File

@@ -468,10 +468,12 @@ public class GuiPathing {
});
}
public void deleteButtonPressed() {
public boolean deleteButtonPressed() {
if (mod.getSelectedPath() != null) {
toggleKeyframe(mod.getSelectedPath(), false);
return true;
}
return false;
}
private void startLoadingEntityTracker() {