Class KeyMappingHelper
java.lang.Object
net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper
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:
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.mojang.blaze3d.platform.InputConstants.KeygetBoundKeyOf(net.minecraft.client.KeyMapping keyMapping) Returns the configured KeyCode bound to the KeyMapping from the player's settings.static net.minecraft.client.KeyMappingregisterKeyMapping(net.minecraft.client.KeyMapping keyMapping) Registers the keymapping and add the keymapping category if required.
-
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
-