Class KeyMappingHelper

java.lang.Object
net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper

public final class KeyMappingHelper extends Object
Helper for registering KeyMappings.
KeyMapping left = KeyMappingHelper.registerKeyMapping(new KeyMapping("key.example.left", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_P, KeyMapping.Category.MISC));
KeyMapping right = KeyMappingHelper.registerKeyMapping(new KeyMapping("key.example.right", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_U, KeyMapping.Category.MISC));
See Also:
  • KeyMapping
  • ToggleKeyMapping
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.mojang.blaze3d.platform.InputConstants.Key
    getBoundKeyOf(net.minecraft.client.KeyMapping keyMapping)
    Returns the configured KeyCode bound to the KeyMapping from the player's settings.
    static net.minecraft.client.KeyMapping
    registerKeyMapping(net.minecraft.client.KeyMapping keyMapping)
    Registers the keymapping and add the keymapping category if required.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • registerKeyMapping

      public static net.minecraft.client.KeyMapping registerKeyMapping(net.minecraft.client.KeyMapping keyMapping)
      Registers the keymapping and add the keymapping category if required.
      Parameters:
      keyMapping - the keymapping
      Returns:
      the keymapping itself
      Throws:
      IllegalArgumentException - when a key mapping with the same ID is already registered
    • getBoundKeyOf

      public static com.mojang.blaze3d.platform.InputConstants.Key getBoundKeyOf(net.minecraft.client.KeyMapping keyMapping)
      Returns the configured KeyCode bound to the KeyMapping from the player's settings.
      Parameters:
      keyMapping - the keymapping
      Returns:
      configured KeyCode