Title is as it says. I've created a small mod, but as a part of it I've added two keybinds. After adding them, I noticed that Minecraft automatically added them into the Controls GUI. I'm hoping there there is some way to remove this, as it makes the controls window rather cumbersome. Alternatively in the long run I'd like to create my own GUI with the option to change these keybind settings, much like the Controls GUI allows for, but with other additional sliders for necessary changes.
That is all in the future though, for now I'd simply like to know how to remove my keybinds from the Control GUI
When you use ModLoader.registerKey(this, key, true/false), it adds the key to the KeyBindings[] in GameSettings, which is then passed to GuiControls to list of all the controls. GuiControls will then print all keys to the control screen.
I'm assuming this is also part of the mod from other topic you have, where all checks on whether a key is pressed or not is in a onTickInGame().
Since you aren't using:
public void keyboardEvent(KeyBinding keybinding)
{
}
in your code, you don't need to localize and register your keys.
Unregistered keys will not work for keyboardEvent, but they can still be checked within onTickInGame().
When you use ModLoader.registerKey(this, key, true/false), it adds the key to the KeyBindings[] in GameSettings, which is then passed to GuiControls to list of all the controls. GuiControls will then print all keys to the control screen.
I'm assuming this is also part of the mod from other topic you have, where all checks on whether a key is pressed or not is in a onTickInGame().
Since you aren't using:
public void keyboardEvent(KeyBinding keybinding)
{
}
in your code, you don't need to localize and register your keys.
Unregistered keys will not work for keyboardEvent, but they can still be checked within onTickInGame().
Actually I found out that it worked better in the keyboardEvent, as the onTickInGame caused random acceleration if you held the button too long. With keyboardEvent it does still occur but less frequently, and usually only after holding the + or - buttons for long periods of time.
Actually I found out that it worked better in the keyboardEvent, as the onTickInGame caused random acceleration if you held the button too long. With keyboardEvent it does still occur but less frequently, and usually only after holding the + or - buttons for long periods of time.
I tried the code in keyboardEvent(), but to change time I need click +/- multiple times (time does not change smoothly, only 100 at a time). keyboardEvent is run whenever a key is initially pressed, but is not continuously called while it is pressed down, how did you manage to get your code to run the same way as in onTickInGame()?
Thanks to you and Pheenix though, the code now works without any problems!
If you'd like I can send you the source code for this, along with comments on what does what. I am planning on using this for a small mod, but I planned on having it entirely open-source since it is such a small mod.
That is all in the future though, for now I'd simply like to know how to remove my keybinds from the Control GUI
Sure thing
I'm assuming this is also part of the mod from other topic you have, where all checks on whether a key is pressed or not is in a onTickInGame().
Since you aren't using:
in your code, you don't need to localize and register your keys.
Unregistered keys will not work for keyboardEvent, but they can still be checked within onTickInGame().
Actually I found out that it worked better in the keyboardEvent, as the onTickInGame caused random acceleration if you held the button too long. With keyboardEvent it does still occur but less frequently, and usually only after holding the + or - buttons for long periods of time.
I tried the code in keyboardEvent(), but to change time I need click +/- multiple times (time does not change smoothly, only 100 at a time). keyboardEvent is run whenever a key is initially pressed, but is not continuously called while it is pressed down, how did you manage to get your code to run the same way as in onTickInGame()?
Thanks to you and Pheenix though, the code now works without any problems!
If you'd like I can send you the source code for this, along with comments on what does what. I am planning on using this for a small mod, but I planned on having it entirely open-source since it is such a small mod.
In onTickInGame
Import the LWJGL Keyboard, not the default Java one