Jump to content

Cancel key press


TPD

Recommended Posts

I tried to set the 'pressed' value of the keyBindAttack binding to false via setKeyBindState during Key/MouseInputEvent as well as in the START phase of ClientTickEvent, but it doesn't cancel the clicking for some reason. How does it work?

 

Edit: I think the problem is that the pressed value is assigned after the START and before END phase of client-tick, so the value specified in START just gets overridden.

In case of keyBindAttack, it's possible to set Minecraft#leftClickCounter to something greater than 1 via reflection (very hacky D:), as this needs to be 0 (and gets reduced by 1 every tick) for attacking/breaking to be effective.

Link to comment
Share on other sites

Is there something like this for Keys aswell? It's probably rare, but the player might change the binding to a key. If not, I can just find out if it's bound to a key or the mouse (mouse has negative keyCode) and use the reflection-method for keys.

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.



×
×
  • Create New...

Important Information

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