Class KeyBindingHelper
java.lang.Object
net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper
Helper for registering key bindings.
Helper class for KeyBinding
for use by Fabric mods.
KeyBinding left = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.example.left", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_P, "key.category.example"));
KeyBinding right = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.example.right", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_U, "key.category.example"));
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.client.util.InputUtil.Key
getBoundKeyOf
(net.minecraft.client.option.KeyBinding keyBinding) Returns the configured KeyCode bound to the KeyBinding from the player's settings.static net.minecraft.client.option.KeyBinding
registerKeyBinding
(net.minecraft.client.option.KeyBinding keyBinding) Registers the keybinding and add the keybinding category if required.
-
Method Details
-
registerKeyBinding
public static net.minecraft.client.option.KeyBinding registerKeyBinding(net.minecraft.client.option.KeyBinding keyBinding) Registers the keybinding and add the keybinding category if required.- Parameters:
keyBinding
- the keybinding- Returns:
- the keybinding itself
-
getBoundKeyOf
public static net.minecraft.client.util.InputUtil.Key getBoundKeyOf(net.minecraft.client.option.KeyBinding keyBinding) Returns the configured KeyCode bound to the KeyBinding from the player's settings.- Parameters:
keyBinding
- the keybinding- Returns:
- configured KeyCode
-