# itscola/promodule architecture

> Architecture diagram of the GitHub repository itscola/promodule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itscola/promodule
- Repository: https://github.com/itscola/promodule

## Overview

##### Project Type and Purpose
- This is a single‑repository Minecraft Forge “ghost client” mod called ProModule‑Client. It plugs into the Minecraft client via Forge and Mixin, injecting code at runtime to provide cheats, GUI enhancements, custom rendering, event‑driven modules, authentication, and integration with external services (Hypixel, Mojang, GitHub, etc.).

##### File‑Structure Analysis
- build.gradle, gradle wrapper, GitHub workflows: standard Java/Forge build & CI.
- src/main/java/me/ratsiel/*: standalone authentication and JSON sub‑libraries (abstract authenticator, models for Microsoft and Mojang, JSON parser/generator).
- src/main/java/top/whitecola/animationlib/*: independent animation engine (core Animation, functions, utilities).
- src/main/java/top/whitecola/promodule: the core mod, subdivided into:
- annotations & config (ModuleSetting, HiConfig, various config structs)
- event system (EventManager, adapters, event implementations)
- fonts & GUI (font loaders, GUI components, screens, notifications, widgets)
- injection layer (MixinLoader, mixin definitions targeting Minecraft classes)
- keybind definitions
- modules (IModule, AbstractModule, concrete cheat modules grouped by combat, movement, render, world, other)
- services (API wrappers for external REST endpoints, feature toggles like anti‑cheat, update checks, plus login flows)
- utilities (wide array of helper classes: rendering, math, networking, file I/O, threading)
- src/main/resources: Forge mod metadata, mixin JSON, assets (shaders, fonts, textures).

##### README Insights
- Confirms it’s a Forge‑based client mod with a click GUI, background artwork, and screenshots of in‑game UI.

a. Main Components
1. Host Platform: Minecraft Client (Forge Loader + Mixin Engine)
2. Mod Core: ProModule entrypoint & MixinLoader
3. Subsystems:
- Module Manager & Modules (combat, movement, render, world, other)
- Event System (EventManager, event dispatch & listeners)
- GUI Layer (font engine, screens, widgets, notifications)
- Configuration & Persistence (HiConfig, data structs)
- Services & API Wrappers (Hypixel, Mojang, GitHub, custom REST)
- Authentication Subsystem (me.ratsiel.auth package)
- Animation Library (independent engine used by GUI/modules)
- Utilities (shared helper classes)
4. External Services: Hypixel API, Mojang API, Microsoft OAuth.
5. Resources: shaders, fonts, textures.

b. Relationships & Interactions
- Forge Loader injects the mod JAR; MixinLoader applies bytecode patches to Minecraft classes.
- ProModule entrypoint initializes Config → registers EventManager → registers Modules.
- Minecraft game loop & network code raise events → EventManager dispatches to Modules & GUI.
- Modules invoke Utils, Services, and AnimationLib as needed.
- GUI Layer listens to render and input events → draws custom HUD, click GUI.
- Config subsystem serializes module settings to disk.
- Authentication subsystem calls Microsoft/Mojang endpoints via JSON lib.
- Services layer performs HTTP calls to external APIs, returns data models (e.g., HypixelPlayer).
- Utility classes assist with rendering (GLUtils), math, packets (PacketUtils), threading, etc.

c. Architectural Patterns / Principles
- Plugin pattern: modules implementing IModule loaded at runtime by ModuleManager.
- Event‑driven architecture: central EventManager decoupling producers (Minecraft, Services) and consumers (Modules, GUI).
- Mixin-based injection: modifies host classes without forking code.
- Layered design: core mod, modules, GUI, services, utils all clearly separated.
- Configuration as first‑class: annotation‑driven settings, persistent structs.

d. Key Technologies / Frameworks
- Java 8+, Gradle build
- Minecraft Forge mod loader
- SpongePowered Mixin framework
- Custom JSON parser/generator
- HTTP client (part of services layer)
- In‑game GUI using Minecraft rendering engine, OpenGL shaders

##### Essential Elements Checklist
- Minecraft → MixinLoader → Mod Core initialization
- Mod Core → EventManager → Modules/GUI
- Modules/GUI → Services (HTTP)
- Authentication → external OAuth endpoints

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Host Platform"
        MC["Minecraft + Forge + Mixin"]:::core
    end

    subgraph "Core & Infrastructure"
        ML["MixinLoader & mixin definitions"]:::core
        PM["ProModule Entry (ProModule.java)"]:::core
    end

    MC -->|"bytecode patch"| ML
    ML -->|"initialize mod"| PM

    subgraph "Configuration & Persistence"
        HC["HiConfig"]:::utils
        IS["Config Structs (struct/)"]:::utils
    end

    subgraph "Event & Module System"
        EM["EventManager"]:::modules
        MM["ModuleManager"]:::modules
        IM["IModule & AbstractModule"]:::modules
        Mods["Concrete Modules"]:::modules
    end

    PM -->|"load config"| HC
    PM -->|"register events"| EM
    EM -->|"dispatch events"| MM
    MM -->|"manage modules"| Mods

    subgraph "GUI & Animation"
        AL["AnimationLib"]:::gui
        Fonts["Font Loaders"]:::gui
        GComp["GUI Components"]:::gui
        GScr["GUI Screens"]:::gui
        GWid["GUI Widgets"]:::gui
        GNote["Notifications"]:::gui
    end

    EM -->|"render/input events"| GComp
    GComp --> GScr
    GComp --> GWid
    GScr --> GNote
    GComp -->|"use animations"| AL

    subgraph "Services & Authentication"
        SVR["API Wrappers & Feature Toggles"]:::services
        Login["Login Flows"]:::services
        Auth["Auth Subsystem"]:::services
    end

    Mods -->|"HTTP/REST"| SVR
    Login --> Auth
    Auth -->|"OAuth HTTP"| MSO["Microsoft OAuth"]:::external
    Auth -->|"HTTP"| MOJ["Mojang API"]:::external
    SVR -->|"HTTP REST"| HY["Hypixel API"]:::external

    subgraph "Utilities & JSON Lib"
        Utils["Utility Classes"]:::utils
        JSON["JSON Parser/Generator"]:::utils
    end

    Mods --> Utils
    EM --> Utils
    Auth --> JSON
    SVR --> JSON

    subgraph "Resources"
        Res["Shaders, Fonts, Textures, Metadata"]:::external
    end

    GComp --> Res

    %% Click Events
    click PM "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/ProModule.java"
    click ML "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/injection/MixinLoader.java"
    click ML "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/injection/mixins/"
    click MM "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/modules/ModuleManager.java"
    click IM "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/modules/IModule.java"
    click IM "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/modules/AbstractModule.java"
    click Mods "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/modules/impls/"
    click EM "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/events/EventManager.java"
    click EM "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/events/EventAdapter.java"
    click EM "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/events/impls/"
    click Fonts "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/fonts/"
    click GComp "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/gui/components/"
    click GScr "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/gui/screens/"
    click GWid "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/gui/widgets/"
    click GNote "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/gui/notification/"
    click HC "https://github.com/itscola/promodule/blob/main/src/main/java/top/whitecola/promodule/config/HiConfig.java"
    click IS "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/config/struct/"
    click SVR "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/services/apis/"
    click SVR "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/services/feature/"
    click Login "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/services/login/"
    click Auth "https://github.com/itscola/promodule/tree/main/src/main/java/me/ratsiel/auth/abstracts/"
    click Auth "https://github.com/itscola/promodule/tree/main/src/main/java/me/ratsiel/auth/model/microsoft/"
    click Auth "https://github.com/itscola/promodule/tree/main/src/main/java/me/ratsiel/auth/model/mojang/"
    click AL "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/animationlib/"
    click Utils "https://github.com/itscola/promodule/tree/main/src/main/java/top/whitecola/promodule/utils/"
    click Res "https://github.com/itscola/promodule/tree/main/src/main/resources/assets/promodule/"

    %% Styles
    classDef core fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef modules fill:#D0FFD0,stroke:#333,stroke-width:1px
    classDef gui fill:#FFE0B3,stroke:#333,stroke-width:1px
    classDef services fill:#FFF4B3,stroke:#333,stroke-width:1px
    classDef utils fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef external fill:#FFD0D0,stroke:#333,stroke-width:1px
```
