Jump to content

how i get a existing keybind but one keybind vanilla that is, I did not create but she exists.


Ragnar

Recommended Posts

37 minutes ago, Ragnar said:

how i get a existing keybind but one keybind vanilla that is, I did not create but she exists.

There is a field in the Minecraft class called keyBindings.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

14 minutes ago, Ragnar said:

I have to use the getKeybinds () method to get? If yes, then come what?I have to use the getKeybinds () method to get? If yes, then come what?

Look through the code you can get any keybind you want from there.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

The GameSettings class has public fields for all the vanilla key bindings. For example there is field keyBindLeft, keyBindRight, etc.

 

To check for these you should handle the KeyInputEvent and since it is client-side only you can use the Minecraft class to get the GameSettings instance then get the keybind then call method to check if it is pressed. 

 

For example: if (Minecraft.getMinecraft().gameSettings.keyBindLeft.isPressed()) { */ Do something here /* }

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

22 minutes ago, Ragnar said:

Thanks a lot, one more thing is it possible for me to get the KeyInputEvent event player? if yes how can I get it, because the method I want to use in KeyInputEvent uses EntityPlayer

I know you solved it, but just in case other people come to this thread:

 

Whenever you're handling an event that is client-side only you are free to use the Minecraft.getMinecraft() method to get the instance of the Minecraft class. From there you can access all sorts of client-related things such as the player, keybinds, mouse movement, rendering stuff and so forth.

 

So you'll notice client side events often don't pass much information in the parameter because they know you can access it directly through Minecraft class.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.