Rift
Rift copied to clipboard
Fix crash when a keybinding with a category not known to MC gets added
When a KeyBinding gets added that uses a category that's unknown to Minecraft, opening the "Controls" option dialog results in a crash.
This is because KeyBinding.java initializes a map (called CATEGORY_ORDER) from category name to a sorting index, and this map doesn't get updated when the KeyBind is added, resulting in an NPE when the GUI actually tries sorting existing indexes.
This patch fixes this behaviour by providing a Mixin that appends the new category name to the CATEGORY_ORDER map whenever a KeyBind with an yet-unknown name gets added.
This is the pull request for the LocalCommandAdder interface + supporting Mixins to allow commands be executed on the client thread without ever being sent to the server, and combining client + server commands in the command line GUI suggestions.