maruohon / malilib

Library mod for masa's client-side Minecraft mods
GNU Lesser General Public License v3.0
294 stars 125 forks source link

Too many debug messages on key held #9

Open Naheulf opened 5 years ago

Naheulf commented 5 years ago

Description of the Issue

MaLiLib send too many messages if one key is held.

Steps to Reproduce the Issue

  1. Run minecraft in a way you can see the stdout (console output)
  2. Open malilib config
  3. Set keybindDebugging to true
  4. Press and hold any key for few seconds
  5. Release the key

Expected Behavior

Only two or three messages should be send: "PRESS D (32), held keys: D (32)" "held keys: D (32)" (optional) "RELEASE D (32), held keys: "

Actual Behavior

The "PRESS " message is send many times per second

[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:24] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:25] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:25] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:25] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:25] [Client thread/INFO] [malilib]: PRESS D (32), held keys: D (32)
[15:42:25] [Client thread/INFO] [malilib]: RELEASE D (32), held keys: <none>

Debug Information

Tested with theses mods:

maruohon commented 5 years ago

This happens in GUIs or other contexts where Keyboard.enableRepeatEvents(true) has been called. As far as anything using key events is concerned, those repeat events are the same as the normal initial key press. So this is pretty much working as intended, although it's true that it gets very spammy.

I think I could add an option to the keybind debugging to basically omit those repeat event messages if they are not desired, but I won't hard-code remove those completely as they can be useful/vital in some cases.