Class InputEvent.KeyInputEvent

  • Enclosing class:
    InputEvent

    public static class InputEvent.KeyInputEvent
    extends InputEvent
    This event fires when a keyboard input is detected.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int action  
      private int key  
      private int modifiers  
      private int scanCode  
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyInputEvent​(int key, int scanCode, int action, int modifiers)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getAction()
      Integer representing the key's action.
      int getKey()
      The keyboard key that triggered this event.
      int getModifiers()
      Bit field representing the modifier keys pressed.
      int getScanCode()
      Platform-specific scan code.
      • Methods inherited from class net.minecraftforge.eventbus.api.Event

        getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • key

        private final int key
      • scanCode

        private final int scanCode
      • action

        private final int action
      • modifiers

        private final int modifiers
    • Constructor Detail

      • KeyInputEvent

        public KeyInputEvent​(int key,
                             int scanCode,
                             int action,
                             int modifiers)
    • Method Detail

      • getKey

        public int getKey()
        The keyboard key that triggered this event. https://www.glfw.org/docs/latest/group__keys.html
        See Also:
        key constants starting with "GLFW_KEY_"
      • getScanCode

        public int getScanCode()
        Platform-specific scan code. Used for InputMappings#getInputByCode(int, int) The scan code is unique for every key, regardless of whether it has a key code. Scan codes are platform-specific but consistent over time, so keys will have different scan codes depending on the platform but they are safe to save to disk as custom key bindings.
      • getAction

        public int getAction()
        Integer representing the key's action.
        See Also:
        GLFW.GLFW_PRESS, GLFW.GLFW_RELEASE, GLFW.GLFW_REPEAT
      • getModifiers

        public int getModifiers()
        Bit field representing the modifier keys pressed. https://www.glfw.org/docs/latest/group__mods.html
        See Also:
        GLFW.GLFW_MOD_SHIFT, GLFW.GLFW_MOD_CONTROL, GLFW.GLFW_MOD_ALT, GLFW.GLFW_MOD_SUPER