Skip to main content

Overview

The LiquidBounce Script API provides a comprehensive set of utilities, bindings, and helpers for creating powerful scripts. This reference documents all available APIs.

Global Bindings

These objects and functions are available globally in all scripts:

Core Functions

registerScript
function
required
Registers your script with LiquidBounce.
var script = registerScript({
    name: "MyScript",
    version: "1.0.0",
    authors: ["Developer"]
});
Source: PolyglotScript.kt:77 (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/PolyglotScript.kt:77)

Client API

Client
object
Main client API hub providing access to managers and utilities.
Client.moduleManager     // Access modules
Client.commandManager    // Access commands
Client.eventManager      // Access event system
Client.configSystem      // Access configuration
Client.scriptManager     // Access script manager
Client.combatManager     // Access combat utilities
Source: ScriptClient.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptClient.kt)
Client.displayChatMessage
function
Display a message in the client chat.
Client.displayChatMessage("§aHello World!");
Client.moduleManager
ModuleManager
Access and manage modules.
var killAura = Client.moduleManager.getModule("KillAura");
if (killAura) {
    killAura.enabled = true;
}

// Get all modules
var allModules = Client.moduleManager.getModules();
Client.commandManager
CommandManager
Access command system.
Client.commandManager.executeCommand(".help");
Client.eventManager
EventManager
Access the event system.
Client.eventManager.callEvent(someEvent);

Minecraft Instance

mc
Minecraft
Direct access to the Minecraft client instance.
var player = mc.player;           // Local player
var level = mc.level;             // Current world/level
var connection = mc.getConnection(); // Network connection

// Execute on main thread
mc.execute(function() {
    // Code runs on main thread
});
Source: ScriptContextProvider.kt:59 (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptContextProvider.kt:59)

Setting Builder

Setting
object
Create module settings/values.
settings: {
    speed: Setting.float({
        name: "Speed",
        default: 1.0,
        range: [0.1, 5.0],
        suffix: "x"
    }),
    enabled: Setting.boolean({
        name: "Enabled",
        default: true
    })
}
Available types:
  • Setting.boolean(config) - Boolean value
  • Setting.int(config) - Integer with range
  • Setting.float(config) - Float with range
  • Setting.intRange(config) - Integer range
  • Setting.floatRange(config) - Float range
  • Setting.text(config) - Text input
  • Setting.choose(config) - Single choice
  • Setting.multiChoose(config) - Multiple choices
  • Setting.key(config) - Key binding
Source: ScriptSetting.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/features/ScriptSetting.kt)

Utility APIs

These utility objects provide helper functions:

RotationUtil

RotationUtil
object
Rotation and aiming utilities.
// Create rotation to entity (center of bounding box)
var rotation = RotationUtil.newRotationEntity(entity);

// Create raytraced rotation (best spot)
var rotation = RotationUtil.newRaytracedRotationEntity(
    entity,
    4.2,    // range
    0.0     // through walls range
);

// Aim at rotation
RotationUtil.aimAtRotation(rotation, true); // true = fix velocity
Source: ScriptRotationUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptRotationUtil.kt)
RotationUtil.newRotationEntity
function
Creates a rotation targeting the center of an entity’s bounding box.Parameters:
  • entity: Entity - Target entity
Returns: Rotation - Rotation objectPerformance: Very fast (no raytracing)
RotationUtil.newRaytracedRotationEntity
function
Creates an optimal rotation using raytracing.Parameters:
  • entity: Entity - Target entity
  • range: number - Maximum range
  • throughWallsRange: number - Range through walls
Returns: Rotation | null - Best rotation or null if no valid spotPerformance: Slower (uses raytracing)
RotationUtil.aimAtRotation
function
Aims at a rotation using the rotation manager.Parameters:
  • rotation: Rotation - Target rotation
  • fixVelocity: boolean - Whether to apply movement correction

ItemUtil

ItemUtil
object
Item and inventory utilities.
// Check if item is a weapon
var isWeapon = ItemUtil.isWeapon(itemStack);

// Get item from hotbar
var slot = ItemUtil.findHotbarSlot(function(stack) {
    return stack.getItem() === Items.GOLDEN_APPLE;
});
Source: ScriptItemUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptItemUtil.kt)

NetworkUtil

NetworkUtil
object
Network packet utilities.
// Send packet to server
NetworkUtil.sendPacket(packet);

// Send packet silently (bypass client handlers)
NetworkUtil.sendPacketSilently(packet);
Source: ScriptNetworkUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptNetworkUtil.kt)

MovementUtil

MovementUtil
object
Player movement utilities.
// Get player speed
var speed = MovementUtil.getSpeed();

// Apply movement
MovementUtil.strafe(speed);
Source: ScriptMovementUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptMovementUtil.kt)

BlockUtil

BlockUtil
object
Block and world utilities.
// Get block at position
var block = BlockUtil.getBlock(blockPos);

// Check if block is solid
var isSolid = BlockUtil.isSolid(blockPos);
Source: ScriptBlockUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptBlockUtil.kt)

InteractionUtil

InteractionUtil
object
Player interaction utilities.
// Interact with entity
InteractionUtil.interactEntity(entity, hand);

// Attack entity
InteractionUtil.attackEntity(entity);
Source: ScriptInteractionUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptInteractionUtil.kt)

ReflectionUtil

ReflectionUtil
object
Java reflection utilities for advanced usage.
// Access private fields and methods
var field = ReflectionUtil.getField(object, "fieldName");
var method = ReflectionUtil.getMethod(object, "methodName");
Source: ScriptReflectionUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptReflectionUtil.kt)

Minecraft Classes

These Minecraft classes are available for direct use:
Vec3d
class
3D vector with doubles.
var vec = new Vec3d(x, y, z);
var length = vec.length();
var normalized = vec.normalize();
Vec3i
class
3D vector with integers.
var vec = new Vec3i(x, y, z);
BlockPos
class
Block position in the world.
var pos = new BlockPos(x, y, z);
var block = mc.level.getBlockState(pos).getBlock();
Hand
enum
Player hand enumeration.
var mainHand = Hand.MAIN_HAND;
var offHand = Hand.OFF_HAND;
MathHelper
class
Math utilities.
var clamped = MathHelper.clamp(value, min, max);
var wrapped = MathHelper.wrapDegrees(angle);

Advanced Features

Local Storage

localStorage
object
Persistent storage across script reloads (within same session).
// Store data
localStorage.myValue = 123;
localStorage.myArray = [1, 2, 3];

// Retrieve data
var value = localStorage.myValue;
localStorage is cleared when scripts are unloaded or client restarts.
Source: ScriptContextProvider.kt:38 (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptContextProvider.kt:38)

Async Utilities (JavaScript)

AsyncUtil
object
Async/Promise utilities for JavaScript.
// Schedule task on next tick
AsyncUtil.scheduleTask(function() {
    Client.displayChatMessage("Next tick!");
});

// Use with Promises
AsyncUtil.createPromise(function(resolve, reject) {
    // Async operation
    resolve(result);
});
Source: ScriptAsyncUtil.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptAsyncUtil.kt)

Thread Management

UnsafeThread
object
Thread creation utilities.
// Create background thread
UnsafeThread.run(function() {
    // Background task
    // Note: Cannot access Minecraft objects here!
});
Do not access Minecraft game objects from background threads. Use mc.execute() to run code on the main thread.
Source: ScriptUnsafeThread.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptUnsafeThread.kt)

Parameter Validation

ParameterValidator
object
Helpers for validating command parameters.
// Validate integer
var result = ParameterValidator.validateInt("123", 0, 100);
if (result.accept) {
    var value = result.value;
}
Source: ScriptParameterValidator.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptParameterValidator.kt)

Script Object Methods

The script object returned by registerScript() provides these methods:
script.registerModule
function
Register a custom module.
script.registerModule(config, callback);
See: Creating Modules
script.registerCommand
function
Register a custom command.
script.registerCommand(config);
See: Creating Commands
script.on
function
Register global script lifecycle events.
script.on("load", function() { });
script.on("enable", function() { });
script.on("disable", function() { });
Source: PolyglotScript.kt:286 (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/PolyglotScript.kt:286)

Type Support

Primitives

Primitives
object
Java primitive type helpers.
var intClass = Primitives.INT;
var boolClass = Primitives.BOOLEAN;
Source: ScriptPrimitives.kt (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptPrimitives.kt)

Best Practices

Always check types before operations:
if (mc.player !== null && mc.player !== undefined) {
    // Safe to use mc.player
}
Wrap API calls in try-catch:
try {
    var module = Client.moduleManager.getModule("MyModule");
    module.enabled = true;
} catch (e) {
    Client.displayChatMessage("§cError: " + e.message);
}
Cache frequently accessed values:
// Bad: Accesses mc.player every tick
module.on("playerTick", function() {
    if (mc.player.getHealth() < 10) { }
});

// Good: Caches player reference
module.on("playerTick", function() {
    var player = mc.player;
    if (!player) return;
    if (player.getHealth() < 10) { }
});
Always use mc.execute() for thread-safe operations:
UnsafeThread.run(function() {
    // Background processing
    var result = heavyComputation();
    
    // Access Minecraft on main thread
    mc.execute(function() {
        Client.displayChatMessage("Result: " + result);
    });
});

Complete API Example

var script = registerScript({
    name: "APIDemo",
    version: "1.0.0",
    authors: ["Developer"]
});

script.registerModule({
    name: "APIDemo",
    category: "Misc",
    settings: {
        range: Setting.float({
            name: "Range",
            default: 4.2,
            range: [1.0, 6.0]
        })
    }
}, function(module) {
    
    module.on("enable", function() {
        Client.displayChatMessage("§aAPI Demo enabled!");
        
        // Store in localStorage
        localStorage.demoEnabled = true;
    });
    
    module.on("playerTick", function() {
        var player = mc.player;
        if (!player) return;
        
        var level = mc.level;
        if (!level) return;
        
        // Get nearby entities
        var entities = level.getEntities();
        var range = module.settings.range.get();
        
        entities.forEach(function(entity) {
            if (entity === player) return;
            
            var distance = player.distanceTo(entity);
            if (distance <= range) {
                // Create rotation
                var rotation = RotationUtil.newRotationEntity(entity);
                
                // Aim at entity
                RotationUtil.aimAtRotation(rotation, true);
                
                // Update tag
                module.tag = entity.getName().getString();
            }
        });
    });
    
});

script.registerCommand({
    name: "apidemo",
    parameters: [
        { name: "action", required: true }
    ],
    onExecute: function(action) {
        if (action === "status") {
            var enabled = localStorage.demoEnabled || false;
            Client.displayChatMessage("§7Demo enabled: " + enabled);
        }
    }
});

Next Steps

Getting Started

Learn the basics of scripting

Creating Modules

Build custom modules

Working with Events

Handle game events

Creating Commands

Build custom commands

Build docs developers (and LLMs) love