Added keybinding to toggle if hud is shown
This commit is contained in:
parent
59d4199260
commit
98c8f43b84
6 changed files with 118 additions and 48 deletions
14
src/main/java/techreborn/client/keybindings/KeyBindings.java
Normal file
14
src/main/java/techreborn/client/keybindings/KeyBindings.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package techreborn.client.keybindings;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public class KeyBindings {
|
||||
|
||||
public static KeyBinding config = new KeyBinding(ModInfo.Keys.CONFIG,
|
||||
Keyboard.KEY_P, ModInfo.Keys.CATEGORY);
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package techreborn.client.keybindings;
|
||||
|
||||
import techreborn.lib.Key;
|
||||
import techreborn.util.LogHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
|
||||
public class KeyInputEventHandler
|
||||
{
|
||||
private static Key getPressedKeybinding()
|
||||
{
|
||||
if (KeyBindings.config.isPressed()) {
|
||||
return Key.CONFIG;
|
||||
}
|
||||
|
||||
return Key.UNKNOWN;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleKeyInputEvent(InputEvent.KeyInputEvent event)
|
||||
{
|
||||
LogHelper.info(getPressedKeybinding());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue