Skip to content

Keybinds

getKeycode

Returns the keycode for the specified Minecraft keybind name.

java
int code = keybinds.getKeycode(String key);

getMousePosition

Returns the current mouse position in pixels as [x, y].

java
int[] position = keybinds.getMousePosition();

isKeyDown

Returns true if the specified keycode is held.

java
boolean keyDown = keybinds.isKeyDown(int key);

isMouseDown

Returns true if the specified mouse button is pressed. Use 0 for left, 1 for right, and 2 for middle click.

java
boolean mouseDown = keybinds.isMouseDown(int button);

isPressed

Returns true if the named keybind is currently pressed.

java
boolean pressed = keybinds.isPressed(String key);

leftClick

Simulates a left mouse click.

java
keybinds.leftClick();

rightClick

Simulates a right mouse click.

java
keybinds.rightClick();

setPressed

Sets the pressed state of a keybind as defined in options.txt.

java
keybinds.setPressed(String key, boolean pressed);