-
Notifications
You must be signed in to change notification settings - Fork 754
/
KeyBindingPressedEvent.java
43 lines (37 loc) · 1.26 KB
/
KeyBindingPressedEvent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package modwarriors.notenoughkeys.api;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.KeyBinding;
/**
* Called when a keybinding is triggered with the passed with valid modifiers
*
* @author TheTemportalist
*/
@SideOnly(Side.CLIENT)
@Cancelable
public class KeyBindingPressedEvent extends Event {
/**
* The KeyBinding being triggered
*/
public KeyBinding keyBinding = null;
/**
* Tells whether a modifier was required AND was down when triggered
*/
public boolean shiftRequired = false, ctrlRequired = false, altRequired = false;
/**
* Called with the passed keyBinding and modifiers.
* Subscribe to this event so activate a keybinding when triggered.
*
* @param keyBinding The KeyBinding being triggered. Stores the key's description and keycode
* @param modifiers The modifiers (SHIFT, CTRL, ALT) that determine when a compatible key is pressed
*/
public KeyBindingPressedEvent(KeyBinding keyBinding, boolean[] modifiers) {
super();
this.keyBinding = keyBinding;
this.shiftRequired = modifiers[0];
this.ctrlRequired = modifiers[1];
this.altRequired = modifiers[2];
}
}