# margele/openzen architecture

> Architecture diagram of the GitHub repository margele/openzen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/margele/openzen
- Repository: https://github.com/margele/openzen

## Overview

Open Zen is a reconstructed Minecraft 1.20.1 Forge client delivered as either a Java Agent JAR or a Windows hot injector. The principal workflow is launch/injection, bytecode patch registration, client initialization, then event-driven modules that alter gameplay and expose configurable UI, commands, HUD, and WebUI features. The sampled sources support the Java initialization and manager relationships; delivery options and broader capabilities are documented in the README. Native internals and several feature implementations were not sampled, so their internal links are omitted.

Main entry points: [`src/main/java/shit/zen/ZenClient.java`](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/ZenClient.java) (Zen client), [`src/main/java/shit/zen/event/EventBus.java`](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/event/EventBus.java) (Event bus), [`src/main/java/shit/zen/manager/ModuleManager.java`](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/ModuleManager.java) (Module manager), [`src/main/java/shit/zen/network/webui`](https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/network/webui) (WebUI handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Launch and injection"]
  node_java_agent["Java Agent<br/>[PatchAgent.java]"]
  node_native_loader["Hot injector"]
  node_native_dll["Injected DLL"]
end

subgraph group_runtime["Client runtime"]
  node_patch_registry["Patch registry<br/>[PatchRegistry.java]"]
  node_game_patches["Game patches"]
  node_client["Zen client<br/>[ZenClient.java]"]
  node_event_bus["Event bus<br/>[EventBus.java]"]
end

subgraph group_features["Gameplay features"]
  node_module_manager["Module manager<br/>[ModuleManager.java]"]
  node_gameplay["Gameplay modules"]
  node_settings["Module settings"]
end

subgraph group_interaction["User interaction"]
  node_commands["Commands"]
  node_hud["HUD manager<br/>[HudManager.java]"]
  node_gui["Click GUIs"]
  node_config["Configuration<br/>[ConfigManager.java]"]
  node_webui["WebUI handlers"]
end

node_user(("User"))
node_minecraft["Minecraft JVM"]

node_user -->|"launches with"| node_java_agent
node_user -->|"starts"| node_native_loader
node_native_loader -.->|"hot injects"| node_native_dll
node_java_agent -->|"attaches to"| node_minecraft
node_native_dll -->|"injects into"| node_minecraft
node_minecraft -.->|"loads agent"| node_patch_registry
node_client -->|"registers patches"| node_patch_registry
node_patch_registry -.->|"transforms classes"| node_game_patches
node_client -->|"initializes"| node_event_bus
node_client -->|"creates"| node_module_manager
node_client -->|"creates"| node_hud
node_client -->|"creates"| node_commands
node_client -->|"creates"| node_config
node_module_manager -->|"registers modules"| node_gameplay
node_module_manager -->|"subscribes to"| node_event_bus
node_gameplay -->|"exposes settings"| node_settings
node_hud -->|"handles render events"| node_event_bus
node_commands -->|"handles chat events"| node_event_bus
node_user -.->|"configures client"| node_gui
node_user -.->|"controls remotely"| node_webui
node_webui -->|"changes modules"| node_gameplay
node_webui -->|"sets values"| node_settings

click node_java_agent "https://github.com/margele/openzen/blob/master/src/main/java/asm/patchify/loader/PatchAgent.java"
click node_native_loader "https://github.com/margele/openzen/tree/master/native/loader/src"
click node_native_dll "https://github.com/margele/openzen/tree/master/native/dll/src"
click node_patch_registry "https://github.com/margele/openzen/blob/master/src/main/java/asm/patchify/loader/PatchRegistry.java"
click node_game_patches "https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/patch"
click node_client "https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/ZenClient.java"
click node_event_bus "https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/event/EventBus.java"
click node_module_manager "https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/ModuleManager.java"
click node_gameplay "https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/modules/impl"
click node_settings "https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/settings"
click node_commands "https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/CommandManager.java"
click node_hud "https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/HudManager.java"
click node_gui "https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/gui"
click node_config "https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/ConfigManager.java"
click node_webui "https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/network/webui"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_java_agent,node_native_loader,node_native_dll,node_user toneBlue
class node_patch_registry,node_game_patches,node_client,node_event_bus toneAmber
class node_module_manager,node_gameplay,node_settings toneMint
class node_commands,node_hud,node_gui,node_config,node_webui toneRose
class node_minecraft toneIndigo
```

## Components

### Launch and injection

- [Java Agent](https://github.com/margele/openzen/blob/master/src/main/java/asm/patchify/loader/PatchAgent.java): `src/main/java/asm/patchify/loader/PatchAgent.java`
- [Hot injector](https://github.com/margele/openzen/tree/master/native/loader/src): `native/loader/src`
- [Injected DLL](https://github.com/margele/openzen/tree/master/native/dll/src): `native/dll/src`

### Client runtime

- [Patch registry](https://github.com/margele/openzen/blob/master/src/main/java/asm/patchify/loader/PatchRegistry.java): `src/main/java/asm/patchify/loader/PatchRegistry.java`
- [Game patches](https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/patch): `src/main/java/shit/zen/patch`
- [Zen client](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/ZenClient.java): `src/main/java/shit/zen/ZenClient.java`
- [Event bus](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/event/EventBus.java): `src/main/java/shit/zen/event/EventBus.java`

### Gameplay features

- [Module manager](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/ModuleManager.java): `src/main/java/shit/zen/manager/ModuleManager.java`
- [Gameplay modules](https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/modules/impl): `src/main/java/shit/zen/modules/impl`
- [Module settings](https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/settings): `src/main/java/shit/zen/settings`

### User interaction

- [Commands](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/CommandManager.java): `src/main/java/shit/zen/manager/CommandManager.java`
- [HUD manager](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/HudManager.java): `src/main/java/shit/zen/manager/HudManager.java`
- [Click GUIs](https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/gui): `src/main/java/shit/zen/gui`
- [Configuration](https://github.com/margele/openzen/blob/master/src/main/java/shit/zen/manager/ConfigManager.java): `src/main/java/shit/zen/manager/ConfigManager.java`
- [WebUI handlers](https://github.com/margele/openzen/tree/master/src/main/java/shit/zen/network/webui): `src/main/java/shit/zen/network/webui`

### Other components

- **User**
- **Minecraft JVM**

## Connections

- User → Java Agent: launches with
- User → Hot injector: starts
- Hot injector → Injected DLL: hot injects
- Java Agent → Minecraft JVM: attaches to
- Injected DLL → Minecraft JVM: injects into
- Minecraft JVM → Patch registry: loads agent
- Zen client → Patch registry: registers patches (evidence: `src/main/java/shit/zen/ZenClient.java`)
- Patch registry → Game patches: transforms classes
- Zen client → Event bus: initializes (evidence: `src/main/java/shit/zen/ZenClient.java`)
- Zen client → Module manager: creates (evidence: `src/main/java/shit/zen/ZenClient.java`)
- Zen client → HUD manager: creates (evidence: `src/main/java/shit/zen/ZenClient.java`)
- Zen client → Commands: creates (evidence: `src/main/java/shit/zen/ZenClient.java`)
- Zen client → Configuration: creates (evidence: `src/main/java/shit/zen/ZenClient.java`)
- Module manager → Gameplay modules: registers modules (evidence: `src/main/java/shit/zen/manager/ModuleManager.java`)
- Module manager → Event bus: subscribes to (evidence: `src/main/java/shit/zen/manager/ModuleManager.java`)
- Gameplay modules → Module settings: exposes settings (evidence: `src/main/java/shit/zen/modules/impl/player/InventoryManager.java`)
- HUD manager → Event bus: handles render events (evidence: `src/main/java/shit/zen/manager/HudManager.java`)
- Commands → Event bus: handles chat events (evidence: `src/main/java/shit/zen/manager/CommandManager.java`)
- User → Click GUIs: configures client
- User → WebUI handlers: controls remotely
- WebUI handlers → Gameplay modules: changes modules (evidence: `src/main/java/shit/zen/network/webui/SetSettingHandler.java`)
- WebUI handlers → Module settings: sets values (evidence: `src/main/java/shit/zen/network/webui/SetSettingHandler.java`)
