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 Details

    • keysById

      private static final Map<String,​KeyBinding> keysById
    • keyToBindings

      private static final Map<InputUtil.Key,​KeyBinding> keyToBindings
    • keyCategories

      private static final Set<String> keyCategories
    • categoryOrderMap

      private static final Map<String,​Integer> categoryOrderMap
    • translationKey

      private final String translationKey
    • defaultKey

      private final InputUtil.Key defaultKey
    • category

      private final String category
    • boundKey

      private InputUtil.Key boundKey
    • pressed

      private boolean pressed
    • timesPressed

      private int timesPressed
  • Constructor Details

    • KeyBinding

      public KeyBinding​(String translationKey, int code, String category)
    • KeyBinding

      public KeyBinding​(String translationKey, InputUtil.Type type, int code, String category)
  • Method Details

    • onKeyPressed

      public static void onKeyPressed​(InputUtil.Key key)
    • setKeyPressed

      public static void setKeyPressed​(InputUtil.Key key, boolean pressed)
    • updatePressedStates

      public static void updatePressedStates()
    • unpressAll

      public static void unpressAll()
    • updateKeysByCode

      public static void updateKeysByCode()
    • isPressed

      public boolean isPressed()
    • getCategory

      public String getCategory()
    • wasPressed

      public boolean wasPressed()
    • reset

      private void reset()
    • getTranslationKey

      public String getTranslationKey()
    • getDefaultKey

      public InputUtil.Key getDefaultKey()
    • setBoundKey

      public void setBoundKey​(InputUtil.Key boundKey)
    • compareTo

      public int compareTo​(KeyBinding keyBinding)
      Specified by:
      compareTo in interface Comparable<KeyBinding>
    • getLocalizedName

      public static Supplier<Text> getLocalizedName​(String id)
    • equals

      public boolean equals​(KeyBinding other)
    • isUnbound

      public boolean isUnbound()
    • matchesKey

      public boolean matchesKey​(int keyCode, int scanCode)
    • matchesMouse

      public boolean matchesMouse​(int code)
    • getBoundKeyLocalizedText

      public Text getBoundKeyLocalizedText()
    • isDefault

      public boolean isDefault()
    • getBoundKeyTranslationKey

      public String getBoundKeyTranslationKey()
    • setPressed

      public void setPressed​(boolean pressed)