Package net.minecraftforge.client.event
Class InputEvent.Key
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.InputEvent
net.minecraftforge.client.event.InputEvent.Key
- Enclosing class:
- InputEvent
Fired when a keyboard key input occurs, such as pressing, releasing, or repeating a key.
 
This event is not cancellable, and does not have a result.
This event is fired on the main Forge event bus, only on the logical client.
- 
Nested Class SummaryNested classes/interfaces inherited from class net.minecraftforge.client.event.InputEventInputEvent.InteractionKeyMappingTriggered, InputEvent.Key, InputEvent.MouseButton, InputEvent.MouseScrollingEventNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Eventnet.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintReturns the mouse button's action.intgetKey()Returns theGLFW(platform-agnostic) key code.intReturns a bit field representing the active modifier keys.intReturns the platform-specific scan code.Methods inherited from class net.minecraftforge.eventbus.api.EventgetListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
- 
Field Details- 
keyprivate final int key
- 
scanCodeprivate final int scanCode
- 
actionprivate final int action
- 
modifiersprivate final int modifiers
 
- 
- 
Constructor Details- 
Key@Internal public Key(int key, int scanCode, int action, int modifiers) 
 
- 
- 
Method Details- 
getKeypublic int getKey()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
 
 
- 
getScanCodepublic 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:
 
- 
getActionpublic int getAction()Returns the mouse button's action.- Returns:
- the mouse button's action
- See Also:
 
- 
getModifierspublic 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
 
 
 
-