-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key Binds API #59
base: 1.20
Are you sure you want to change the base?
Key Binds API #59
Conversation
Now is the time for any last-minute bikesheds on where to put the keybindings API, since I know people are unhappy with |
you could make an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I know you talked about supporting some combination keybinds, not sure if that should be an extra PR or not, but its definitely something to discuss further
library/gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/api/KeyBindingRegistry.java
Outdated
Show resolved
Hide resolved
library/gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/api/KeyBindingRegistry.java
Outdated
Show resolved
Hide resolved
...gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/impl/KeyBindingRegistryImpl.java
Outdated
Show resolved
Hide resolved
...y_bindings/src/main/java/org/quiltmc/qsl/key/bindings/mixin/client/KeyBindingEntryMixin.java
Outdated
Show resolved
Hide resolved
library/gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/api/KeyBindingRegistry.java
Outdated
Show resolved
Hide resolved
library/gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/api/KeyBindingRegistry.java
Outdated
Show resolved
Hide resolved
...gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/impl/KeyBindingRegistryImpl.java
Outdated
Show resolved
Hide resolved
...gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/impl/KeyBindingRegistryImpl.java
Outdated
Show resolved
Hide resolved
...gui/key_bindings/src/main/java/org/quiltmc/qsl/key/bindings/impl/KeyBindingRegistryImpl.java
Outdated
Show resolved
Hide resolved
* | ||
* <pre> | ||
* {@code | ||
* public static final KeyBinding EXAMPLE_KEY_BIND = KeyBinding.registerKeyBinding( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* public static final KeyBinding EXAMPLE_KEY_BIND = KeyBinding.registerKeyBinding( | |
* public static final KeyBinding EXAMPLE_KEY_BIND = KeyBindingRegistry.registerKeyBinding( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whoops, I'll fix that
import net.minecraft.text.Text; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public interface ConflictTooltipOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could either be exposed as API as it could have some functionality or make it slightly clearer that it's internal with @ApiStatus.Internal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was thinking of replacing the interface mixin with the two accessors that I've done for resource pack tooltips; I think it's much cleaner than the current one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and nevermind, while the accessor does simply a bit of code, ConflictTooltipOwner will still be needed;
I'll mark it as internal
* @param includeVanilla {@code true} if vanilla entries should be included, else {@code false} | ||
* @return a map containing all modded (and optionally vanilla) key binds | ||
*/ | ||
public static Map<KeyBind, Boolean> getAllKeyBinds(boolean includeVanilla) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really should use fastutil's Object2BooleanMap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably abandon the Map<KeyBind, Boolean> approach once on the Pink stage, because having some sort of QuiltKeyBinds
would probably be better than a map between keybinds and the extra info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably would be a good idea to encapsulate the inner map so the api can be a little more resistant to change.
Now that I'm thinking of it, probably should be |
I thought about it (after all, FAPI used |
Oh, this is definitely not ready yet, I just needed an easy way to sync progress between computers
It's alive!
If everything goes right, tomorrow we'll have a PR!
Required for translatable texts to work on the tooltips
I'll finish it at my other PC
wait, so, tabs are actually okay?
I have a plan to properly fix it, but now, it's icon time
Also, begin to implement unused_key_binds
mind's currently empty, but i'll find a better way to do things
It's gone!
A built-from-scratch API that covers Fabric Key Binding API's functionality and more
The PR was planned in two stages: Blue and Pink. The implemented feature set of Blue was:
(!)
indicator to the key text itself for accessibility reasonsCurrently, work is being done on the Pink feature set:
./config/qsl/key_binds.json
allowing for our own key bind extensions (WIP)Outdated but relevant information about the stages is available in #61