Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Beyondo

Members
  • Posts

    4
  • Joined

  • Last visited

Beyondo's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. And can you just tell me the simple solution instead of being so mysterious about it? "Do it the proper way!" doesn't help at all.
  2. Exactly. This was just an example. Of course you wouldn't want to use this specific key input because it detects both key events thus triggering twice. Let's focus on the concept.
  3. It is for people who want to set a key bind that doesn't get triggered when chat is opened. Example: I set key bind `h`. You type `hello` in chat and the user accidentally activate the key bind. What's spyware about that? Wtf.
  4. This might be the only working solution that I discovered for newer versions. // Disclaimer: This is just an example of a non-abstracted code to only demonstrate the workaround. public static Screen currentScreen = null; @SubscribeEvent public static void onChangeGUI(GuiOpenEvent event) { currentScreen = event.getGui(); } @SubscribeEvent public static void onKeyInput(final InputEvent.KeyInputEvent e) { if(currentScreen == null && e.getAction() == GLFW.GLFW_PRESS && e.getKey() == 'R') Weapon.reload(); } I'm posting it so people wouldn't struggle with deprecated code from 1.12.2 and old threads like I did at first. (Cause Minecraft::currentScreen was removed for some reason) Is there a simpler solution? Edit: I discovered that we could also include our keys bindings into the settings of the user too through FMLClientSetupEvent which is cool. Yet that doesn't simplify anything. I still have to use GuiOpenEvent to check for null screen. Is there something I'm missing in the documentation? Can you point me to it? I'm new to Forge. Like actually telling me how to use that built-in functionality you're talking about to do proper key bindings would be highly appreciated.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.