Package net.minecraft.client.options
Class KeyBinding
java.lang.Object
net.minecraft.client.options.KeyBinding
- All Implemented Interfaces:
Comparable<KeyBinding>
- Direct Known Subclasses:
StickyKeyBinding
@Environment(CLIENT) public class KeyBinding extends Object implements Comparable<KeyBinding>
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description KeyBinding(String translationKey, int code, String category)
KeyBinding(String translationKey, InputUtil.Type type, int code, String category)
-
Method Summary
Modifier and Type Method 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()
-
Field Details
-
keysById
-
keyToBindings
-
keyCategories
-
categoryOrderMap
-
translationKey
-
defaultKey
-
category
-
boundKey
-
pressed
private boolean pressed -
timesPressed
private int timesPressed
-
-
Constructor Details
-
KeyBinding
-
KeyBinding
-
-
Method Details
-
onKeyPressed
-
setKeyPressed
-
updatePressedStates
public static void updatePressedStates() -
unpressAll
public static void unpressAll() -
updateKeysByCode
public static void updateKeysByCode() -
isPressed
public boolean isPressed() -
getCategory
-
wasPressed
public boolean wasPressed() -
reset
private void reset() -
getTranslationKey
-
getDefaultKey
-
setBoundKey
-
compareTo
- Specified by:
compareTo
in interfaceComparable<KeyBinding>
-
getLocalizedName
-
equals
-
isUnbound
public boolean isUnbound() -
matchesKey
public boolean matchesKey(int keyCode, int scanCode) -
matchesMouse
public boolean matchesMouse(int code) -
getBoundKeyLocalizedText
-
isDefault
public boolean isDefault() -
getBoundKeyTranslationKey
-
setPressed
public void setPressed(boolean pressed)
-