Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Key Binds not working
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
IKnowImEZ

Key Binds not working

By IKnowImEZ, May 6, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

IKnowImEZ    0

IKnowImEZ

IKnowImEZ    0

  • Tree Puncher
  • IKnowImEZ
  • Members
  • 0
  • 26 posts
Posted May 6, 2018 (edited)

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 May 6, 2018 by IKnowImEZ
  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted May 6, 2018

Why are you using LivingUpdateEvent and not PlayerUpdateEvent?

  • Quote

Share this post


Link to post
Share on other sites

IKnowImEZ    0

IKnowImEZ

IKnowImEZ    0

  • Tree Puncher
  • IKnowImEZ
  • Members
  • 0
  • 26 posts
Posted May 6, 2018
35 minutes ago, Draco18s said:

Why are you using LivingUpdateEvent and not PlayerUpdateEvent?

I dont know, I dident think it really mattered, doubt its going change anything but ill try

  • Quote

Share this post


Link to post
Share on other sites

IKnowImEZ    0

IKnowImEZ

IKnowImEZ    0

  • Tree Puncher
  • IKnowImEZ
  • Members
  • 0
  • 26 posts
Posted May 6, 2018

lol i guess i used it because thats not a event

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted May 6, 2018

Sorry, its TickEvent.PlayerTickEvent

 

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

  • Quote

Share this post


Link to post
Share on other sites

IKnowImEZ    0

IKnowImEZ

IKnowImEZ    0

  • Tree Puncher
  • IKnowImEZ
  • Members
  • 0
  • 26 posts
Posted May 6, 2018
15 minutes ago, Draco18s said:

Sorry, its TickEvent.PlayerTickEvent

 

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

still dident work):, same thing happened

  • Quote

Share this post


Link to post
Share on other sites

IKnowImEZ    0

IKnowImEZ

IKnowImEZ    0

  • Tree Puncher
  • IKnowImEZ
  • Members
  • 0
  • 26 posts
Posted May 6, 2018

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

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted May 6, 2018
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.

  • Quote

Share this post


Link to post
Share on other sites

IKnowImEZ    0

IKnowImEZ

IKnowImEZ    0

  • Tree Puncher
  • IKnowImEZ
  • Members
  • 0
  • 26 posts
Posted May 6, 2018
14 minutes ago, Draco18s said:

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

how should i do it then?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted May 6, 2018
2 hours ago, Draco18s said:

use TickEvent.ClientTickEvent

 

  • Quote

Share this post


Link to post
Share on other sites

MFMods    8

MFMods

MFMods    8

  • Stone Miner
  • MFMods
  • Members
  • 8
  • 58 posts
Posted May 10, 2018
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.)

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45660 posts
Posted May 10, 2018
1 hour ago, MFMods said:

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

When using a key binding, it already listens to the key events for you, you then use the tick event to check if your key binding was pressed.

When not using a key binding you indeed need to use InputEvent.KeyInputEvent and use raw LWJGL.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • kdcswag
      Can't download forge (AdBlock Problem)

      By kdcswag · Posted 52 minutes ago

      Are you even trying to fix the issue?
    • DaemonUmbra
      [solved]

      By DaemonUmbra · Posted 1 hour ago

      For future reference: 1.7.10 is no longer supported on this forum due to its age. Update to a modern version of Minecraft to receive support.
    • OdachiPlayz
      [solved]

      By OdachiPlayz · Posted 1 hour ago

      I DONT KNOW HOW TO DELETE THIS POST BUT IM DUMB AND SOLVED THE ISSUE MYSELF ADMINS PLEASE DELETE  
    • KingMax
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax · Posted 2 hours ago

      Greetings Comrade/Captain/Hauptmann! Welcome to Europe's final theater of war, Scandinavia! Despite the fall of Berlin the third Reich continues to hold out in Norway and the surrounding areas, the war is not yet over. Ultimate Victory will require many more battles to be fought. Infrastructure will need to be built, tanks, planes and ships shall have to be designed and produced and factories will be needed to produce the weapons of war.Endsieg has a multitude of special mechanics found on almost no other MC servers: fully functional ground, air and sea vehicles, guns, factories and more!Will you fight for the Allies to liberate Norway from tyranny?Will you defend the Soviet motherland by finally defeating the fascist menace?Will you take up the mantle of saving the remains of the Third Reich?Will you preserve the territorial integrity of the Republic of Finland?Will you help the Kingdom of Sweden once again rise to prominence as a Baltic powerhouse?Due to launch in a short matter of days or weeks, join our discord!discord.gg/anp3BJQ
    • Crack3dC0d3
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3 · Posted 2 hours ago

      bump
  • Topics

    • kdcswag
      9
      Can't download forge (AdBlock Problem)

      By kdcswag
      Started December 1

    • OdachiPlayz
      1
      [solved]

      By OdachiPlayz
      Started 1 hour ago

    • KingMax
      0
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax
      Started 2 hours ago

    • Crack3dC0d3
      4
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3
      Started December 2

    • snivinia
      2
      unable to connect to friend's modded server

      By snivinia
      Started 20 hours ago

  • Who's Online (See full list)

    • saxon564
    • coolsim
    • snivinia
    • CelloKit
    • plugsmustard
    • hobohogiepro
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Key Binds not working
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community