Minecraft:Key codes: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 1,251: | Line 1,251: | ||
|- | |- | ||
! {{code|key.keyboard.sys.req}} | ! {{code|key.keyboard.sys.req}} | ||
| {{btn|SysRq}} | | {{btn|SysRq}}{{note|Mojang have chosen to keep this name, despite it being abbreviated in direct contrast to almost all other keys: {{bug|MC-311713}}}} | ||
| | | | ||
|- | |- | ||
Latest revision as of 11:07, 8 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 recognisable 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:键控代码