Package net.minecraftforge.client.event
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
Fired whenever a keyboard key is pressed or released. See the various subclasses to listen for key pressing or releasing.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.client.event.ScreenEvent
ScreenEvent.BackgroundRendered, ScreenEvent.CharacterTyped, ScreenEvent.Closing, ScreenEvent.Init, ScreenEvent.KeyPressed, ScreenEvent.KeyReleased, ScreenEvent.MouseButtonPressed, ScreenEvent.MouseButtonReleased, ScreenEvent.MouseDragged, ScreenEvent.MouseScrolled, ScreenEvent.Opening, ScreenEvent.Render, ScreenEvent.RenderInventoryMobEffects
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns theGLFW
(platform-agnostic) key code.int
Returns a bit field representing the active modifier keys.int
Returns the platform-specific scan code.Methods inherited from class net.minecraftforge.client.event.ScreenEvent
getScreen
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
keyCode
private final int keyCode -
scanCode
private final int scanCode -
modifiers
private final int modifiers
-
-
Constructor Details
-
KeyInput
-
-
Method Details
-
getKeyCode
public int getKeyCode()Returns theGLFW
(platform-agnostic) key code.- Returns:
- the
GLFW
(platform-agnostic) key code - See Also:
-
input constants starting with
KEY_
key constants starting with
GLFW_KEY_
- the online GLFW documentation
-
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:
-
CTRL modifier key bit
SHIFT modifier key bit
ALT modifier key bit
SUPER modifier key bit
CAPS LOCK modifier key bit
NUM LOCK modifier key bit
- the online GLFW documentation
-