Skip to content

TheDarkSword/DarkClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

131 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ DarkClient - Minecraft Injection Client

Rust Minecraft License Platform

A Minecraft hacked client built in Rust, using JNI (Java Native Interface) for seamless integration with Minecraft's Java runtime. DarkClient provides a robust architecture for developing game modifications through dynamic library injection.

Supported Minecraft Versions

  • Obfuscated builds (โ‰ค 1.21.11): bundled Mojmap mappings (mappings.json, currently 1.21.10).
  • Unobfuscated builds (26.1+): no mappings needed โ€” names are resolved directly, method signatures via runtime JNI reflection. Latest tested: 26.1.2.

The build auto-detects which mode to use at runtime. A single binary works on both.

Supported Mod Loaders

DarkClient runs on vanilla Minecraft, Fabric, and Forge/NeoForge. It auto-discovers the game's class loader (KnotClassLoader for Fabric, TransformingClassLoader for Forge/NeoForge), so injection is loader-agnostic.

Note

Fabric and Forge/NeoForge support requires an unobfuscated build (26.1+). Obfuscated Minecraft under a mod loader (intermediary/SRG names) is not supported.

๐Ÿ–ผ๏ธ Preview

DarkClient GUI

๐Ÿš€ Features

  • ๐Ÿ”ง Dynamic Library Injection: Hot-swappable module system without requiring game restarts
  • ๐ŸŽจ Cross-Platform GUI: Beautiful injector interface built with egui
  • ๐Ÿ–ฅ๏ธ In-Game ClickGUI: egui overlay with draggable category panels, per-module settings, scrollable lists and rebindable keys
  • โŒจ๏ธ Real-time Input Handling: Advanced keyboard/mouse event processing for module toggling
  • ๐Ÿ—บ๏ธ Smart Mapping System: Automatic obfuscation handling โ€” bundled mappings for obfuscated builds, runtime JNI reflection for unobfuscated ones
  • ๐Ÿ“ก Packet Layer: Netty-pipeline interception (pure JNI, no JVMTI) for packet-level modules โ€” powers NoFall and Velocity / Anti-Knockback
  • ๐Ÿ”„ Module Architecture: Extensible module system for easy feature development
  • ๐Ÿ’พ Persistent Config: keybinds, settings, enabled modules and GUI layout saved across injections
  • ๐Ÿงฉ Mod Loader Support: Works with vanilla Minecraft, Fabric, and Forge/NeoForge
  • ๐Ÿ“Š Comprehensive Logging: Detailed logging system for debugging and monitoring
  • ๐Ÿ”’ Thread-Safe Design: Robust multi-threaded architecture with proper synchronization

๐Ÿ—๏ธ Architecture

A Cargo workspace of five crates plus an xtask helper:

Protocol (protocol/)

The shared contract between the injector and the agent: the localhost socket address and the typed command set, defined once so the two ends cannot drift apart.

Injector (injector/)

The injection tool โ€” a redesigned egui GUI, a --tui terminal mode and --list / --inject <pid> headless modes โ€” that handles:

  • Process detection (finding Minecraft instances)
  • Library injection into target processes (per-platform, behind a trait)
  • Status monitoring and error reporting

Agent Loader (agent_loader/)

A cdylib injected into the JVM. On load it provides:

  • Dynamic library loading and hot-reloading of the client
  • A TCP command server
  • A JVM health monitor and clean process lifecycle handling

Client Library (client/)

The core modification framework featuring:

  • JNI integration with Minecraft's runtime
  • Module system for game modifications (combat, movement, render)
  • Mapping system for obfuscation handling
  • An in-game ClickGUI overlay, input processing and event management
  • A packet layer (net/) that injects a handler into Minecraft's Netty pipeline
  • Persistent configuration of keybinds, settings and GUI layout

Mapping Derive (mapping_derive/)

A proc-macro crate providing #[derive(MappedObject)] for the JVM-object wrappers in the client โ€” generates the JNI helper methods so each game wrapper stays a thin, safe handle.

๐Ÿ“‹ Prerequisites

  • Rust 1.95.0+ with Cargo package manager
  • Java Development Kit (JDK) 21+
  • Minecraft Java Edition

โฌ‡๏ธ Download

If you prefer precompiled binaries instead of building from source:

  1. Go to the Actions tab on GitHub.
  2. Open the latest workflow run.
  3. Scroll to the bottom of the page to find the Artifacts section.
  4. Download the compiled binaries for your platform (Linux or Windows).

This allows you to get up and running without waiting for compilation.

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

bash git clone https://github.com/TheDarkSword/DarkClient
cd darkclient

2. Build the Project

cargo build --release

3. Prepare Mappings

The framework uses obfuscation mappings to interact with Minecraft:

Convert Mojang mappings using the included Python script

python conversion.py

Place the resulting mappings.json in the project root

๐ŸŽฎ Usage

Quick Start

  1. Launch the Injector:
    cd target/release
    ./injector

Warning

libagent_loader and libclient must be in the same directory where you run the injector.

  1. Start Minecraft โ€” you can inject from the main menu; modules stay idle until you load a world

  2. In the Injector GUI:

  • Click "Scan" to detect the Minecraft process
  • Select it and click "Inject" to load the modification framework
  1. Use Modules:
  • Modules can be toggled using their assigned keybinds
  • Check the log files for module status and debugging info

Module Development

Create new modules by implementing the Module trait:

use crate::module::{Module, ModuleData};

pub struct CustomModule {
   data: ModuleData,
   // Your module-specific fields
}

impl Module for CustomModule {
   fn get_module_data(&self) -> &ModuleData {
      &self.data
   }

   fn get_module_data_mut(&mut self) -> &mut ModuleData {
      &mut self.data
   }

   fn on_start(&self) -> anyhow::Result<()> {
      // Called when the module is enabled.
      Ok(())
   }

   fn on_stop(&self) -> anyhow::Result<()> {
      // Called when the module is disabled.
      Ok(())
   }

   fn on_tick(&self) -> anyhow::Result<()> {
      // Called every game tick while enabled.
      Ok(())
   }
}

Register it in register_modules() in client/src/lib.rs. Modules that need to read or rewrite network packets can also implement the optional handle_packet method โ€” see NoFall and Velocity for examples.

DarkClient/
โ”œโ”€โ”€ ๐Ÿ“ protocol/             # Shared injector โ‡† agent IPC contract
โ”œโ”€โ”€ ๐Ÿ“ injector/             # Injection tool (GUI / TUI / headless CLI)
โ”œโ”€โ”€ ๐Ÿ“ agent_loader/         # Injected cdylib: command server + client lifecycle
โ”œโ”€โ”€ ๐Ÿ“ client/               # Core modification framework
โ”‚   โ””โ”€โ”€ ๐Ÿ“ src/
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ lib.rs        # Entry points (initialize_client / cleanup_client)
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ state.rs      # Global client + mapping state
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ config.rs     # Persistent config (keybinds, settings, GUI layout)
โ”‚       โ”œโ”€โ”€ ๐Ÿ“ mapping/      # Minecraft mapping system (obfuscated + reflected)
โ”‚       โ”œโ”€โ”€ ๐Ÿ“ graphic/      # Overlay, hooks, input, platform seam
โ”‚       โ”œโ”€โ”€ ๐Ÿ“ module/       # Module framework + registry
โ”‚       โ””โ”€โ”€ ๐Ÿ“ net/          # Netty packet layer (packet structs + dispatch)
โ”œโ”€โ”€ ๐Ÿ“ mapping_derive/       # proc-macro: #[derive(MappedObject)]
โ”œโ”€โ”€ ๐Ÿ“ xtask/                # Workspace task runner (cargo xtask e2e)
โ”œโ”€โ”€ ๐Ÿ“„ mappings.json         # Minecraft obfuscation mappings
โ”œโ”€โ”€ ๐Ÿ“„ conversion.py         # Mapping conversion utility
โ””โ”€โ”€ ๐Ÿ“„ Cargo.toml            # Workspace configuration

๐Ÿ”ง Configuration

Files

DarkClient writes nothing into .minecraft โ€” all of its files live in the directory the injector is started from:

  • app.log โ€” injector log
  • agent_loader.log โ€” agent loader log
  • dark_client.log โ€” client log
  • dark_client_config.json โ€” persisted keybinds, settings, enabled modules and GUI layout

Network Settings

The injector and agent communicate over TCP 127.0.0.1:7878, defined once in the protocol crate:

// protocol/src/lib.rs
pub const SOCKET_ADDR: SocketAddr = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 7878);

๐Ÿฉน Patched Dependencies

DarkClient vendors a patched copy of ilhook (the inline-hook crate behind the frame hook) under vendor/ilhook, wired in through [patch.crates-io]. Upstream ilhook 2.3.0 has a Linux bug: its hook trampoline is a heap allocation that can straddle a page boundary, yet only one page is marked executable โ€” so roughly one inject in four ended in a SIGSEGV in native code.

๐Ÿ“„ Full write-up โ€” causes, crash-log evidence and the fix: docs/vendored-ilhook-fix.md

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-module)
  3. Commit your changes (git commit -am 'Add amazing module')
  4. Push to the branch (git push origin feature/amazing-module)
  5. Create a Pull Request

Development Guidelines

  • Follow Rust best practices and use cargo fmt
  • Add comprehensive documentation for new modules
  • Include proper error handling and logging

โš ๏ธ Legal Notice

This project is intended for educational and research purposes. Users are responsible for complying with:

  • Minecraft's Terms of Service
  • Mojang's Commercial Usage Guidelines
  • Local laws and regulations regarding game modifications

๐Ÿ“„ License

This project is licensed under the GNU GPL License - see the LICENSE file for details.

About

Minecraft Injection Client built with Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors