Minecraft:Key codes: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 12: | Line 12: | ||
=== Keyboard codes === | === Keyboard codes === | ||
{{update|Snapshot 9 just seems to have added every SDL3 keycode, we need to figure out what ones are unused and put them in a separate table}} | |||
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. | 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. | ||
| Line 521: | Line 522: | ||
|- | |- | ||
! {{code|key.keyboard.application}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.application}}{{upcoming|java 26.3}} | ||
| {{btn| | | {{btn|Application}} | ||
| colspan="2" | {{key|Menu}} | | colspan="2" | {{key|Menu}} | ||
| {{code|key.keyboard.application}} | | {{code|key.keyboard.application}} | ||
|- | |- | ||
| Line 658: | Line 659: | ||
|- | |- | ||
! rowspan="3" | {{code|key.keyboard.left.win}} | ! rowspan="3" | {{code|key.keyboard.left.win}} | ||
| {{btn|Left Win}} | | {{btn|Left Win}}{{until|java 26.3}}<br>{{btn|Left Windows}}{{upcoming|java 26.3}} | ||
| Windows | | Windows | ||
| {{key|Left Windows}} | | {{key|Left Windows}} | ||
| Line 671: | Line 672: | ||
| Linux | | Linux | ||
| {{key|Left Meta}} | | {{key|Left Meta}} | ||
| {{code|key.keyboard.left. | | {{code|key.keyboard.left.meta}}{{upcoming|java 26.3}} | ||
|- | |- | ||
! rowspan="3" | {{code|key.keyboard.right.win}} | ! rowspan="3" | {{code|key.keyboard.right.win}} | ||
| {{btn|Right Win}} | | {{btn|Right Win}}{{until|java 26.3}}<br>{{btn|Right Windows}}{{upcoming|java 26.3}} | ||
| Windows | | Windows | ||
| {{key|Right Windows}} | | {{key|Right Windows}} | ||
| Line 687: | Line 688: | ||
| Linux | | Linux | ||
| {{key|Right Meta}} | | {{key|Right Meta}} | ||
| {{code|key.keyboard.right. | | {{code|key.keyboard.right.meta}}{{upcoming|java 26.3}} | ||
|- | |||
! {{code|key.keyboard.lang1}}{{upcoming|java 26.3}}<ref name="genericintl">Rather than being named after the actual real-life key, it instead uses the internal, generic SDL3 name: {{bug|MC-311175}}</ref> | |||
| {{btn|Language 1}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Hangul}} | |||
| {{code|key.keyboard.lang1}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.lang2}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|Language 2}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Hanja}} | |||
| {{code|key.keyboard.lang2}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.lang3}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|Language 3}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Katakana}} | |||
| {{code|key.keyboard.lang3}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.lang4}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|Language 4}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Hiragana}} | |||
| {{code|key.keyboard.lang4}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.lang5}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|Language 5}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Halfwidth Fullwidth}}{{note|May not work correctly on Linux: {{bug|MC-310984}}}} | |||
| {{code|key.keyboard.lang5}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.international1}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|International 1}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|ろ}} (JIS) / {{key|/}} (ABNT) | |||
| {{code|key.keyboard.international1}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.international2}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|International 2}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Katakana/Hiragana}} | |||
| {{code|key.keyboard.international2}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.international3}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|International 3}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|¥}} | |||
| {{code|key.keyboard.international3}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.international4}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|International 4}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Henkan}} | |||
| {{code|key.keyboard.international4}}<ref name="genericintl"/> | |||
|- | |||
! {{code|key.keyboard.international5}}{{upcoming|java 26.3}}<ref name="genericintl"/> | |||
| {{btn|International 5}}<ref name="genericintl"/> | |||
| colspan="2" | {{key|Muhenkan}} | |||
| {{code|key.keyboard.international5}}<ref name="genericintl"/> | |||
|- | |- | ||
! {{code|key.keyboard.mute}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.mute}}{{upcoming|java 26.3}} | ||
| Line 739: | Line 790: | ||
| {{code|key.keyboard.again}} | | {{code|key.keyboard.again}} | ||
|- | |- | ||
! {{code|key.keyboard.new}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.ac.new}}{{upcoming|java 26.3}} | ||
| {{btn|New}} | | {{btn|AC New}} | ||
| colspan="2" | {{key|Application New}} | | colspan="2" | {{key|Application New}} | ||
| {{code|key.keyboard.new}} | | {{code|key.keyboard.ac.new}} | ||
|- | |- | ||
! {{code|key.keyboard.save}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.ac.save}}{{upcoming|java 26.3}} | ||
| {{btn|Save}} | | {{btn|AC Save}} | ||
| colspan="2" | {{key|Application Save}} | | colspan="2" | {{key|Application Save}} | ||
| {{code|key.keyboard.save}} | | {{code|key.keyboard.ac.save}} | ||
|- | |- | ||
! {{code|key.keyboard.help}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.help}}{{upcoming|java 26.3}} | ||
| Line 764: | Line 815: | ||
| {{code|scancode.{{note|name="oldkeynumberid"}}}} | | {{code|scancode.{{note|name="oldkeynumberid"}}}} | ||
|- | |- | ||
! {{code|key.keyboard.{{note|name="newkeynumberid"|Three digit number representing SDL3 key ID}}}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.{{note|name="newkeynumberid"|Three digit number representing SDL3 key ID}}}}{{upcoming|java 26.3}}{{more info|is this possible to obtain anymore?}} | ||
| {{btn|key.keyboard.}}{{note|name="newkeynumberid"}} | | {{btn|key.keyboard.}}{{note|name="newkeynumberid"}} | ||
| colspan="2" | Keys with no assigned ID | | colspan="2" | Keys with no assigned ID | ||
| Line 787: | Line 838: | ||
| {{key|Power}} | | {{key|Power}} | ||
| {{bug|MC-310991}} | | {{bug|MC-310991}} | ||
|- | |- | ||
| {{btn|key.keyboard.155}} | | {{btn|key.keyboard.155}} | ||
| {{key|Cancel}} | | {{key|Cancel}} | ||
| {{bug|MC-311035}} | | {{bug|MC-311035}} | ||
|- | |- | ||
| {{btn|key.keyboard.258}} | | {{btn|key.keyboard.258}} | ||
| Line 926: | Line 937: | ||
Only the first eight mouse buttons can have controls assigned to them.{{until|java 26.3}} | Only the first eight mouse buttons can have controls assigned to them.{{until|java 26.3}} | ||
On Linux, mouse buttons up to 48{{upcoming|java 26.3}} 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, and the maximum mouse button on Windows is 5. | On Linux, mouse buttons up to 48{{upcoming|java 26.3}} 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. | For the first three mouse buttons, the translation keys match the key IDs; all other buttons follow a generic template. | ||
| Line 1,280: | Line 1,291: | ||
=== Keyboard codes === | === Keyboard codes === | ||
{{info needed section|In the lang files there are translation strings for each translatable keycode that is a shortened version (e.g. PgUp instead of PAGE UP). Figure out if these ever appear in the game and, if they do, add a column for them.}} | {{info needed section|In the lang files there are translation strings for each translatable keycode that is a shortened version (e.g. PgUp instead of PAGE UP). Figure out if these ever appear in the game and, if they do, add a column for them.}} | ||
{{cleanup|section=1|for differing operating systems (e.g. things involving the command key), implement something similar to what is seen with the Java Edition keyboard table above: make the key ID span multiple rows, and have sub-rows per operating system}} | {{cleanup|section=1|for differing operating systems (e.g. things involving the command key), implement something similar to what is seen with the Java Edition keyboard table above: make the key ID span multiple rows (rowspan 2), and have sub-rows per operating system}} | ||
In {{BE}}, keys are stored as the decimal representation of their [https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes virtual key code]. | In {{BE}}, keys are stored as the decimal representation of their [https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes virtual key code]. | ||
| Line 2,416: | Line 2,427: | ||
|The international backslash key is now recognised as {{code|key.keyboard.world.1}} on Windows, rather than {{code|key.keyboard.world.2}}.}} | |The international backslash key is now recognised as {{code|key.keyboard.world.1}} on Windows, rather than {{code|key.keyboard.world.2}}.}} | ||
|{{HistoryLine|||dev=snap7|Several new translatable key codes have been added: | |{{HistoryLine|||dev=snap7|Several new translatable key codes have been added: | ||
{{collapse|content= | |||
* {{code|key.keyboard.keypad.period}} | * {{code|key.keyboard.keypad.period}} | ||
* {{code|key.keyboard.keypad.comma}} | * {{code|key.keyboard.keypad.comma}} | ||
| Line 2,436: | Line 2,448: | ||
* {{code|key.keyboard.new}} | * {{code|key.keyboard.new}} | ||
* {{code|key.keyboard.save}} | * {{code|key.keyboard.save}} | ||
}} | |||
|{{code|key.keyboard.left.alt}}, {{code|key.keyboard.right.alt}}, {{code|key.keyboard.left.win}}, and {{code|key.keyboard.right.win}} now have different display names depending on the user's operating system.{{info needed|Checking the lang files shows that there are distinct "[left/right].win" and "[left/right].windows" translation strings - explain how these are applied}}}} | |{{code|key.keyboard.left.alt}}, {{code|key.keyboard.right.alt}}, {{code|key.keyboard.left.win}}, and {{code|key.keyboard.right.win}} now have different display names depending on the user's operating system.{{info needed|Checking the lang files shows that there are distinct "[left/right].win" and "[left/right].windows" translation strings - explain how these are applied}}}} | ||
|{{HistoryLine|||dev=snap9|Translatable key codes have been added for all SDL scancodes: | |||
{{collapse|content= | |||
* {{code|key.keyboard.ac.back}} | |||
* {{code|key.keyboard.ac.bookmarks}} | |||
* {{code|key.keyboard.ac.close}} | |||
* {{code|key.keyboard.ac.exit}} | |||
* {{code|key.keyboard.ac.forward}} | |||
* {{code|key.keyboard.ac.home}} | |||
* {{code|key.keyboard.ac.open}} | |||
* {{code|key.keyboard.ac.print}} | |||
* {{code|key.keyboard.ac.properties}} | |||
* {{code|key.keyboard.ac.refresh}} | |||
* {{code|key.keyboard.ac.search}} | |||
* {{code|key.keyboard.ac.stop}} | |||
* {{code|key.keyboard.alternate.erase}} | |||
* {{code|key.keyboard.call}} | |||
* {{code|key.keyboard.cancel}} | |||
* {{code|key.keyboard.channel.down}} | |||
* {{code|key.keyboard.channel.up}} | |||
* {{code|key.keyboard.clear}} | |||
* {{code|key.keyboard.clear.again}} | |||
* {{code|key.keyboard.crsel}} | |||
* {{code|key.keyboard.currency.subunit}} | |||
* {{code|key.keyboard.currency.unit}} | |||
* {{code|key.keyboard.decimal.separator}} | |||
* {{code|key.keyboard.end.call}} | |||
* {{code|key.keyboard.enter2}} | |||
* {{code|key.keyboard.execute}} | |||
* {{code|key.keyboard.exsel}} | |||
* {{code|key.keyboard.international1}} | |||
* {{code|key.keyboard.international2}} | |||
* {{code|key.keyboard.international3}} | |||
* {{code|key.keyboard.international4}} | |||
* {{code|key.keyboard.international5}} | |||
* {{code|key.keyboard.international6}} | |||
* {{code|key.keyboard.international7}} | |||
* {{code|key.keyboard.international8}} | |||
* {{code|key.keyboard.international9}} | |||
* {{code|key.keyboard.keypad.00}} | |||
* {{code|key.keyboard.keypad.000}} | |||
* {{code|key.keyboard.keypad.a}} | |||
* {{code|key.keyboard.keypad.ampersand}} | |||
* {{code|key.keyboard.keypad.at}} | |||
* {{code|key.keyboard.keypad.b}} | |||
* {{code|key.keyboard.keypad.backspace}} | |||
* {{code|key.keyboard.keypad.binary}} | |||
* {{code|key.keyboard.keypad.c}} | |||
* {{code|key.keyboard.keypad.clear}} | |||
* {{code|key.keyboard.keypad.clear.entry}} | |||
* {{code|key.keyboard.keypad.colon}} | |||
* {{code|key.keyboard.keypad.d}} | |||
* {{code|key.keyboard.keypad.double.ampersand}} | |||
* {{code|key.keyboard.keypad.double.vertical.bar}} | |||
* {{code|key.keyboard.keypad.e}} | |||
* {{code|key.keyboard.keypad.equals.as400}} | |||
* {{code|key.keyboard.keypad.exclamation}} | |||
* {{code|key.keyboard.keypad.f}} | |||
* {{code|key.keyboard.keypad.greater}} | |||
* {{code|key.keyboard.keypad.hash}} | |||
* {{code|key.keyboard.keypad.hexadecimal}} | |||
* {{code|key.keyboard.keypad.left.brace}} | |||
* {{code|key.keyboard.keypad.less}} | |||
* {{code|key.keyboard.keypad.memory.add}} | |||
* {{code|key.keyboard.keypad.memory.clear}} | |||
* {{code|key.keyboard.keypad.memory.divide}} | |||
* {{code|key.keyboard.keypad.memory.multiply}} | |||
* {{code|key.keyboard.keypad.memory.recall}} | |||
* {{code|key.keyboard.keypad.memory.store}} | |||
* {{code|key.keyboard.keypad.memory.subtract}} | |||
* {{code|key.keyboard.keypad.octal}} | |||
* {{code|key.keyboard.keypad.percent}} | |||
* {{code|key.keyboard.keypad.power}} | |||
* {{code|key.keyboard.keypad.right.brace}} | |||
* {{code|key.keyboard.keypad.space}} | |||
* {{code|key.keyboard.keypad.tab}} | |||
* {{code|key.keyboard.keypad.vertical.bar}} | |||
* {{code|key.keyboard.keypad.xor}} | |||
* {{code|key.keyboard.lang1}} | |||
* {{code|key.keyboard.lang2}} | |||
* {{code|key.keyboard.lang3}} | |||
* {{code|key.keyboard.lang4}} | |||
* {{code|key.keyboard.lang5}} | |||
* {{code|key.keyboard.lang6}} | |||
* {{code|key.keyboard.lang7}} | |||
* {{code|key.keyboard.lang8}} | |||
* {{code|key.keyboard.lang9}} | |||
* {{code|key.keyboard.media.eject}} | |||
* {{code|key.keyboard.media.fast.forward}} | |||
* {{code|key.keyboard.media.next.track}} | |||
* {{code|key.keyboard.media.pause}} | |||
* {{code|key.keyboard.media.play}} | |||
* {{code|key.keyboard.media.previous.track}} | |||
* {{code|key.keyboard.media.record}} | |||
* {{code|key.keyboard.media.rewind}} | |||
* {{code|key.keyboard.media.select}} | |||
* {{code|key.keyboard.media.stop}} | |||
* {{code|key.keyboard.mode}} | |||
* {{code|key.keyboard.oper}} | |||
* {{code|key.keyboard.out}} | |||
* {{code|key.keyboard.power}} | |||
* {{code|key.keyboard.prior}} | |||
* {{code|key.keyboard.select}} | |||
* {{code|key.keyboard.separator}} | |||
* {{code|key.keyboard.sleep}} | |||
* {{code|key.keyboard.soft.left}} | |||
* {{code|key.keyboard.soft.right}} | |||
* {{code|key.keyboard.sys.req}} | |||
* {{code|key.keyboard.thousands.separator}} | |||
* {{code|key.keyboard.wake}} | |||
}} | |||
|{{code|key.keyboard.application}} now displays as "Application". | |||
|{{code|key.keyboard.left.win}} and {{code|key.keyboard.right.win}} now display as "Left Windows" and "Right Windows" on Windows, respectively. | |||
|{{code|key.keyboard.left.win}} and {{code|key.keyboard.right.win}} now use the {{code|key.keyboard.left.meta}} and {{code|key.keyboard.right.meta}} translation keys on Linux, respectively. | |||
|{{code|key.keyboard.new}} renamed to {{code|key.keyboard.ac.new}} | |||
|{{code|key.keyboard.save}} renamed to {{code|key.keyboard.ac.save}}}} | |||
}} | }} | ||
Revision as of 11:35, 18 August 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:Update 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.
Without names
Template:Main Template:Planned SDL3 maintains its own internal numbering system, meaning that these match from one operating system to the other, unlike what was the case with GLFW.Template:Upcoming
While any number can be placed after Template:CodeTemplate:Note, only those which can actually be accessed via a key press binding in-game are listed. Many are automatically converted to proper key IDs at runtime.
The keys listed here are mostly comprised of buttons exclusive to Japanese, Korean and Brazilian keyboard layouts, as well as buttons on multimedia keyboards.
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:键控代码