<?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_Bindings%2F1.16</id>
	<title>Key Bindings/1.16 - 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_Bindings%2F1.16"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Key_Bindings/1.16&amp;action=history"/>
	<updated>2026-05-01T18:32:37Z</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_Bindings/1.16&amp;diff=2711&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Key Bindings to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Key_Bindings/1.16&amp;diff=2711&amp;oldid=prev"/>
		<updated>2021-07-27T03:58:42Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Key_Bindings&quot; class=&quot;mw-redirect&quot; title=&quot;Key Bindings&quot;&gt;Key Mappings&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;An input is required to produce some sort of action to the player within the game. These inputs can be boiled down to bindings associated with a certain key or mouse click. To allow these inputs to be remappable, a &amp;lt;code&amp;gt;KeyBinding&amp;lt;/code&amp;gt; can be declared and registered.&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;KeyBinding&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;
| description || A translation key used to describe what this binding will do (e.g. &amp;lt;code&amp;gt;key.modid.keyName&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| keyConflictContext || Determines when the key binding should conflict with another defined key binding. 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;
| inputType || Determines the type of input this binding will declare by default. There are three possible values: &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.&lt;br /&gt;
|-&lt;br /&gt;
| keyCode || The associated key codes 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.categoryName&amp;lt;/code&amp;gt;).&lt;br /&gt;
|}&lt;br /&gt;
{{Tip|If you would like there to be no binding by default, use a constructor that contains &amp;lt;code&amp;gt;InputMappings$Input&amp;lt;/code&amp;gt; instead and supply &amp;lt;code&amp;gt;InputMappings#INPUT_INVALID&amp;lt;/code&amp;gt; as the argument.}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;KeyBinding&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 Bindings ==&lt;br /&gt;
&lt;br /&gt;
There are two contexts in which a key binding can be used normally: in or not in a screen. As such, there are two ways to handle these bindings. 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;KeyBinding#isKeyDown&amp;lt;/code&amp;gt;. If within a screen, the following logic can be applied using &amp;lt;code&amp;gt;KeyBinding#isActiveAndMatches&amp;lt;/code&amp;gt; within &amp;lt;code&amp;gt;IGuiEventListener#keyPressed&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;IGuiEventListener#mouseClicked&amp;lt;/code&amp;gt; for mouse input. Note that the necessary &amp;lt;code&amp;gt;InputMappings$Input&amp;lt;/code&amp;gt; can be constructed using &amp;lt;code&amp;gt;InputMappings::getInputByCode&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MOUSE::getOrMakeInput&amp;lt;/code&amp;gt; respectively.&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>