> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/newgen/api/net/minecraft/client/keymapping.md).

# KeyMapping

A vanilla control, like jump or attack. Each one is a single object, so == works.

### Properties

#### category

> `readonly` **category**: `string`

The id of the controls category, e.g. "key.categories.movement".

***

#### defaultKeyCode

> `readonly` **defaultKeyCode**: `number`

The GLFW code of the key this control is bound to by default.

***

#### isDefault

> `readonly` **isDefault**: `boolean`

Whether the binding is the default one.

***

#### isMouse

> `readonly` **isMouse**: `boolean`

Whether the bound input is a mouse button.

***

#### isUnbound

> `readonly` **isUnbound**: `boolean`

Whether no key is bound.

***

#### keyCode

> `readonly` **keyCode**: `number`

The GLFW code of the bound key or mouse button, or -1 when unbound.

***

#### keyName

> `readonly` **keyName**: `string`

The name of the bound key, e.g. "key.keyboard.w".

***

#### name

> `readonly` **name**: `string`

The translation key, e.g. "key.jump".

***

#### translatedKeyName

> `readonly` **translatedKeyName**: `string`

The bound key as shown in the controls screen, e.g. "W".

### Methods

#### click()

> **click**(): `void`

Queues one press, as if the key was tapped. Read it with consumeClick.

**Returns**

`void`

***

#### consumeClick()

> **consumeClick**(): `boolean`

Takes one queued press, the way vanilla reads it. True if there was one.

**Returns**

`boolean`

***

#### isDown()

> **isDown**(): `boolean`

Whether the control is held.

**Returns**

`boolean`

***

#### sameKeyAs()

> **sameKeyAs**(`other`): `boolean`

Whether another control is bound to the same key.

**Parameters**

**other**

`KeyMapping`

The other control.

**Returns**

`boolean`

***

#### setDown()

> **setDown**(`down`): `void`

Holds or releases the control until the next real key event.

**Parameters**

**down**

`boolean`

Whether it is held.

**Returns**

`void`

***

#### setKeyCode()

> **setKeyCode**(`code`): `void`

Rebinds the control to a keyboard key and saves the options.

**Parameters**

**code**

`number`

The GLFW key code, or -1 to unbind.

**Returns**

`void`

**Remarks**

Does not touch mouse buttons.
