Minecraft:Key codes: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 5: | Line 5: | ||
{{For|the codes used prior to [[Minecraft:the Flattening]]|Java Edition pre-flattening data values#Key codes}} | {{For|the codes used prior to [[Minecraft:the Flattening]]|Java Edition pre-flattening data values#Key codes}} | ||
Only keys which can be directly detected by the operating system are able to be bound to game controls - keys such as F Lock<ref>{{bug|MC-265854}}</ref> or Fn typically are not | Only keys which can be directly detected by the operating system are able to be bound to game controls - keys such as F Lock<ref>{{bug|MC-265854}}</ref> or Fn typically are not recognizable themselves as keys, and Minecraft and all other computer programs will be oblivious to them in isolation. | ||
Only mouse buttons can have controls be bound to them in the options menu. Mouse movement, vertical scrolling and horizontal scrolling are hardcoded, and their default actions cannot be assigned to other keys or buttons, nor can scrolling or moving the mouse be made to do anything else. | Only mouse buttons can have controls be bound to them in the options menu. Mouse movement, vertical scrolling and horizontal scrolling are hardcoded, and their default actions cannot be assigned to other keys or buttons, nor can scrolling or moving the mouse be made to do anything else. | ||
| Line 25: | Line 25: | ||
! {{code|key.keyboard.unknown}} | ! {{code|key.keyboard.unknown}} | ||
| {{btn|Not Bound}} | | {{btn|Not Bound}} | ||
| colspan="2" | Unassigned{{note|Also used by keys | | colspan="2" | Unassigned{{note|Also used by keys unrecognized by SDL3, see {{bug|MC-310108}}{{upcoming|java 26.3}}}} | ||
| {{code|key.keyboard.unknown}} | | {{code|key.keyboard.unknown}} | ||
|- | |- | ||
| Line 405: | Line 405: | ||
! {{code|key.keyboard.f25}}{{until|java 26.3}} | ! {{code|key.keyboard.f25}}{{until|java 26.3}} | ||
| {{btn|F25}} | | {{btn|F25}} | ||
| colspan="2" | Unclear{{note|Ostensibly for a twenty-fifth function key, but Windows, Linux and presumably macOS only | | colspan="2" | Unclear{{note|Ostensibly for a twenty-fifth function key, but Windows, Linux and presumably macOS only recognize up to F24. Some keyboards from decades past go past F24, and Arch Linux can apparently recognize up to F246, however it is unknown if Minecraft would recognize either of these.}} | ||
| {{code|key.keyboard.f25}} | | {{code|key.keyboard.f25}} | ||
|- | |- | ||
| Line 757: | Line 757: | ||
! {{code|key.keyboard.alternate.erase}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.alternate.erase}}{{upcoming|java 26.3}} | ||
| {{btn|Alternate Erase}} | | {{btn|Alternate Erase}} | ||
| colspan="2" | {{note|Not | | colspan="2" | {{note|Not recognized for some reason: {{bug|MC-311320}}}} | ||
| {{code|key.keyboard.alternate.erase}} | | {{code|key.keyboard.alternate.erase}} | ||
|- | |- | ||
| Line 2,740: | Line 2,740: | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java classic}} | |{{HistoryLine|java classic}} | ||
|{{HistoryLine||0.0.23a|Controls can now be customized. Only keyboard buttons are | |{{HistoryLine||0.0.23a|Controls can now be customized. Only keyboard buttons are recognized as valid for rebinding.}} | ||
|{{HistoryLine|java beta}} | |{{HistoryLine|java beta}} | ||
|{{HistoryLine||1.8|dev=Pre-release|Controls can now be bound to mouse buttons; these are handled using negative numbers.}} | |{{HistoryLine||1.8|dev=Pre-release|Controls can now be bound to mouse buttons; these are handled using negative numbers.}} | ||
| Line 2,769: | Line 2,769: | ||
|Certain keys, such as keypad plus-or-minus, keypad opening bracket and keypad closing bracket, now display the character they represent, despite not being defined key codes in the game.<ref>{{bug|MC-310109}}, {{bug|MC-310110}}</ref> | |Certain keys, such as keypad plus-or-minus, keypad opening bracket and keypad closing bracket, now display the character they represent, despite not being defined key codes in the game.<ref>{{bug|MC-310109}}, {{bug|MC-310110}}</ref> | ||
|The game now uses SDL3. | |The game now uses SDL3. | ||
|The international backslash key is now | |The international backslash key is now recognized as {{code|key.keyboard.world.1}} on Windows, rather than {{code|key.keyboard.world.2}}. | ||
|{{code|key.keyboard.keypad.decimal}} can no longer be assigned. | |{{code|key.keyboard.keypad.decimal}} can no longer be assigned. | ||
|{{code|key.keyboard.menu}} is now assigned with {{key|Compose}} instead of {{key|Menu}}.}} | |{{code|key.keyboard.menu}} is now assigned with {{key|Compose}} instead of {{key|Menu}}.}} | ||
Revision as of 11:08, 14 September 2026
Template:For This is a list of key codes used by Minecraft:Minecraft, which are used in the Minecraft:options.txt file.
Java Edition
Only keys which can be directly detected by the operating system are able to be bound to game controls - keys such as F Lock<ref>Template:Bug</ref> or Fn typically are not recognizable themselves as keys, and Minecraft and all other computer programs will be oblivious to them in isolation.
Only mouse buttons can have controls be bound to them in the options menu. Mouse movement, vertical scrolling and horizontal scrolling are hardcoded, and their default actions cannot be assigned to other keys or buttons, nor can scrolling or moving the mouse be made to do anything else.
Java Edition does not provide official support for controllers.
Keyboard codes
Template:Info needed section Keyboard buttons are handled as a signed 32-bit integer, meaning that through editing options.txt, values from Template:Code to Template:Code can be specified without being rejected by the game as invalid. Any keys corresponding to a valid SDL key code will be automatically converted to one of the named keys below.
The displayed names of several keys will change depending on the currently active system keyboard layout. The values displayed in this table assume a standard en-US QWERTY layout. Some keys also have operating system dependent names, which are assigned different rows sharing an ID.
Unused
Template:Info needed section Minecraft includes IDs and translation strings for all named SDL3 key IDs, even those which are not present in the key binding files for any supported operating system, and therefore cannot be accessed.
These can be set via modifying Template:Code manually, but will not be triggerable due to the lack of an associated key.
Keys such as World 2, Keypad Decimal and Escape may warrant inclusion here later.Template:Upcoming
Mouse codes
Mouse buttons are handled as a signed 32-bit integer, meaning that through editing options.txt, values from Template:Code to Template:Code can be specified without being rejected by the game as invalid.<ref>Template:Bug</ref> However, the USB HID specification only permits mouse buttons from 1 to 65535,<ref>https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf</ref> meaning that all negative values and the vast majority of the positive values can never actually be assigned to in-game actions without file editing.
Only the first eight mouse buttons can have controls assigned to them.Template:Until
On Linux, mouse buttons up to 48Template:Upcoming can be specified (evdev key press events 272 to 319) - it is not known if any supported operating systems support a 49th or higher mouse button as input. The maximum mouse button on macOS is 32,<ref>according to what karabiner-elements allows: https://discord.com/channels/647810384031645728/648555495564509184/1528136787434930358</ref> and the maximum mouse button on Windows is 5.
For the first three mouse buttons, the translation keys match the key IDs; all other buttons follow a generic template.
Bedrock Edition
Keyboard codes
Template:Info needed section Template:Cleanup In Template:BE, keys are stored as the decimal representation of their virtual key code.
Some numbers are skipped because they are reserved or not assigned. By modifying options.txt, you can force the game to show these numbers (prefixed with "Button"), but they are unobtainable by pressing a key.
The virtual key code specification also provides numbers for buttons on the mouse. However, mouse buttons are not stored as those numbers.
Mouse codes
Template:Info needed section Mouse buttons are represented by negative numbers.
Controller codes
History
Java Edition
Removed keys
Notes
References
Template:Navbox Java Edition technical Template:Navbox Bedrock Edition
Minecraft:fr:Codes de touche Minecraft:hu:Billentyűkódok Minecraft:ja:キーコード Minecraft:nl:Toetscodes Minecraft:pt:Códigos de teclas Minecraft:ru:Коды клавиш Minecraft:uk:Коди клавіш Minecraft:zh:键控代码