Jump to content

Recommended Posts

Posted (edited)

Hello, so i have started java programming recently and i am making a mod that has armor that allows you to go into no-clip mode. (basically spectator mode) I want it so that when i press a key, it turns on no-clip, and sends a message to me. I think i can manage everything else but i'm having trouble registering the keybind. I have a KeybindHandler class which registers the keybind. I'm using MC 1.12.2. Code for my KeybindHandler:

public class KeybindHandler {

    public static KeyBinding keybind;

    public static void init() {
        keybind = new KeyBinding("No-Clip", Keyboard.KEY_SEMICOLON, "TestKeybind");
        ClientRegistry.registerKeyBinding(keybind);
    }

}

I'm not sure if i need to do anything else, other than this, but this by itself isn't working.

Any help would be greatly appreciated.
 

EDIT: The problem is the keybind doesn't show up in the controls section.

EDIT # 2: It looks like i forgot to call it... woops

Edited by TesterTesting135
Needed to add more information

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.