Class Keybind.Builder
- Enclosing class:
Keybind
Builds a
Keybind; from Keybind.builder(String). Also has the options every entry has (Entry.Builder).-
Method Summary
Modifier and TypeMethodDescriptionallowMouse(boolean allowMouse) Whether mouse buttons can be bound;trueby default, as in vanilla.build()Builds the key binding button.A fixed label; seelabel(Supplier).The text before ": key", re-read on every refresh.Stores the newly bound key; runs on the main thread.Reads the mod's current key; re-read on every refresh.
-
Method Details
-
label
The text before ": key", re-read on every refresh. Required.- Parameters:
label- read on refresh- Returns:
- this builder
-
label
A fixed label; seelabel(Supplier).- Parameters:
label- the label- Returns:
- this builder
-
value
Reads the mod's current key; re-read on every refresh. Required. May returnnullorKey.UNBOUNDfor no key.- Parameters:
value- reads the key- Returns:
- this builder
-
onChange
Stores the newly bound key; runs on the main thread. Required. GetsKey.UNBOUNDwhen the player pressed Escape.- Parameters:
onChange- receives the new key, nevernull- Returns:
- this builder
-
allowMouse
Whether mouse buttons can be bound;trueby default, as in vanilla. Iffalse, a mouse click while waiting just stops waiting.- Parameters:
allowMouse- whether to accept mouse buttons- Returns:
- this builder
-
build
Builds the key binding button.- Returns:
- the button
- Throws:
IllegalStateException- iflabel,valueoronChangeis missing
-