Skip to content

[Question] How can you get the keybind associated with something? #834

Discussion options

You must be logged in to vote

Use TextComponents.
For the colouring you can use Text.darkGray('hello') or Text.of('hi').darkGray(), and for keybunds you can use Text.keybind('key.sneak'), where the text inside is the keybind 'id'. You can find that in the options.txt file, it will probably be something like key.open_backpack. (it will definitely contain the text open_backpack)

With these components you can join them in two ways, either by sticking them in a list or by appending them.
list: [Text.darkGray('Press ['), Text.keybind('key.open_backpack').darkGray(), Text.darkGray('] to open while equipped')]
appending: Text.darkGray('Press [').append(Text.keybind('key.open_backpack')).append('] to open while equipped')

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ChiefArug
Comment options

Answer selected by DUDEbehindDUDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants