OptionsHelper
com.jsmacrosce.jsmacros.client.api.helper.OptionsHelper
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, video, music, control,
chat, and accessibility; each field and its corresponding getter return the same group object.
Setting changes are not necessarily saved to options.txt until 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
- ChatOptionsHelper
- ControlOptionsHelper
- MusicOptionsHelper
- SkinOptionsHelper
- VideoOptionsHelper
Constructors
new OptionsHelper
Fields
accessibility
Accessibility settings. Some settings are also exposed by other groups and operate on the same underlying option.
chat
Chat display and behavior settings.
control
Input settings and key bindings.
music
Sound volumes, audio device selection, and subtitles. Per-category volumes are available by category name or through individual methods.
skin
Player skin model-part visibility and main-hand settings.
video
Graphics and video settings.
Methods
getAccessibilityOptions
Returns: the accessibility options group.
getCameraMode
Returns:
0 for first person, 1 for third person from behind, or 2 for third person from the frontgetChatOptions
Returns: the chat options group.
getControlOptions
Returns: the control options group.
getDifficulty
getEnabledResourcePacks
getFov
Returns: the configured field-of-view value
getHeight
Returns: the window's screen height in pixels
getLanguage
getMusicOptions
Returns: the music options group.
getResourcePacks
getSkinOptions
Returns: the skin options group.
getSmoothCamera
Returns: whether smooth camera is enabled
getVideoOptions
Returns: the video options group.
getWidth
Returns: the window's screen width in pixels
isDifficultyLocked
Returns:
true if the current world's difficulty is lockedlockDifficulty
Sends a request to lock the world's difficulty.
Returns: this helper for chaining
removeServerResourcePack
Disables or allows server-provided resource packs. Reloads packs only when the disabled state changes.
Parameters:
state:trueto disable server-provided resource packs;falseto allow them
Returns: self for chaining
saveOptions
Returns: this helper for chaining.
sendSyncedOptions
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.
setCameraMode
Parameters:
mode:0for first person,1for third person from behind, or2for third person from the front
Returns: self for chaining
setDifficulty
Sets the singleplayer world's difficulty; multiplayer clients do not apply this change.
Parameters:
name:peaceful,easy,normal, orhard
Returns: self for chaining.
setEnabledResourcePacks
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
setFov
Parameters:
fov: the new field-of-view value
Returns: this helper for chaining
setHeight
Sets the window's screen height, preserving its current screen width.
Parameters:
h: the height in pixels
Returns: self for chaining
setLanguage
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
setSize
Sets the window's screen size.
Parameters:
w: the width in pixelsh: the height in pixels
Returns: self for chaining
setSmoothCamera
Sets whether smooth camera is enabled.
Parameters:
val:trueto enable smooth camera;falseto disable it
Returns: self for chaining
setWidth
Sets the window's screen width, preserving its current screen height.
Parameters:
w: the width in pixels
Returns: self for chaining
unlockDifficulty
Sends a request to unlock the world's difficulty; the server may reject it if the player lacks permission.
Returns: this helper for chaining