Skip to main content
The Options class manages all game settings including graphics, audio, controls, and gameplay options. It handles loading, saving, and applying configuration changes.

Constructor

Options(Minecraft *minecraft, File workingDirectory)
Options()
Creates a new Options instance.
minecraft
Minecraft*
The Minecraft instance (can be NULL for standalone options)
workingDirectory
File
Directory where options file is stored

Initialization

init

void init()
Initializes all options with default values. Called automatically by the constructor.

Audio Settings

music
float
Music volume (0.0 to 1.0)
sound
float
Sound effects volume (0.0 to 1.0)

Graphics Settings

viewDistance
int
Render distance:
  • 0 - Far
  • 1 - Normal
  • 2 - Short
  • 3 - Tiny
fancyGraphics
bool
Enable fancy graphics (leaves, water, etc.)
ambientOcclusion
bool
Enable smooth lighting/ambient occlusion:
  • true - Smooth lighting enabled
  • false - Smooth lighting disabled
renderClouds
bool
Enable cloud rendering
particles
int
Particle effects level:
  • 0 - All
  • 1 - Decreased
  • 2 - Minimal
anaglyph3d
bool
Enable 3D anaglyph mode (red/cyan glasses)
advancedOpengl
bool
Enable advanced OpenGL features (occlusion culling)
framerateLimit
int
Framerate limit:
  • 0 - Max
  • 1 - Balanced
  • 2 - Power Saver
guiScale
int
GUI scale:
  • 0 - Auto
  • 1 - Small
  • 2 - Normal
  • 3 - Large
fov
float
Field of view (0.0 to 1.0, mapped to degrees)
gamma
float
Brightness/gamma (0.0 to 1.0)

Control Settings

sensitivity
float
Mouse sensitivity (0.0 to 1.0)
invertYMouse
bool
Invert mouse Y-axis
bobView
bool
Enable view bobbing when walking

Key Mappings

keyUp
KeyMapping*
Move forward (default: W)
keyDown
KeyMapping*
Move backward (default: S)
keyLeft
KeyMapping*
Move left (default: A)
keyRight
KeyMapping*
Move right (default: D)
keyJump
KeyMapping*
Jump (default: Space)
keySneak
KeyMapping*
Sneak (default: Left Shift)
keyAttack
KeyMapping*
Attack/destroy (default: Left mouse button)
keyUse
KeyMapping*
Use/place block (default: Right mouse button)
keyBuild
KeyMapping*
Open inventory (default: E)
keyDrop
KeyMapping*
Drop item (default: Q)
keyChat
KeyMapping*
Open chat (default: T)
keyPlayerList
KeyMapping*
Show player list (default: Tab)
keyPickItem
KeyMapping*
Pick block (default: Middle mouse button)
keyToggleFog
KeyMapping*
Toggle fog (default: F)
keyMappings
KeyMapping*[14]
Array of all key mappings

Gameplay Settings

difficulty
int
Game difficulty:
  • 0 - Peaceful
  • 1 - Easy
  • 2 - Normal
  • 3 - Hard
thirdPersonView
bool
Third-person camera enabled
renderDebug
bool
Show debug overlay (F3)
hideGui
bool
Hide HUD/GUI

Advanced Settings

isFlying
bool
Creative mode flying enabled
smoothCamera
bool
Smooth camera movement
fixedCamera
bool
Fixed camera position (debug)
flySpeed
float
Creative mode flight speed
cameraSpeed
float
Camera movement speed (spectator)

Network Settings

lastMpIp
wstring
Last multiplayer server IP address

Skin Settings

skin
wstring
Selected player skin name

Methods

load

void load()
Loads options from the options file (options.txt).

save

void save()
Saves current options to the options file.

set

void set(const Options::Option *item, float value)
Sets an option to a specific value.
item
const Options::Option*
The option to set
value
float
The new value (0.0 to 1.0 for progress options)

toggle

void toggle(const Options::Option *option, int dir)
Toggles or cycles an option value.
option
const Options::Option*
The option to toggle
dir
int
Direction: 1 for forward, -1 for backward

getProgressValue

float getProgressValue(const Options::Option *item)
Gets the current value of a progress-based option (0.0 to 1.0).

getBooleanValue

bool getBooleanValue(const Options::Option *item)
Gets the current value of a boolean option.

getMessage

wstring getMessage(const Options::Option *item)
Gets the localized display message for an option’s current value.

getKeyDescription

wstring getKeyDescription(int i)
Gets the description for a key mapping.
i
int
Key mapping index (0-13)

getKeyMessage

wstring getKeyMessage(int i)
Gets the current key binding message for display.

setKey

void setKey(int i, int key)
Sets a key binding.
i
int
Key mapping index (0-13)
key
int
Key code

isCloudsOn

bool isCloudsOn()
Returns whether cloud rendering is enabled.

Option Constants

The Options::Option nested class defines available options:
static const Option *MUSIC;
static const Option *SOUND;
static const Option *INVERT_MOUSE;
static const Option *SENSITIVITY;
static const Option *RENDER_DISTANCE;
static const Option *VIEW_BOBBING;
static const Option *ANAGLYPH;
static const Option *ADVANCED_OPENGL;
static const Option *FRAMERATE_LIMIT;
static const Option *DIFFICULTY;
static const Option *GRAPHICS;
static const Option *AMBIENT_OCCLUSION;
static const Option *GUI_SCALE;
static const Option *FOV;
static const Option *GAMMA;
static const Option *RENDER_CLOUDS;
static const Option *PARTICLES;

Ambient Occlusion Constants

static const int AO_OFF = 0;  // No ambient occlusion
static const int AO_MIN = 1;  // Minimum ambient occlusion
static const int AO_MAX = 2;  // Maximum ambient occlusion

Example Usage

Creating and Loading Options

// Create options instance
Options *options = new Options(minecraft, workingDirectory);

// Load from file
options->load();

Modifying Graphics Settings

// Enable fancy graphics
options->fancyGraphics = true;

// Set render distance to far
options->viewDistance = 0;

// Enable ambient occlusion
options->ambientOcclusion = true;

// Reduce particles
options->particles = 2; // Minimal

// Save changes
options->save();

Adjusting Audio

// Set music volume to 50%
options->set(Options::Option::MUSIC, 0.5f);

// Set sound effects to 75%
options->set(Options::Option::SOUND, 0.75f);

options->save();

Configuring Controls

// Change forward key to Arrow Up
options->setKey(2, Keyboard::KEY_UP);

// Enable mouse inversion
options->invertYMouse = true;

// Increase sensitivity
options->sensitivity = 0.8f;

options->save();

Using Option Toggles

// Toggle graphics quality
options->toggle(Options::Option::GRAPHICS, 1);

// Cycle render distance
options->toggle(Options::Option::RENDER_DISTANCE, 1);

// Toggle view bobbing
options->toggle(Options::Option::VIEW_BOBBING, 1);

options->save();

Difficulty Management

// Set to peaceful
options->difficulty = 0;

// Set to hard
options->difficulty = 3;

options->save();

Reading Current Settings

// Check if clouds are enabled
if (options->isCloudsOn()) {
    // Render clouds
}

// Get FOV value
float fovValue = options->getProgressValue(Options::Option::FOV);

// Get formatted message for display
wstring fovMessage = options->getMessage(Options::Option::FOV);

File Format

Options are stored in options.txt as key-value pairs:
music:1.0
sound:1.0
invertYMouse:false
mouseSensitivity:0.5
fov:0.0
gamma:0.0
renderDistance:0
guiScale:0
particles:0
bobView:true
anaglyph3d:false
advancedOpengl:false
fpsLimit:2
difficulty:2
fancyGraphics:true
ao:true
renderClouds:true
skin:Default
lastServer:192.168.1.100
key_forward:17
key_left:30
key_back:31
key_right:32

Performance Considerations

Fancy graphics and high render distances significantly impact performance. For optimal framerates on lower-end hardware, use:
  • viewDistance = 2 or 3 (Short/Tiny)
  • fancyGraphics = false
  • particles = 2 (Minimal)
  • ambientOcclusion = false

Build docs developers (and LLMs) love