Works for WASD, Space, Shift, Left CTRL and hotbar 0-8 slots
You can detect the following inputs using inputs:<key>:
- WASD:
forward,back,left,right - Actions:
jump,sneak,sprint - Hotbar:
slot_0throughslot_8
All commands should be run as the player you want to detect inputs from!
# Forward input -once- detection
execute as @p if function inputs:forward/once run say I'm sending singular W's
# Forward input -tick- detection
execute as @p if function inputs:forward/tick run say I'm spamming WYou can lock and unlock certain input detections for certain players!
# @p won't detect forward input now!
execute as @p run function inputs:forward/lockThere's a built in on/off toggle feature
# Locked inputs get unlocked and vice versa
execute as @p run function inputs:forward/toggleTo monitor your input status, run the debug function
# Monitoring via title @s actionbar
execute as @p run function inputs:debugWarning
The only performance bottleneck is one looping @a selector call. Removing it will break once functions!
Important
Subtick Logic: The once detection resets at the end of the tick. This means only the first call to a once function in your logic will return true. Subsequent calls within the same function will fail.
# The first forward/once call will trigger successfully
execute as @p if function inputs:forward/once run say First W check
# All the other ones, however, will be ignored.
execute as @p if function inputs:forward/once run say Second W check ain't workin' :(
execute as @p if function inputs:forward/once run say This one as well