Getting Started
DeathClient supports JavaScript plugins executed directly via the built-in browser engine. Plugins interact with the Java client using the global window.DeathClient or dc object.
VS Code IDE Editor: You can edit your scripts directly in-game! Open the JS Plugins menu and click Edit Code to open our built-in VS Code-style IDE. It features full syntax highlighting, Light/Dark themes, file renaming, and direct downloading. Press Ctrl+S to save and hot-reload your code instantly!
// Example Plugin: AutoGG
const dc = window.DeathClient;
dc.createMod({
name: "AutoGG",
description: "Says GG after a match.",
category: "CHAT",
isCheat: false,
settings: [],
onUpdate: function() {
// Logic goes here
}
});
Mod Registration
Register a module using dc.createMod(config). The config object accepts the following fields:
| Property | Type | Description |
|---|---|---|
name | String | Required. The exact name of the module. |
description | String | A short description shown in the click GUI. |
category | String | MOVEMENT, COMBAT, RENDER, WORLD, HUD, PLAYER. Defaults to PLAYER. |
isCheat | Boolean | Marks the module as a cheat (can be hidden on strict servers). |
settings | Array | Array of setting objects created via dc.createSetting(). |
Settings API
Settings allow users to configure your script via the ClickGUI. Create them easily using the new dc.createSetting() helper function and pass them into your mod's settings array.
Toggle (Boolean) Setting
dc.createSetting("Toggle", "Spam Mode", true)
Slider (Number) Setting
// (Type, Name, DefaultValue, MinValue, MaxValue)
dc.createSetting("Slider", "Delay", 50, 0, 1000)
Mode (Dropdown) Setting
// (Type, Name, DefaultValue, ArrayOfModes)
dc.createSetting("Mode", "Style", "Normal", ["Normal", "Aggressive", "Passive"])
String (Text) Setting NEW
// (Type, Name, DefaultValue)
dc.createSetting("String", "Message", "Hello World!")
To read settings dynamically during callbacks, use the injected settingsCache object:
onUpdate: function(settings) {
if (settings["Spam Mode"] && settings["Spam Mode"].value) {
let delay = settings["Delay"].value;
let message = settings["Message"].value;
// Do something
}
}
Commands API NEW in v1.3.1
You can now register custom chat commands that intercept player chat natively, preventing "Unknown Command" errors on the server!
dc.createCommand({
command: "panic",
prefix: ".", // User types: .panic
description: "Emergency disable all mods",
execute: function(args) {
dc.chat("\u00a7cPANIC INITIATED!");
// args contains any text typed after the command
}
});
Mod Callbacks
Assign functions to your module object to hook into game loops. Callbacks are automatically passed your mod's current settingsCache.
onEnable(settings) | Called when the module is toggled on. |
onDisable(settings) | Called when the module is toggled off. |
onUpdate(settings) | Called every client tick (usually 20 times per second). |
onRender2D(settings) | Called every frame. Useful for drawing custom HUD elements. |
onChat(message) | Called when an incoming chat message is received from the server. |
HUD Mods (Draggable & Resizable)
If you want your plugin to render visual elements on the screen that users can drag around and resize in the HUD Editor, you must use dc.createHudMod(config) instead of the standard createMod function.
HUD Mods require two extra properties: width and height. These tell the GUI Editor how big the green bounding box should be when the user is dragging your mod. Inside your onRender2D event, you must use this.x and this.y to draw your elements, as these values update in real-time when the user moves your mod.
const dc = window.DeathClient;
dc.createHudMod({
name: "Watermark",
description: "Displays a custom client watermark",
category: "HUD",
// REQUIRED: Defines the size of the green drag-box in the HUD Editor
width: 80,
height: 12,
onRender2D: function() {
// this.x, this.y, and this.scale are automatically updated by the Java backend!
// You must use them as your X and Y coordinates when drawing.
let text = "DeathClient JS";
// Example: Assuming you have a dc.drawString method mapped in your JSBridge
dc.drawString(text, this.x, this.y, 0xFFFFFF, true);
}
});
Reactive Variables Available in HUD Mods:
| Variable | Description |
|---|---|
this.x |
The current absolute X position of the mod on the screen. |
this.y |
The current absolute Y position of the mod on the screen. |
this.scale |
The current size multiplier (modified by scroll wheel in the HUD editor). Use this if you are doing custom OpenGL scaling in your JS. |
Bridge API (dc.*)
The dc global object provides methods to interact with the game state.
Chat & Commands
dc.chat(msg) | Prints a localized message to the user's chat box (not sent to server). |
dc.sendChat(msg) | Sends a message to the server, visible to other players. |
dc.sendCommand(cmd) | Executes a slash command. Automatically adds '/' if missing. |
Mod Control & Queries
dc.enableMod(name) | Force enables a module. |
dc.disableMod(name) | Force disables a module. |
dc.toggleMod(name) | Toggles a module's state. |
dc.isEnabled(name) | Returns true if the specified JS mod is currently active. |
dc.getMods() | Returns an array of strings containing all registered JS mod names. |
dc.getAllMods() | Returns an array of objects representing EVERY mod in the client (Java + JS). Example: [{name: "Flight", enabled: true}] |
Visuals & Audio
dc.playSound(name, vol, pitch) | Plays a client-side sound (e.g., "random.orb", 1.0, 1.0). |
dc.showTitle(title, subtitle) | Displays big text in the center of the screen. Subtitle is optional. |
Game State & Mutation NEW
You can now directly read and modify the player and world state natively! Property mutations are pushed to the Java engine automatically through a Two-Way Queue System.
Player API (dc.player)
Directly access and mutate the local player entity.
| Mutable Properties | x, y, z, motionX, motionY, motionZ, yaw, pitch |
| Read-Only Properties | name, health, maxHealth, onGround |
| Methods | jump() |
// Teleport the player up by 6 blocks
dc.player.y += 6;
// Freeze player in the air (Flight/Hover)
dc.player.motionY = 0;
// Spinbot example
dc.player.yaw += 45;
// Jump check
if (dc.player.onGround) {
dc.player.jump();
}
World API (dc.world)
Access and manipulate the current dimension and world state.
| Mutable Properties | time |
| Read-Only Properties | raining |
// Make it permanent daytime
dc.world.time = 6000;
Event System
Instead of tying logic to a specific mod, you can listen to global events using dc.on(eventName, callback).
Available Events
tick | Fires every client tick. Payload contains the player state JSON. |
chat_receive | Fires when a chat message is received from the server. Payload contains message. |
mod_enable | Fires when any module is toggled on. Payload contains name. |
mod_disable | Fires when any module is toggled off. Payload contains name. |
Data Persistence
Plugins can save and load data (like configs or stats) across client restarts using the built-in LocalStorage bridge.
dc.saveFile(key, val) | Saves a string value under the given key. |
dc.loadFile(key) | Returns the saved string, or null if it doesn't exist. |
dc.deleteFile(key) | Deletes the stored key. |
dc.listFiles(prefix) | Returns an array of saved keys that start with the prefix. |
DeathClient v1.3.1 · Plugin API documentation · EaglerCraft 1.8