Description
Truly Modular gives datapacks the ability to add keybinds to the game. They need to be placed under mod-id:miapi/key_binding/any-name-or-path.json These keybinds will be send to the client on connect and the client will cache them in Truly Modulars Config. After the first connect to the server the Keybind will be on the client until the player purges their config. This means they cannot change keybinds until loading a world where the binding is used, Afterwards, the binding will always be changeable - until the config is reset. Keybind jsons look like this
{"miapi:test": {"id": "miapi:test","category": "miapi","scan_code": 32,"handler": {"hands": ["OFFHAND" , "MAINHAND"],"type": "miapi:use_item_ability","item_interaction": true,"block_interaction": true,"entity_interaction": true}}}
category
This is the Category where you can find the binding in Minecraft's Rebind UI.
scan_code
this is the default of the binding.
entity_interaction
This sets if entity interactions are allowed, something like lighting a creeper on fire with a flint and steel.
block_interaction
This sets if block interactions can be triggered, something like stripping wood.
item_interaction
If Empty interactions (without entity or blocks) are allowed.
Ability
To utilise new keybinds the Keybind Ability exists.
{"keybind_ability_context":{"miapi:ability_id": {//same context as normal ability property}}}
example:
{"keybind_ability_context":{"miapi:test": {"copy_item": {"id":"minecraft:flint_and_steel"}}}}
{"miapi:test": {"id": "miapi:test","category": "miapi","scan_code": 5,"handler": {"type": "miapi:use_item_ability"}}}
while this is placed in miapi/miapi/key_binding/test
will add a new custom keybind
{"keybind_ability_context":{"miapi:test": {"copy_item": {"id":"minecraft:bow","fake_item_identity": true}}}}