Script bindings provide scripts with access to LiquidBounce’s functionality, Minecraft APIs, and utility functions. These bindings are automatically injected into the script context when a script is loaded.
Global Objects
Client
Main hub for accessing LiquidBounce subsystems.
Event system for registering and dispatching events
Configuration management system
Module registration and management
Command system management
Script loading and management
Combat utilities and target tracking
Example:
// Access module manager
const moduleManager = Client.moduleManager;
const killAura = moduleManager.getModule("KillAura");
// Execute commands
Client.commandManager.execute(".friend add Player123");
// Display chat message
Client.displayChatMessage("Hello from script!");
Direct access to the Minecraft client instance.
Example:
if (mc.player) {
const playerName = mc.player.getName().getString();
const health = mc.player.getHealth();
const position = mc.player.position();
}
localStorage
Persistent storage shared across all scripts.
const storage = localStorage;
localStorage
ConcurrentHashMap<String, Any>
Thread-safe map for storing data between scripts and sessions
Example:
// Store data
localStorage.put("myKey", { some: "data" });
// Retrieve data
const data = localStorage.get("myKey");
// Check existence
if (localStorage.containsKey("myKey")) {
// ...
}
Utility Classes
RotationUtil
Rotation calculations and aiming utilities.
const rotationUtil = RotationUtil;
Methods:
- Rotation calculations to entities/blocks
- Rotation smoothing
- Angle differences
- Look-at utilities
ItemUtil
Item and inventory utilities.
const itemUtil = ItemUtil;
Methods:
- Item type checking
- Inventory manipulation
- Item comparison
- Durability checks
NetworkUtil
Network packet utilities.
const networkUtil = NetworkUtil;
Methods:
- Send packets
- Receive packet data
- Connection utilities
InteractionUtil
World interaction utilities.
const interactionUtil = InteractionUtil;
Methods:
- Block interaction
- Entity interaction
- Raycasting
- Reach calculations
BlockUtil
Block-related utilities.
const blockUtil = BlockUtil;
Methods:
- Block searching
- Block state queries
- Block property checks
- Block breaking utilities
MovementUtil
Player movement utilities.
const movementUtil = MovementUtil;
Methods:
- Speed calculations
- Direction utilities
- Jump helpers
- Movement state checks
ReflectionUtil
Reflection and class introspection.
const reflectionUtil = ReflectionUtil;
Methods:
- Field access
- Method invocation
- Class inspection
ParameterValidator
Validation utilities for command parameters.
const validator = ParameterValidator;
Methods:
- Input validation
- Type checking
- Range validation
UnsafeThread
Thread creation for unsafe operations.
const unsafeThread = UnsafeThread;
Use with caution. Unsafe threads can cause race conditions and crashes if not properly synchronized.
Primitives
Primitive type utilities.
const primitives = Primitives;
Methods:
- Type conversions
- Boxing/unboxing
- Type checking
AsyncUtil (JavaScript only)
Asynchronous utilities for JavaScript scripts.
const asyncUtil = AsyncUtil;
Features:
- Promise support
- Async/await compatibility
- Tick scheduling
Example:
// Use async/await in scripts
const result = await AsyncUtil.runAsync(() => {
// Long-running operation
return someValue;
});
Minecraft API Classes
Direct access to Minecraft classes:
Vec3i
Integer 3D vector.
const pos = new Vec3i(x, y, z);
Vec3d
Double-precision 3D vector.
const position = new Vec3d(x, y, z);
BlockPos
Block position in the world.
const blockPos = new BlockPos(x, y, z);
const block = mc.level.getBlockState(blockPos);
MathHelper
Math utilities (Minecraft’s Mth class).
const clamped = MathHelper.clamp(value, min, max);
const cos = MathHelper.cos(angle);
const sin = MathHelper.sin(angle);
Hand
Hand enumeration for interactions.
const mainHand = Hand.MAIN_HAND;
const offHand = Hand.OFF_HAND;
RotationAxis
Rotation axis utilities.
const xAxis = RotationAxis.POSITIVE_X;
const yAxis = RotationAxis.POSITIVE_Y;
const zAxis = RotationAxis.POSITIVE_Z;
Script Registration Functions
registerScript()
Registers script metadata.
const script = registerScript({
name: "MyScript",
version: "1.0.0",
authors: ["Author1", "Author2"]
});
Script version (semantic versioning recommended)
authors
String | Array<String>
required
Script author(s)
The script instance for further configuration
registerModule()
Registers a custom module.
script.registerModule({
name: "CustomModule",
category: "Combat",
description: "My custom module",
settings: {
range: Setting.float({
name: "Range",
default: 4.0,
range: [1.0, 6.0]
})
}
}, module => {
module.on("enable", () => {
Client.displayChatMessage("Module enabled!");
});
module.on("disable", () => {
Client.displayChatMessage("Module disabled!");
});
});
registerCommand()
Registers a custom command.
script.registerCommand({
name: "test",
aliases: ["t"],
parameters: [
{
name: "message",
required: false
}
],
onExecute: (message) => {
Client.displayChatMessage(message || "No message provided");
}
});
registerMode()
Registers a custom mode for a mode value group.
const killAura = Client.moduleManager.getModule("KillAura");
const rotationMode = killAura.settings.rotationMode;
script.registerMode(rotationMode, {
name: "CustomRotation",
description: "Custom rotation mode"
}, mode => {
mode.on("enable", () => {
// Custom rotation logic
});
});
Setting Types
The Setting object provides various setting types:
Available types:
Setting.boolean() - Boolean toggle
Setting.int() - Integer value
Setting.float() - Float value
Setting.text() - Text input
Setting.choice() - Dropdown selection
Setting.color() - Color picker
Setting.block() - Block selector
Setting.item() - Item selector
Example:
settings: {
enabled: Setting.boolean({
name: "Enabled",
default: true
}),
range: Setting.float({
name: "Range",
default: 4.0,
range: [1.0, 6.0],
step: 0.1
}),
mode: Setting.choice({
name: "Mode",
default: "Single",
choices: ["Single", "Multi", "Switch"]
})
}
Event Handling
Scripts can listen to events using the on() method:
module.on("enable", () => {
// Called when module is enabled
});
module.on("disable", () => {
// Called when module is disabled
});
module.on("PlayerTickEvent", event => {
// Called every player tick
const player = mc.player;
});
module.on("PacketEvent", event => {
// Called on packet send/receive
const packet = event.packet;
});
Complete Example
// Register script metadata
const script = registerScript({
name: "ExampleScript",
version: "1.0.0",
authors: ["YourName"]
});
// Listen to global events
script.on("load", () => {
Client.displayChatMessage("Script loaded!");
});
script.on("enable", () => {
Client.displayChatMessage("Script enabled!");
});
// Register a module
script.registerModule({
name: "TestModule",
category: "Misc",
description: "A test module",
settings: {
message: Setting.text({
name: "Message",
default: "Hello World"
})
}
}, module => {
module.on("enable", () => {
const msg = module.settings.message.get();
Client.displayChatMessage(msg);
});
module.on("PlayerTickEvent", event => {
// Do something every tick
});
});
// Register a command
script.registerCommand({
name: "greet",
parameters: [
{
name: "name",
required: true
}
],
onExecute: (name) => {
Client.displayChatMessage("Hello, " + name + "!");
}
});
See Also