User Tools

Site Tools


tutorial:keybinds

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:keybinds [2025/12/09 17:28] mcgambingprotutorial:keybinds [2025/12/12 16:57] (current) – fix half-finished mojmapping cassiancc
Line 9: Line 9:
 Adding a key-bind is easy. You'll need to: Adding a key-bind is easy. You'll need to:
   * open or create a Client [[documentation:entrypoint]]   * open or create a Client [[documentation:entrypoint]]
-  * create a Keybinding.Category object +  * create a KeyMapping.Category object 
-  * create a KeyBinding object+  * create a KeyMapping object
   * react to the key being pressed   * react to the key being pressed
  
  
-See [[https://github.com/FabricMC/fabric/blob/1.21.10/fabric-key-binding-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/client/keybinding/KeyBindingsTest.java|here]] for an updated example.+See [[https://github.com/FabricMC/fabric/blob/1.21.11/fabric-key-binding-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/client/keybinding/KeyBindingsTest.java|here]] for an updated example.
  
 ==== Preparing an Entrypoint ==== ==== Preparing an Entrypoint ====
Line 49: Line 49:
 </code> </code>
  
-KeyBindingHelper has a Builder for initialization. It takes in an Identifier, InputUtil.Type, key code, and KeyBinding.Category:+KeyBindingHelper has a Builder for initialization. It takes in an Identifier, InputUtil.Type, key code, and KeyMapping.Category:
  
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
Line 60: Line 60:
 </code> </code>
  
-On versions older than 1.21.9, you would substitute your Keybinding.Category for the translation key of the keybinding's category, e.g. "category.examplemod.test"+On versions older than 1.21.9, you would substitute your KeyMapping.Category for the translation key of the keybinding's category, e.g. "category.examplemod.test"
  
 Sticky keys can also be created with ''KeyBindingHelper''. In vanilla, the sneak and sprint keys act as sticky keys when they are set to 'Sneak: Toggle' and 'Sprint: Toggle' respectively. If a key binding should always act as a sticky key, then pass ''() -> true'' as the final parameter. Sticky keys can also be created with ''KeyBindingHelper''. In vanilla, the sneak and sprint keys act as sticky keys when they are set to 'Sneak: Toggle' and 'Sprint: Toggle' respectively. If a key binding should always act as a sticky key, then pass ''() -> true'' as the final parameter.
tutorial/keybinds.1765301303.txt.gz · Last modified: 2025/12/09 17:28 by mcgambingpro