There is currently no way to detect if a player has a key pressed. A predicate to detect if a player is pressing a key would be a complete gamechanger for mapmakers and allow for an unbelievable amount of mechanics that are currently impossible.
Here's an example of how it could work:
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"keys": {
"jump": true
}
}
}
NOTE: THIS IS DETECTING THE KEYBIND, NOT DETECTING WHICH KEY IS PRESSED. I am not detecting if "space" was pressed, I'm detecting if the key (regardless of what it is) that is mapped to the jump action was pressed. This should prevent any privacy issues related to receiving keystrokes, as we are not querying what character they are pressing and have no way of determining that, we are just querying the keystroke mapped to an in-game event.
Please sign in to leave a comment.
2 Comments