@Environment(value=CLIENT) public class KeyBinding extends Object implements Comparable<KeyBinding>
Modifier and Type | Field and Description |
---|---|
private InputUtil.Key |
boundKey |
private String |
category |
private static Map<String,Integer> |
categoryOrderMap |
private InputUtil.Key |
defaultKey |
private static Set<String> |
keyCategories |
private static Map<String,KeyBinding> |
keysById |
private static Map<InputUtil.Key,KeyBinding> |
keyToBindings |
private boolean |
pressed |
private int |
timesPressed |
private String |
translationKey |
Constructor and Description |
---|
KeyBinding(String translationKey,
InputUtil.Type type,
int code,
String category) |
KeyBinding(String translationKey,
int code,
String category) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(KeyBinding keyBinding) |
boolean |
equals(KeyBinding other) |
Text |
getBoundKeyLocalizedText() |
String |
getBoundKeyTranslationKey() |
String |
getCategory() |
InputUtil.Key |
getDefaultKey() |
static Supplier<Text> |
getLocalizedName(String id) |
String |
getTranslationKey() |
boolean |
isDefault() |
boolean |
isPressed() |
boolean |
isUnbound() |
boolean |
matchesKey(int keyCode,
int scanCode) |
boolean |
matchesMouse(int code) |
static void |
onKeyPressed(InputUtil.Key key) |
private void |
reset() |
void |
setBoundKey(InputUtil.Key boundKey) |
static void |
setKeyPressed(InputUtil.Key key,
boolean pressed) |
void |
setPressed(boolean pressed) |
static void |
unpressAll() |
static void |
updateKeysByCode() |
static void |
updatePressedStates() |
boolean |
wasPressed() |
private static final Map<String,KeyBinding> keysById
private static final Map<InputUtil.Key,KeyBinding> keyToBindings
private final String translationKey
private final InputUtil.Key defaultKey
private final String category
private InputUtil.Key boundKey
private boolean pressed
private int timesPressed
public KeyBinding(String translationKey, InputUtil.Type type, int code, String category)
public static void onKeyPressed(InputUtil.Key key)
public static void setKeyPressed(InputUtil.Key key, boolean pressed)
public static void updatePressedStates()
public static void unpressAll()
public static void updateKeysByCode()
public boolean isPressed()
public String getCategory()
public boolean wasPressed()
private void reset()
public String getTranslationKey()
public InputUtil.Key getDefaultKey()
public void setBoundKey(InputUtil.Key boundKey)
public int compareTo(KeyBinding keyBinding)
compareTo
in interface Comparable<KeyBinding>
public boolean equals(KeyBinding other)
public boolean isUnbound()
public boolean matchesKey(int keyCode, int scanCode)
public boolean matchesMouse(int code)
public Text getBoundKeyLocalizedText()
public boolean isDefault()
public String getBoundKeyTranslationKey()
public void setPressed(boolean pressed)