Class KeyEvent

java.lang.Object
dev.myriadclient.api.event.Cancellable
dev.myriadclient.api.event.events.KeyEvent

public final class KeyEvent extends Cancellable
A keyboard key was pressed, released or repeated (held down) in the game window, in a screen or not. Posted on the render thread before Minecraft handles it; a typed character follows as a CharEvent. Cancel it to hide it from Minecraft (no key binding, no screen input).
  • Constructor Summary

    Constructors
    Constructor
    Description
    KeyEvent(int key, int scancode, int action, int modifiers, boolean inScreen)
    Core's; only Myriad makes these.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    InputConstants.PRESS, InputConstants.RELEASE or InputConstants.REPEAT.
    boolean
    Whether a screen was open when the key changed.
    boolean
    Whether the key went down (not a repeat).
    boolean
    Whether the key came up.
    int
    key()
    Which key, by its position on the keyboard: an InputConstants.KEY_* value (Q is where a US layout has it).
    int
    The modifier keys held, as InputConstants.MOD_* bits (MOD_SHIFT, MOD_CONTROL...).
    int
    What the key types on the player's layout (an SDL keycode: 'q' for the key labelled Q, wherever it is).

    Methods inherited from class Cancellable

    cancel, isCancelled, setCancelled

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeyEvent

      @Internal public KeyEvent(int key, int scancode, int action, int modifiers, boolean inScreen)
      Core's; only Myriad makes these.
  • Method Details

    • key

      public int key()
      Which key, by its position on the keyboard: an InputConstants.KEY_* value (Q is where a US layout has it).
    • scancode

      public int scancode()
      What the key types on the player's layout (an SDL keycode: 'q' for the key labelled Q, wherever it is).
    • action

      public int action()
      InputConstants.PRESS, InputConstants.RELEASE or InputConstants.REPEAT.
    • modifiers

      public int modifiers()
      The modifier keys held, as InputConstants.MOD_* bits (MOD_SHIFT, MOD_CONTROL...).
    • inScreen

      public boolean inScreen()
      Whether a screen was open when the key changed.
    • isPress

      public boolean isPress()
      Whether the key went down (not a repeat).
    • isRelease

      public boolean isRelease()
      Whether the key came up.