# fpsmasterteam/fpsmaster architecture

> Architecture diagram of the GitHub repository fpsmasterteam/fpsmaster, 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/fpsmasterteam/fpsmaster
- Repository: https://github.com/fpsmasterteam/fpsmaster

## Overview

##### Project Type & Purpose
- FPSMaster is a modular Minecraft PvP client (a desktop client mod), written in Java and built with Gradle.
- It provides an SDK (in “shared/…”), platform‑specific adapters (“v1.8.9/…” and “v1.12.2/…”), a plugin/module system (features, commands, Lua scripts), a UI overlay engine, event bus, external‑service integrations (WebSocket, music APIs, OpenAI, Microsoft login), and resource assets.

##### Top‑Level Architectural Components
A. Core SDK
– shared/java/top/fpsmaster: EventBus (EventDispatcher, Handler), feature/command APIs, module & settings managers, font & render helpers, utility methods.
– shared/resources: Minecraft assets, GUI scripts, shaders, language packs.
B. Platform Adapters
– v1.8.9 and v1.12.2 folders: Forge mixins, wrapper providers, launch configuration, version‑specific Minecraft hooks.
C. Module & Plugin Engine
– Feature modules (“features/…”): Interface modules, render/utility/optimize modules.
– Command modules (“features/command/…”).
– Lua scripting engine (“modules/lua/…”).
– Category/ModuleManager orchestrates load/unload.
D. UI Layer
– shared/java/top/fpsmaster/ui: Click GUI, custom HUD components, minimap, notification system, dev‑space.
– FontManager + EnhancedFontRenderer.
E. Event System
– ASMHandler, ReflectHandler, DynamicHandler hook into Minecraft events.
– EventDispatcher broadcasts Event* classes to subscribed module callbacks.
F. Configuration & Persistence
– ConfigManager loads/saves module settings (Setting classes under features/settings).
G. External Integrations
– WebSocket client (“websocket/client/WsClient”) for server messages.
– Third‑party HTTP & auth (MicrosoftLogin, OpenAIClient, NeteaseApi).
– UpdateChecker, GitInfo.
H. Build & Deployment
– Gradle scripts in each version folder, GitHub Actions workflow (.github/workflows/gradle.yml).

##### Relationships & Data Flows
- At launch, the platform adapter loads the Core SDK via mixins/hooks.
- The EventBus registers module callbacks; Minecraft internal events are intercepted by ASMHandler → EventDispatcher → module handlers.
- Modules query ConfigManager & Setting classes for runtime preferences.
- LuaManager parses & executes scripts in response to events.
- MusicPlayer and WebSocket client run in background threads, push data via EventBus or callback interfaces.
- External APIs are invoked asynchronously; results are wrapped into events or passed to UI modules.

##### Architectural Patterns & Principles
- Observer Pattern (EventBus) for loose coupling between Minecraft engine and modules.
- Plugin/Module architecture: ModuleManager dynamically loads/unloads modules; settings injection.
- Adapter/Provider pattern: wrapper providers abstract Minecraft internals for core SDK.
- Model‑View separation: modules maintain state & settings (model), UI classes render overlays (view).

##### Final Checklist
– At least one zoomed‑in inset showing EventBus subscription flow.
– Persistent storage (config files) and CI pipeline as contextual sidebars.

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% Platform Adapters
  subgraph "Platform Adapters"
    direction TB
    PA89["v1.8.9 Adapter"]:::adapter
    PA12["v1.12.2 Adapter"]:::adapter
  end
  click PA89 "https://github.com/fpsmasterteam/fpsmaster/tree/v4/v1.8.9/src/main/java/top/fpsmaster/forge"
  click PA89 "https://github.com/fpsmasterteam/fpsmaster/tree/v4/v1.8.9/src/main/java/top/fpsmaster/forge/mixin"
  click PA12 "https://github.com/fpsmasterteam/fpsmaster/tree/v4/v1.12.2/src/main/java/top/fpsmaster/forge"
  click PA12 "https://github.com/fpsmasterteam/fpsmaster/tree/v4/v1.12.2/src/main/java/top/fpsmaster/forge/mixin"
  
  %% Core SDK
  subgraph "Core SDK"
    direction TB
    SDK["Core SDK\n(shared/java/top/fpsmaster)"]:::core
    ES["Event System"]:::core
    UD["Utilities"]:::core
    PI["Provider Interfaces"]:::core
    FR["Font & Render Helpers"]:::core
  end
  click SDK "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster"
  click ES "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/event/EventDispatcher.java"
  click ES "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/event/ASMHandler.java"
  click ES "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/event/ReflectHandler.java"
  click ES "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/event/DynamicHandler.java"
  click ES "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/event/events"
  click UD "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/utils"
  click PI "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/interfaces"
  click FR "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/font"
  
  %% Module & Plugin Engine
  subgraph "Module & Plugin Engine"
    direction TB
    FM["Feature Modules"]:::module
    CM["Command Modules"]:::module
    SM["Settings"]:::module
    MM["ModuleManager"]:::module
    LUA["Lua Scripting Engine"]:::module
  end
  click FM "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/features/impl"
  click CM "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/features/command/CommandManager.java"
  click CM "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/features/command"
  click SM "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/features/settings"
  click MM "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/features/manager/ModuleManager.java"
  click MM "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/features/manager/Category.java"
  click MM "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/features/manager/Module.java"
  click LUA "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/modules/lua/LuaManager.java"
  click LUA "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/modules/lua/parser/LuaParser.java"
  click LUA "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/modules/lua/LuaScript.java"
  
  %% UI Layer
  subgraph "UI Layer"
    direction TB
    CLICKGUI["Click GUI & Panels"]:::ui
    HUD["Custom HUD Components"]:::ui
    MINIMAP["Minimap"]:::ui
    NOTIF["Notification System"]:::ui
    DEV["Dev‑Space"]:::ui
    MCSCR["MC Screens & Overlays"]:::ui
  end
  click CLICKGUI "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/click"
  click CLICKGUI "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/click/component"
  click CLICKGUI "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/click/modules"
  click HUD "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/custom"
  click MINIMAP "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/minimap"
  click NOTIF "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/ui/notification/NotificationManager.java"
  click DEV "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/devspace"
  click MCSCR "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/screens"
  click MCSCR "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/ui/mc"
  
  %% Configuration & Persistence
  subgraph "Config & Persistence"
    direction TB
    CMGR["ConfigManager"]:::storage
    SM2["Settings"]:::storage
  end
  click CMGR "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/modules/config/ConfigManager.java"
  click SM2 "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/features/settings"
  
  %% External Services
  subgraph "External Services"
    direction TB
    WS["WebSocket Client"]:::external
    HTTP["HTTP & Auth Clients"]:::external
    UPD["UpdateChecker & GitInfo"]:::external
  end
  click WS "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/websocket/client/WsClient.java"
  click WS "https://github.com/fpsmasterteam/fpsmaster/tree/v4/shared/java/top/fpsmaster/websocket/data/message"
  click HTTP "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/utils/thirdparty/microsoft/MicrosoftLogin.java"
  click HTTP "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAIClient.java"
  click HTTP "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/modules/music/netease/NeteaseApi.java"
  click UPD "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/utils/thirdparty/github/UpdateChecker.java"
  click UPD "https://github.com/fpsmasterteam/fpsmaster/blob/v4/shared/java/top/fpsmaster/utils/GitInfo.java"
  
  %% Build & Deployment
  subgraph "Build & Deployment"
    direction TB
    CI["GitHub Actions"]:::build
    BG89["v1.8.9 Build Scripts"]:::build
    BG12["v1.12.2 Build Scripts"]:::build
  end
  click CI "https://github.com/fpsmasterteam/fpsmaster/blob/v4/.github/workflows/gradle.yml"
  click BG89 "https://github.com/fpsmasterteam/fpsmaster/blob/v4/v1.8.9/build.gradle.kts"
  click BG89 "https://github.com/fpsmasterteam/fpsmaster/blob/v4/v1.8.9/settings.gradle.kts"
  click BG12 "https://github.com/fpsmasterteam/fpsmaster/blob/v4/v1.12.2/build.gradle.kts"
  click BG12 "https://github.com/fpsmasterteam/fpsmaster/blob/v4/v1.12.2/settings.gradle.kts"
  
  %% Connections
  PA89 -->|"Hook/Mixin"| SDK
  PA12 -->|"Hook/Mixin"| SDK
  SDK -->|"APIs"| FM
  ES -->|"Event"| FM
  FM -->|"RenderCall"| CLICKGUI
  FM -->|"RenderCall"| HUD
  FM -->|"RenderCall"| MINIMAP
  FM -->|"RenderCall"| NOTIF
  FM -->|"RenderCall"| DEV
  FM -->|"RenderCall"| MCSCR
  FM -->|"↔"| CMGR
  FM -->|"ScriptExec"| LUA
  FM -->|"PushEvent"| WS
  FM -->|"API Request/Response"| HTTP
  HTTP -->|"Response Event"| FM
  
  CI --> BG89
  CI --> BG12
  
  %% EventBus Inset
  subgraph "EventBus Flow"
    direction TB
    ASM["ASMHandler"]:::core
    REF["ReflectHandler"]:::core
    DYN["DynamicHandler"]:::core
    DIS["EventDispatcher"]:::core
    MODH["Module Handler"]:::module
    ASM -->|"HookedEvent"| DIS
    REF -->|"HookedEvent"| DIS
    DYN -->|"HookedEvent"| DIS
    DIS -->|"Dispatch Event"| MODH
  end
  
  %% Styles
  classDef core fill:#cce5ff,stroke:#0366d6;
  classDef adapter fill:#d4edda,stroke:#155724;
  classDef module fill:#ffe5b4,stroke:#e69500;
  classDef ui fill:#fff3cd,stroke:#856404;
  classDef external fill:#e2d6f3,stroke:#5a3e85;
  classDef build fill:#e2e3e5,stroke:#6c757d;
  classDef storage fill:#f0f0f0,stroke:#999999;
```
