Jump to content

[SOLVED] Mouse "Keybinding?"


intermediateuser

Recommended Posts

So I know how to set a keybinding already.  When I'm looking for the G key, for example, I'd use Keyboard.KEY_G

 

What if I'm looking for Mouse Button 3?  The game already uses it for "Pick Block" (so I know it's possible) but Pick Block is essentially useless in the Survival game type so I'd like to have my mod remap it to something more useful.

Link to comment
Share on other sites

I have never looked into this myself.... But wouldn't it be logical (if the keybindings use Keyboard) to assume that it would be Mouse.nameOfVariable?

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

I have never looked into this myself.... But wouldn't it be logical (if the keybindings use Keyboard) to assume that it would be Mouse.nameOfVariable?

 

Quite logical!  And I have looked into that.  It is not as straightforward as the keyboard stuff.  Thus I asked here.

 

Well then.. I have no idea xD Try looking through source code... But have fun with that.

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

I have never looked into this myself.... But wouldn't it be logical (if the keybindings use Keyboard) to assume that it would be Mouse.nameOfVariable?

 

Quite logical!  And I have looked into that.  It is not as straightforward as the keyboard stuff.  Thus I asked here.

 

Well then.. I have no idea xD Try looking through source code... But have fun with that.

 

Haha, well, thanks.  I'll post here if I find anything.

 

In the meantime, if anyone else knows, please feel free to race me to posting the solution.  :P

Link to comment
Share on other sites

Got it.

 

Mouse 3 (middle click, usually) is assigned integer -98 in the keybindings.  So if you're looking for a particular "key" in your code where you would normally use Keyboard.KEY_whatever (which is actually just a fancy name for an integer assigned to that key), you'd simply type "-98" (without the quotes, of course).

 

I figured this out by having another key call this when pressed:

 

System.out.println(Minecraft.getMinecraft().gameSettings.keyBindPickBlock.keyCode);

 

You can get any of the game's keybindings that way (though I don't imagine you'd need to except if you were looking for mouse buttons).  Just be sure to delete the above line of code when you've got the information you need.

 

Huh.  Just noticing that I used a lot of parenthesis in this post (and that's probably okay).  :P

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
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.