tutorial:keybinds
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:keybinds [2020/12/05 18:07] – formatting majavah | tutorial:keybinds [2021/02/28 17:23] – Fixed a minor formatting issue sailkite | ||
---|---|---|---|
Line 8: | Line 8: | ||
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: | ||
* create a KeyBinding object | * create a KeyBinding object | ||
* react to the key being pressed | * react to the key being pressed | ||
Line 13: | Line 14: | ||
See [[https:// | See [[https:// | ||
+ | |||
+ | ==== Preparing an Entrypoint ==== | ||
+ | |||
+ | If you already have a Client entrypoint created and you are familiar with how it works, you can safely proceed to the [[#Creating your Keybind|next section]]. Otherwise, stick around for a quick overview! | ||
+ | |||
+ | In order to create a Client entrypoint, we'll need to do a couple of different things to let Fabric know that we intend to specify code that only needs to be executed by the physical client [[tutorial: | ||
+ | |||
+ | <code java[enable_line_numbers=" | ||
+ | /* package */ | ||
+ | /* imports */ | ||
+ | |||
+ | public class ExampleClientEntrypoint implements ClientModInitializer { | ||
+ | | ||
+ | // The KeyBinding declaration and registration are commonly executed here statically | ||
+ | | ||
+ | @Override | ||
+ | public void onInitializeClient() { | ||
+ | | ||
+ | // Event registration will be executed inside this method | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | So, what are we doing here? Fabric entrypoints for most use cases are designated by implementing a special interface unique to the side or sides that the code in the entrypoint should be run on. For our Client, we simply have our class implement the '' | ||
==== Creating your Keybind ==== | ==== Creating your Keybind ==== |
tutorial/keybinds.txt · Last modified: 2023/12/27 13:14 by 2601:188:cb7c:25a0:19fa:9122:4e5a:fad1