ctbe Posted August 28, 2017 Posted August 28, 2017 I recently read somewhere in an answer to an old thread that rarely one should subscribe to KeyInputEvent when handling KeyBindings. That one should subscribe instead to ClientTickEvent. Of course, the answer was fitted to the context of that thread. In my case, in which all I do is open a GuiScreen menu should I subscribe with this @Subscribe def onKeyInput (keyInputEvent: KeyInputEvent): Unit = { // Do my logic here using KeyBinding.isKeyDown() } or with this @Subscribe def onClientTickEvent (clientTickEvent: ClientTickEvent): Unit = { // Do my logic here using KeyBinding.isKeyDown() } I have only one KeyBinding, the one for opening the gui. For my purposes, I currently find no use for the keyInputEvent variable. Also, will subscribing to check for key inputs on the ClientTickEvent consume more processing power than using KeyInputEvent? I somehow feel it does because while I am not moving or doing anything, minecraft would still be checking for the key binding state every tick. Quote
ctbe Posted August 28, 2017 Author Posted August 28, 2017 Quite interesting. I was unaware of those details. Thanks. I will use the ClientTickEvent. Quote
Recommended Posts
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.