How to Make a Key Binding in Minecraft (Mod Maker guide)
Learn how to create a custom Key binding in your web browser with 9Minecraft Mod Maker. Add new client key actions that trigger your selected events without installing anything.
Open the Studio and a Workspace
Open 9Minecraft Mod Maker directly in your web browser. You do not need to download or install any software to get started.
Open your existing workspace or create a new one. Make sure your workspace is set to one of the supported versions for this element, which are NeoForge 26.1.2 or NeoForge 1.21.1.
Add a Key binding Element
Look for the green plus button in your workspace and click it to add a new mod element.
Find the Logic & code group and select Key binding. A Key bind adds a new key action for the client that causes a selected event result.
Choose the Key and Name
Find the Key field. This parameter defines the default key used to execute the key binding procedure. Do not worry if players prefer a different button, because they can always change it inside the Controls menu in the game.
Next, fill in the Creative tab name field. This parameter controls the name of the key shown inside the Controls tab in Minecraft settings.
Set the Category
Fill in the Category field. The key binding category is the category shown in the controls section of Minecraft settings.
All keybindings belonging to the same category should have the same category key. You can also set the actual display name for this category later in your workspace localization settings.
Add the When key pressed Action
Look at the When key pressed field.
Select or create a procedure here. This procedure will be executed the moment the selected key is pressed by the player.
Add the When key released Action
Look at the When key released field. The procedure you select here will be executed when the selected key is released after the player has pressed the key.
When building your custom procedures for this field, you can use the pressedms dependency to determine for how long the key was pressed.
Test with Build & run and Export
Save your new Key binding element. Click the Build & run button in the studio to test your new key action and make sure your procedures trigger as expected.
Once everything works properly, export your mod file so you can use it in Minecraft.
Tips
- If you make multiple key bindings for your mod, give them the exact same Category key so they stay neatly grouped together in the Minecraft controls settings.
- Remember that the Creative tab name field actually sets the display name of the key inside the Minecraft Controls menu.
- Use the pressedms dependency in your When key released procedure if you want to create actions that depend on how long the player held the key down.
- Make sure your project uses NeoForge 26.1.2 or NeoForge 1.21.1, as these are the supported versions for the Key binding element.