Minecraft:Key codes: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 12: | Line 12: | ||
=== Keyboard codes === | === Keyboard codes === | ||
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. | |||
{| class="wikitable sortable" data-description="Keyboard key and multimedia button IDs" style="margin-left:auto; margin-right:auto; text-align: center" | {| class="wikitable sortable" data-description="Keyboard key and multimedia button IDs" style="margin-left:auto; margin-right:auto; text-align: center" | ||
| Line 708: | Line 706: | ||
! {{code|key.keyboard.media.play.pause}}{{upcoming|java 26.3}} | ! {{code|key.keyboard.media.play.pause}}{{upcoming|java 26.3}} | ||
| {{btn|Play/Pause}} | | {{btn|Play/Pause}} | ||
| colspan="2" | {{key|Play | | colspan="2" | {{key|Media Play Pause}} | ||
| {{code|key.keyboard.media.play.pause}} | | {{code|key.keyboard.media.play.pause}} | ||
|- | |- | ||
| Line 761: | Line 759: | ||
| {{code|key.keyboard.find}} | | {{code|key.keyboard.find}} | ||
|- | |- | ||
! {{code|scancode.{{note|name=" | ! {{code|scancode.{{note|name="oldkeynumberid"|Two or three digit number representing operating system key ID}}}}{{until|java 26.3}} | ||
| {{btn|scancode.}}{{note|name=" | | {{btn|scancode.}}{{note|name="oldkeynumberid"}} | ||
| colspan="2" | Keys with no assigned ID | | colspan="2" | Keys with no assigned ID | ||
| {{code|scancode.{{note|name=" | | {{code|scancode.{{note|name="oldkeynumberid"}}}} | ||
|- | |- | ||
! {{code|key.keyboard.{{note|name=" | ! {{code|key.keyboard.{{note|name="newkeynumberid"|Three digit number representing SDL3 key ID}}}}{{upcoming|java 26.3}} | ||
| {{btn|key.keyboard.}}{{note|name=" | | {{btn|key.keyboard.}}{{note|name="newkeynumberid"}} | ||
| colspan="2" | Keys with no assigned ID | | colspan="2" | Keys with no assigned ID | ||
| {{code|key.keyboard.{{note|name=" | | {{code|key.keyboard.{{note|name="newkeynumberid"}}}} | ||
|} | |||
==== Without names ==== | |||
{{main|Java Edition untranslated keys}} | |||
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.{{upcoming|java 26.3}} | |||
While any number greater than 9 can be placed after {{code|key.keyboard.}}, 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. | |||
{| class="wikitable sortable" data-description="Table of raw IDs of less-common keyboard keys and button controls" style="margin-left:auto; margin-right:auto; text-align: center" | |||
! Displayed name | |||
! Physical key or button | |||
! Ticket | |||
|- | |||
| {{btn|key.keyboard.102}} | |||
| {{key|Power}} | |||
| {{bug|MC-310991}} | |||
|- | |||
| {{btn|key.keyboard.135}} | |||
| {{key|ろ}} / {{key|/}} (Brazil) | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.136}} | |||
| {{key|Katakana/Hiragana}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.137}} | |||
| {{key|Yen}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.138}} | |||
| {{key|Henkan}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.139}} | |||
| {{key|Muhenkan}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.144}} | |||
| {{key|Hangul}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.145}} | |||
| {{key|Hanja}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.146}} | |||
| {{key|Katakana}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.147}} | |||
| {{key|Hiragana}} | |||
| {{bug|MC-310944}} | |||
|- | |||
| {{btn|key.keyboard.155}} | |||
| {{key|Cancel}} | |||
| {{bug|MC-311035}} | |||
|- | |||
| {{btn|key.keyboard.257}} | |||
| {{key|Halfwidth/Fullwidth}} | |||
| {{bug|MC-310984}} | |||
|- | |||
| {{btn|key.keyboard.258}} | |||
| {{key|Sleep}} | |||
| {{bug|MC-310991}} | |||
|- | |||
| {{btn|key.keyboard.259}} | |||
| {{key|Wake}} | |||
| {{bug|MC-310991}} | |||
|- | |||
| {{btn|key.keyboard.262}} | |||
| {{key|Media Play}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.263}} | |||
| {{key|Media Pause}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.264}} | |||
| {{key|Media Record}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.265}} | |||
| {{key|Media Fast Forward}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.266}} | |||
| {{key|Media Rewind}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.267}} | |||
| {{key|Media Next Track}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.268}} | |||
| {{key|Media Previous Track}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.269}} | |||
| {{key|Media Stop}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.270}} | |||
| {{key|Media Eject}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.272}} | |||
| {{key|Media Select}} | |||
| {{bug|MC-310116}} | |||
|- | |||
| {{btn|key.keyboard.274}} | |||
| {{key|Application Open}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.275}} | |||
| {{key|Application Close}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.276}} | |||
| {{key|Application Exit}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.279}} | |||
| {{key|Application Properties}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.280}} | |||
| {{key|Application Search}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.281}} | |||
| {{key|Application Home}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.282}} | |||
| {{key|Application Back}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.283}} | |||
| {{key|Application Forward}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.285}} | |||
| {{key|Application Refresh}} | |||
| {{bug|MC-311010}} | |||
|- | |||
| {{btn|key.keyboard.286}} | |||
| {{key|Application Bookmarks}} | |||
| {{bug|MC-311010}} | |||
|} | |} | ||
| Line 1,199: | Line 1,347: | ||
! {{code|22}} | ! {{code|22}} | ||
| {{btn|Button22}} | | {{btn|Button22}} | ||
| {{key| | | {{key|Hangul}} | ||
| | | | ||
|- | |- | ||
| Line 1,219: | Line 1,367: | ||
! {{code|26}} | ! {{code|26}} | ||
| {{btn|Button26}} | | {{btn|Button26}} | ||
| {{key|IME Hanja / Kanji}} | | {{key|IME Hanja / Kanji}}{{info needed|Is this the same as KEY_HANJA, or does this refer to two different keys that map to the same BE number?}} | ||
| | | | ||
|- | |- | ||
| Line 2,252: | Line 2,400: | ||
|{{HistoryLine||1.20|dev=pre2|Letter keys are now displayed in uppercase again.}} | |{{HistoryLine||1.20|dev=pre2|Letter keys are now displayed in uppercase again.}} | ||
|{{HistoryLine|||dev=pre3|Controls that are not bound to anything now display "Not Bound".}} | |{{HistoryLine|||dev=pre3|Controls that are not bound to anything now display "Not Bound".}} | ||
|{{HistoryLine||?|The international backslash key is now recognised as {{code|key.keyboard.world.1}} on Windows, rather than {{code|key.keyboard.world.2}}.}} | |||
|{{HistoryLine|java upcoming}} | |{{HistoryLine|java upcoming}} | ||
|{{HistoryLine||26.3|dev=snap4|Valid but undefined key codes have been changed from {{code|scancode.###}} to {{code|key.keyboard.###}}. | |{{HistoryLine||26.3|dev=snap4|Valid but undefined key codes have been changed from {{code|scancode.###}} to {{code|key.keyboard.###}}. | ||
Revision as of 11:08, 14 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
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 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 greater than 9 can be placed after Template:Code, 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, 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
In Template:BE, keys are stored as the value of their virtual key code.
Mouse codes
Template:Info needed section Mouse buttons are represented by negative numbers.
Controller codes
History
Java Edition
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:键控代码