Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] How do I add a new KeyBinding?


Recommended Posts

I'm making a mod that adds in controls for abilities that can be activated when you're wearing a certain piece of armor (e.g. pressing the chestplate_ability key while wearing the Muteki Chestplate will give you Strength V for 30 seconds). I want 5 controls: One for each piece of armor individually and one for every applicable piece at once. For this reason, I'm trying to instantiate instances of KeyBinding. However, I have no idea what I'm doing and cannot find a tutorial for 1.15.2. Could someone explain to me what I'm supposed to do or link me to a tutorial?

Link to comment
Share on other sites

It should appear in the controls menu by default. I just verified this using:

public static final KeyBinding TEST = new KeyBinding("key.test", KeyConflictContext.UNIVERSAL, InputMappings.Type.KEYSYM, GLFW.GLFW_KEY_J, "key.categories.test");

private void clientSetup(final FMLClientSetupEvent event) {
		ClientRegistry.registerKeyBinding(TEST);
}

 

Link to comment
Share on other sites

  • 11 months later...
On 5/19/2020 at 7:37 PM, ChampionAsh5357 said:

It should appear in the controls menu by default. I just verified this using:


public static final KeyBinding TEST = new KeyBinding("key.test", KeyConflictContext.UNIVERSAL, InputMappings.Type.KEYSYM, GLFW.GLFW_KEY_J, "key.categories.test");

private void clientSetup(final FMLClientSetupEvent event) {
		ClientRegistry.registerKeyBinding(TEST);
}

 

How can I do something with it? Like how can I run Code when this key is pressed?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.