You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developers/bindings-api.mdx
+24-18Lines changed: 24 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,40 +7,46 @@ _Learn how to register new controller bindings._
7
7
## Registering a custom input binding
8
8
9
9
<Calloutvariant="info">
10
-
You should register bindings inside of the Controlify init entrypoint. Read more in [Controlify Entrypoint](controlify-entrypoint#using-the-entrypoint).
10
+
The custom input bindings must be registered inside the Controlify pre-init entrypoint. Read more in [Controlify Entrypoint](controlify-entrypoint#using-the-entrypoint).
11
11
</Callout>
12
12
13
13
Controlify allows users to configure different buttons on their controllers to actions in-game. You may want your own mod's actions to be able to be invoked from the controller too.
14
14
15
-
To register a controller binding, you must use the `ControllerBindingsApi.`
15
+
To register a controller binding, use the `ControllerBindingsApi.get()` method:
// Prevents Controlify from auto-registering controller bindings for Epic Fight's
39
+
// vanilla key mappings due explicit native support.
40
+
// You could also use ".keyEmulation(MyModKeyMappings.ACTION) to emulates
41
+
// the vanilla KeyMapping behavior, which may not always work well.
42
+
.addKeyCorrelation(MyModKeyMappings.ACTION)
28
43
);
29
44
}
30
45
```
31
46
32
47
To add a name and description to the binding, you need to define the language keys `controlify.binding.<namespace>.<path>` and `controlify.binding.<namespace>.<path>.desc` respectively, alternatively, you can set `.name(Component)` and `.description(Component)`
33
48
34
-
Registering the binding provides you with a `BindingSupplier`, where you can then access the binding with `action1Binding.on(controller);`
35
-
36
-
Controlify automatically converts your existed modded `KeyMapping`s to controller bindings, but relying on this behaviour if you are going to explicitly support Controlify is not recommended. You can stop this conversion with the following...
37
-
38
-
```java
39
-
@Override
40
-
publicvoid onControlifyInit(InitContext ctx) {
41
-
ctx.bindings().exclude(MyMod.myKeyMapping);
42
-
}
43
-
```
49
+
Registering the binding provides you with a `InputBindingSupplier`, where you can then access the binding with `actionBinding.on(controller);`
0 commit comments