Introduction
LiquidBounce’s scripting system allows you to extend the client at runtime using various programming languages powered by GraalVM Polyglot. You can create custom modules, commands, and game logic without modifying the client’s source code.Supported Languages
LiquidBounce supports multiple scripting languages through GraalVM:- JavaScript (Recommended) - Full ECMAScript 2023 support with Nashorn compatibility
- Python - Via GraalPython
- Any other language supported by GraalVM
JavaScript is the most tested and recommended language for scripting. All examples in this documentation use JavaScript.
Script Directory
Scripts are loaded from thescripts/ directory in your LiquidBounce folder:
Project Structure
For complex scripts with multiple files, create a directory with amain.js (or main.py) file:
- Single file:
scripts/MyScript.js - Multi-file project:
scripts/MyProject/main.js
main file from directories.
Creating Your First Script
Create a file calledHelloWorld.js in your scripts directory:
HelloWorld.js
Script Registration
Every script must callregisterScript() with the following properties:
name(string) - The script’s display nameversion(string) - The script versionauthors(string or array) - Script author(s)
Loading Scripts
In-Game Commands
Use the following commands to manage scripts:Automatic Loading
All scripts in thescripts/ directory are automatically loaded when LiquidBounce starts.
Script Lifecycle
Scripts have several lifecycle hooks you can use:Accessing the Minecraft Client
Themc global variable provides direct access to the Minecraft client:
Using the Client API
TheClient object provides access to LiquidBounce’s features:
CommonJS Support (JavaScript)
JavaScript scripts support CommonJS modules:utils.js
main.js
Local Storage
Scripts can store data using thelocalStorage object:
Error Handling
Always wrap potentially failing code in try-catch blocks:Best Practices
- Always check for null -
mc.playerandmc.levelcan be null when not in-game - Use descriptive names - Name your scripts, modules, and variables clearly
- Handle errors gracefully - Use try-catch to prevent script crashes
- Clean up resources - Use the
disablehook to clean up event handlers - Test thoroughly - Test scripts in different scenarios before sharing
Next Steps
- API Reference - Explore the full Script API
- Custom Modules - Create custom modules
- Custom Commands - Create custom commands
- Examples - See working script examples