Jump to content

Key Binds not working


IKnowImEZ

Recommended Posts

So i have this little method,

@SubscribeEvent
    public void livingUpdate(LivingEvent.LivingUpdateEvent event) {
        if (event.getEntity() instanceof EntityPlayerSP) {
            
            if(minecraft.gameSettings.keyBindDrop.isPressed()) {//doesnt work
                System.out.println("Test, droped a item");
            }
            
            if(minecraft.gameSettings.keyBindPlayerList.isPressed()) {//works
                System.out.println("Test, Showed tab gui thing");
            }

}

}

now for some reason player list works but drop doesnt, but if instend if i use isKeyDown it works, but i want it to only update when the key is pressed once, if you get what im saying, not every tick the key is down

Edited by IKnowImEZ
Link to comment
Share on other sites

Why are you using LivingUpdateEvent and not PlayerUpdateEvent?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Sorry, its TickEvent.PlayerTickEvent

 

Also, as you're using it to check keybinds on the client side, use TickEvent.ClientTickEvent instead.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

14 minutes ago, IKnowImEZ said:

is there like a event where i can do public void event(someKeyBoardEvent event) {if(event.getKey instanceof KeyBoard.KEY_SOME KEY)}?

There is, but you should not do it that way.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

2 hours ago, Draco18s said:

use TickEvent.ClientTickEvent

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

On 5/6/2018 at 9:32 PM, Draco18s said:

There is, but you should not do it that way.

why? he said he wants to respond to a single press. why wouldn't you use key input event? (i never used it myself, so i don't know if it does what i'd expect it to do.)

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.