# OptionsHelper

`com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper`

**Since:** 1.8.4

Provides access to the client's game settings.  
 
 Wraps the supplied options object; changes made through this helper affect that object.  
 
 Settings are grouped in [skin](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_skin), [video](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_video), [music](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_music), [control](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_control),  
 [chat](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_chat), and [accessibility](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_accessibility); each field and its corresponding getter return
 the same group object.  
 
 Setting changes are not necessarily saved to `options.txt` until [saveOptions()](#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_saveOptions-)
 is called; some methods save as part of their own behavior.  
 ```js
const options = Client.getGameOptions();  
options.video.setRenderDistance(12);  
options.saveOptions();  
 ```

## Nested types

- [AccessibilityOptionsHelper](OptionsHelper.AccessibilityOptionsHelper.md)
- [ChatOptionsHelper](OptionsHelper.ChatOptionsHelper.md)
- [ControlOptionsHelper](OptionsHelper.ControlOptionsHelper.md)
- [MusicOptionsHelper](OptionsHelper.MusicOptionsHelper.md)
- [SkinOptionsHelper](OptionsHelper.SkinOptionsHelper.md)
- [VideoOptionsHelper](OptionsHelper.VideoOptionsHelper.md)

## Constructors

### new OptionsHelper {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_constructor-Options-}

```js
new OptionsHelper(Options options)
```

Wraps the supplied game options object, retaining its reference.

**Parameters:**
- `options`: game options to wrap

## Fields

### accessibility {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_accessibility}

```js
accessibility: OptionsHelper.AccessibilityOptionsHelper
```

Accessibility settings. Some settings are also exposed by other groups and operate on the same
 underlying option.

**Since:** 1.8.4

### chat {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_chat}

```js
chat: OptionsHelper.ChatOptionsHelper
```

Chat display and behavior settings.

**Since:** 1.8.4

### control {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_control}

```js
control: OptionsHelper.ControlOptionsHelper
```

Input settings and key bindings.

**Since:** 1.8.4

### music {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_music}

```js
music: OptionsHelper.MusicOptionsHelper
```

Sound volumes, audio device selection, and subtitles. Per-category volumes are available by
 category name or through individual methods.

**Since:** 1.8.4

### skin {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_skin}

```js
skin: OptionsHelper.SkinOptionsHelper
```

Player skin model-part visibility and main-hand settings.

**Since:** 1.8.4

### video {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_video}

```js
video: OptionsHelper.VideoOptionsHelper
```

Graphics and video settings.

**Since:** 1.8.4

## Methods

### getAccessibilityOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getAccessibilityOptions-}

```js
getAccessibilityOptions(): OptionsHelper.AccessibilityOptionsHelper
```

**Returns:** the accessibility options group.

**Since:** 1.8.4

### getCameraMode {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getCameraMode-}

```js
getCameraMode(): int
```

**Returns:** `0` for first person, `1` for third person from behind, or `2` for third person from the front

**Since:** 1.5.0

### getChatOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getChatOptions-}

```js
getChatOptions(): OptionsHelper.ChatOptionsHelper
```

**Returns:** the chat options group.

**Since:** 1.8.4

### getControlOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getControlOptions-}

```js
getControlOptions(): OptionsHelper.ControlOptionsHelper
```

**Returns:** the control options group.

**Since:** 1.8.4

### getDifficulty {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getDifficulty-}

```js
getDifficulty(): String
```

**Returns:** the active difficulty's name: `peaceful`, `easy`, `normal`, or `hard`.

**Since:** 1.8.4

### getEnabledResourcePacks {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getEnabledResourcePacks-}

```js
getEnabledResourcePacks(): List<String>
```

**Returns:** the selected resource-pack IDs.

**Since:** 1.2.0

### getFov {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getFov-}

```js
getFov(): int
```

**Returns:** the configured field-of-view value

**Since:** 1.1.7

### getHeight {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getHeight-}

```js
getHeight(): int
```

**Returns:** the window's screen height in pixels

**Since:** 1.2.6

### getLanguage {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getLanguage-}

```js
getLanguage(): String
```

**Returns:** the configured language code.

**Since:** 1.8.4

### getMusicOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getMusicOptions-}

```js
getMusicOptions(): OptionsHelper.MusicOptionsHelper
```

**Returns:** the music options group.

**Since:** 1.8.4

### getResourcePacks {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getResourcePacks-}

```js
getResourcePacks(): List<String>
```

**Returns:** the available resource-pack IDs.

**Since:** 1.1.7

### getSkinOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getSkinOptions-}

```js
getSkinOptions(): OptionsHelper.SkinOptionsHelper
```

**Returns:** the skin options group.

**Since:** 1.8.4

### getSmoothCamera {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getSmoothCamera-}

```js
getSmoothCamera(): boolean
```

**Returns:** whether smooth camera is enabled

**Since:** 1.5.0

### getVideoOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getVideoOptions-}

```js
getVideoOptions(): OptionsHelper.VideoOptionsHelper
```

**Returns:** the video options group.

**Since:** 1.8.4

### getWidth {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_getWidth-}

```js
getWidth(): int
```

**Returns:** the window's screen width in pixels

**Since:** 1.2.6

### isDifficultyLocked {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_isDifficultyLocked-}

```js
isDifficultyLocked(): boolean
```

**Returns:** `true` if the current world's difficulty is locked

**Since:** 1.8.4

### lockDifficulty {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_lockDifficulty-}

```js
lockDifficulty(): OptionsHelper
```

Sends a request to lock the world's difficulty.

**Returns:** this helper for chaining

**Since:** 1.8.4

### removeServerResourcePack {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_removeServerResourcePack-boolean-}

```js
removeServerResourcePack(boolean state): OptionsHelper
```

Disables or allows server-provided resource packs. Reloads packs only when the disabled state changes.

**Parameters:**
- `state`: `true` to disable server-provided resource packs; `false` to allow them

**Returns:** self for chaining

**Since:** 1.8.3

### saveOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_saveOptions-}

```js
saveOptions(): OptionsHelper
```

**Returns:** this helper for chaining.

**Since:** 1.8.4

### sendSyncedOptions {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_sendSyncedOptions-}

```js
sendSyncedOptions(): void
```

Sends the current synchronized options to the server. Setting changes do not
 automatically call this method; call it manually when those changes need to be
 broadcast.

**Since:** 2.1.0

### setCameraMode {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setCameraMode-int-}

```js
setCameraMode(int mode): OptionsHelper
```

**Parameters:**
- `mode`: `0` for first person, `1` for third person from behind, or `2` for third person from the front

**Returns:** self for chaining

**Since:** 1.5.0

### setDifficulty {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setDifficulty-String-}

```js
setDifficulty(String name): OptionsHelper
```

Sets the singleplayer world's difficulty; multiplayer clients do not apply this change.

**Parameters:**
- `name`: `peaceful`, `easy`, `normal`, or `hard`

**Returns:** self for chaining.

**Since:** 1.8.4

### setEnabledResourcePacks {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setEnabledResourcePacks-String[]-}

```js
setEnabledResourcePacks(String[] enabled): OptionsHelper
```

Selects resource packs, saves the options, and reloads packs if the saved selection changes.

**Parameters:**
- `enabled`: resource-pack IDs to select; duplicate IDs are ignored

**Returns:** this helper for chaining

**Since:** 1.2.0

### setFov {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setFov-int-}

```js
setFov(int fov): OptionsHelper
```

**Parameters:**
- `fov`: the new field-of-view value

**Returns:** this helper for chaining

**Since:** 1.1.7

### setHeight {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setHeight-int-}

```js
setHeight(int h): OptionsHelper
```

Sets the window's screen height, preserving its current screen width.

**Parameters:**
- `h`: the height in pixels

**Returns:** self for chaining

**Since:** 1.2.6

### setLanguage {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setLanguage-String-}

```js
setLanguage(String languageCode): OptionsHelper
```

Selects the language if its code is recognized, then always reloads resource packs and saves options.

**Parameters:**
- `languageCode`: language code to select

**Returns:** this helper for chaining

**Since:** 1.8.4

### setSize {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setSize-int-int-}

```js
setSize(int w, int h): OptionsHelper
```

Sets the window's screen size.

**Parameters:**
- `w`: the width in pixels
- `h`: the height in pixels

**Returns:** self for chaining

**Since:** 1.2.6

### setSmoothCamera {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setSmoothCamera-boolean-}

```js
setSmoothCamera(boolean val): OptionsHelper
```

Sets whether smooth camera is enabled.

**Parameters:**
- `val`: `true` to enable smooth camera; `false` to disable it

**Returns:** self for chaining

**Since:** 1.5.0

### setWidth {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_setWidth-int-}

```js
setWidth(int w): OptionsHelper
```

Sets the window's screen width, preserving its current screen height.

**Parameters:**
- `w`: the width in pixels

**Returns:** self for chaining

**Since:** 1.2.6

### unlockDifficulty {#com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper_unlockDifficulty-}

```js
unlockDifficulty(): OptionsHelper
```

Sends a request to unlock the world's difficulty; the server may reject it if the player lacks permission.

**Returns:** this helper for chaining

**Since:** 1.8.4
