ClassAbilityGestureState

public final class ClassAbilityGestureState

Pure state machine for the Java F-key ability layer.

F opens a short selection window. A second plain F inside that window selects mobility. Hotbar keys 1, 2 and 3 select mobility, signature and utility. Keys 7, 8 and 9 mirror those bindings so a player can still activate the ability assigned to their already-selected slot, which a vanilla client does not report as a slot change. Left click selects signature; right click selects utility inside the window. Bedrock clients have no F key, so for them starting to sneak opens a longer window, and a jump or a hotbar selection is mobility, since a second sneak is already a double-tap for sneak enchantments. The router reports jumps from Bedrock clients only. The state contains no Bukkit objects, which keeps timing and precedence testable without a server.

Types

Link copied to clipboard
public enum Outcome
Link copied to clipboard
public final class Transition extends Record

Properties

Link copied to clipboard
public final static long CHORD_WINDOW_TICKS
600 ms at the normal server tick rate.
Link copied to clipboard
public final static long SNEAK_WINDOW_TICKS
One second: a controller or touch toggle-sneak is slower to follow up than a key press.

Functions

Link copied to clipboard
Link copied to clipboard
public boolean isOpenAt(long currentTick)
Link copied to clipboard
public ClassAbilityGestureState.Transition jump(long currentTick)
Resolves a jump while the Bedrock window is open: it selects mobility.
Link copied to clipboard
Resolves a left click while the F chord is open: it selects signature.
Link copied to clipboard
public ClassAbilityGestureState.Transition pressF(long currentTick, boolean sneaking)
Link copied to clipboard
Opens, or reopens, the Bedrock window when the player starts to sneak.
Link copied to clipboard
Resolves a right click while the F chord is open: it selects utility.
Link copied to clipboard
public ClassAbilityGestureState.Transition selectHotbar(long currentTick, int zeroBasedHotbarSlot)
Resolves a zero-based vanilla hotbar selection while the F chord is open.
Link copied to clipboard
public long windowTicks()
How long this window stays open after it opened.