<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Key_Mappings%2F1.17</id>
	<title>Key Mappings/1.17 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Key_Mappings%2F1.17"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Key_Mappings/1.17&amp;action=history"/>
	<updated>2026-05-01T19:58:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Key_Mappings/1.17&amp;diff=3032&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Key Mappings to MC1.17 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Key_Mappings/1.17&amp;diff=3032&amp;oldid=prev"/>
		<updated>2021-12-06T05:50:43Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Key_Mappings&quot; title=&quot;Key Mappings&quot;&gt;Key Mappings&lt;/a&gt; to MC1.17 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A '''key mapping''' or '''keybinding''' is the relation of an action to an input, such as a mouse click or a combination of key presses. The action for the keymapping is defined in the code, while the triggering input is configurable by the user through the [[:mc:Options#Controls/1.17|Controls menu]]. In the code, these key mappings are declared and represented by &amp;lt;code&amp;gt;KeyMapping&amp;lt;/code&amp;gt; instances&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;KeyMapping&amp;lt;/code&amp;gt; can be declared with the following parameters:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| name || A translation key used to set the name of this key mapping (e.g. &amp;lt;code&amp;gt;key.modid.key_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| keyConflictContext || Determines when the key mapping should conflict with another defined key mapping. By default, there are three values within &amp;lt;code&amp;gt;KeyConflictContext&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;UNIVERSAL&amp;lt;/code&amp;gt; which are used in every context, &amp;lt;code&amp;gt;GUI&amp;lt;/code&amp;gt; which are used whenever a screen is open, and &amp;lt;code&amp;gt;IN_GAME&amp;lt;/code&amp;gt; whenever a screen is not open. Custom contexts can be created by implementing &amp;lt;code&amp;gt;IKeyConflictContext&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| key || Determines the input context this mapping will declare by default. This is a combination of the input type, input code, and any additional modifiers. There are three possible values for the input type: &amp;lt;code&amp;gt;KEYSYM&amp;lt;/code&amp;gt; which represents a mapped key, &amp;lt;code&amp;gt;SCANCODE&amp;lt;/code&amp;gt; which represents the value emitted by the keyboard itself, and &amp;lt;code&amp;gt;MOUSE&amp;lt;/code&amp;gt; which represents a mouse click. The associated input codes and modifiers are based on the specified input type as mapped by &amp;lt;code&amp;gt;GLFW&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| category || A translation key representing the category this key is located in (e.g. &amp;lt;code&amp;gt;key.modid.categories.category_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
|}&lt;br /&gt;
{{Tip|If you would like there to be no mapping by default, use a constructor that contains &amp;lt;code&amp;gt;InputConstants$Key&amp;lt;/code&amp;gt; instead and supply &amp;lt;code&amp;gt;InputConstants#UNKNOWN&amp;lt;/code&amp;gt; as the argument.}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;KeyMapping&amp;lt;/code&amp;gt; can then be registered using &amp;lt;code&amp;gt;ClientRegistry::registerKeyBinding&amp;lt;/code&amp;gt; within &amp;lt;code&amp;gt;FMLClientSetupEvent&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Using Registered Mappings ==&lt;br /&gt;
&lt;br /&gt;
There are two contexts in which a key mapping can be used normally: in or not in a screen. As such, there are two ways to handle these mappings. When not in a screen, &amp;lt;code&amp;gt;ClientTickEvent&amp;lt;/code&amp;gt; should be used to determine whether the key is down using &amp;lt;code&amp;gt;KeyMapping#isDown&amp;lt;/code&amp;gt;. If within a screen, the following logic can be applied using &amp;lt;code&amp;gt;KeyMapping#isActiveAndMatches&amp;lt;/code&amp;gt; within &amp;lt;code&amp;gt;GuiEventListener#keyPressed&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;GuiEventListener#mouseClicked&amp;lt;/code&amp;gt; for mouse input. Note that the necessary &amp;lt;code&amp;gt;InputConstants$Key&amp;lt;/code&amp;gt; can be constructed using &amp;lt;code&amp;gt;InputConstants::getKey&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;InputConstants$Type::getOrCreate&amp;lt;/code&amp;gt; respectively.&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>