Class ScreenEvent.KeyInput

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.ScreenEvent
net.minecraftforge.client.event.ScreenEvent.KeyInput
Direct Known Subclasses:
ScreenEvent.KeyPressed, ScreenEvent.KeyReleased
Enclosing class:
ScreenEvent

private abstract static class ScreenEvent.KeyInput extends ScreenEvent

Fired whenever a keyboard key is pressed or released. See the various subclasses to listen for key pressing or releasing.

See Also:
  • Field Details

    • keyCode

      private final int keyCode
    • scanCode

      private final int scanCode
    • modifiers

      private final int modifiers
  • Constructor Details

    • KeyInput

      @Internal protected KeyInput(Screen screen, int keyCode, int scanCode, int modifiers)
  • Method Details

    • getKeyCode

      public int getKeyCode()
      Returns the GLFW (platform-agnostic) key code.
      Returns:
      the GLFW (platform-agnostic) key code
      See Also:
    • getScanCode

      public int getScanCode()
      Returns the platform-specific scan code.

      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.

      Returns:
      the platform-specific scan code
      See Also:
    • getModifiers

      public int getModifiers()
      Returns a bit field representing the active modifier keys.
      Returns:
      a bit field representing the active modifier keys
      See Also: