# toshimichi0915/sushi-client architecture

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

- Interactive diagram: https://gitdiagram.com/toshimichi0915/sushi-client
- Repository: https://github.com/toshimichi0915/sushi-client

## Overview

##### Main Components
- Client Core & Initialization:
- Core startup classes (e.g., SushiInitializer, SushiMod, ModConfig) that bootstrap the mod.
- Integration points with Minecraft’s mod loader and Forge/Mixin system.
- Module System:
- How modules can be added, removed, and manipulated (clonable modules, removable modules, etc.).
- Event & Handlers System:
- Detail the event bus and event classes (found in the events directory) which capture game events such as player movements, ticks, input events, packet events, etc.
- Various event handlers in the handlers directory along with specific handlers for forge event types.
- Command & Input System:
- Isolate the command system (classes under the command directory) that handles textual inputs (".help", ".restore", etc.) and parses custom commands.
- This system with the module system, showing that commands trigger module behavior (e.g., toggle modules and change settings).
- Graphical User Interface (GUI & HUD):
- GUI components (components, panels, themes, and HUD elements found in the gui and hud directories).
- How the GUI interacts with user input (via keybinds), how it’s customizable with configuration settings, and how HUD elements are rendered during gameplay.
- Configuration & Task System:
- Task framework (Task, TaskChain, and various tasks) used to execute delayed or asynchronous operations.
- Mixin & Low-Level Integration:
- Mixin-based classes (in the mixin package) that modify or intercept Minecraft client internals to enable enhanced functionality.
- That this layer connects the mod’s core with the game’s internal mechanics.
- Account & Networking Components:
- Account management parts (in the account package) that deal with Mojang authentication, account encryption, and related API requests/responses.

##### Relationships and Data Flow
- Initialization flows from SushiInitializer into the core system where modules are registered, events are bound to handlers, and the GUI is set up.
- Mixins interpose on the Minecraft client, funneling game events (render, input, tick, etc.) into the Event Bus; from there, events are dispatched to both module logic and GUI components.
- The Module System depends on the Event System (receiving game events, keybinds, and commands), and in turn, modules can affect game behavior (e.g., combat modules, movement modules).
- The Configuration subsystem supplies data to the GUI, modules, and even to account management; likewise, changes in settings (via the GUI) update the configuration records.
- The Task system works as a utility layer, running scheduled work that might be triggered by modules or event handlers.
- Finally, clearly display connections between the core, mixins, and external Minecraft/Forge APIs.

##### Incorporate Essential Architectural Patterns
- Event-driven design: use arrowed lines to illustrate the flow of events from the game (via mixins) to event handlers and modules.
- Use layering to capture separation of concerns (Core, Event/Command System, GUI/HUD, Module functionalities, and Utility/Task handlers).
- Modular design that allows modules to be dynamically added, removed, and reconfigured.
- Dependency injection or configuration injection patterns in the Configuration system if applicable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Initialization
    subgraph "Core Initialization"
        SI("SushiInitializer"):::core
        SM("SushiMod"):::core
        MC("ModConfig"):::core
    end

    %% Module System
    subgraph "Module System"
        MS("Modules"):::module
    end

    %% Event System
    subgraph "Event System"
        EV("Event Bus/Events"):::event
        EH("Event Handlers"):::event
    end

    %% Command & Input System
    subgraph "Command & Input"
        CMD("Command System"):::command
    end

    %% GUI & HUD
    subgraph "GUI & HUD"
        GUI("GUI"):::gui
        HUD("HUD"):::gui
    end

    %% Configuration & Task System
    subgraph "Configuration & Task System"
        CFG("Configuration"):::config
        TS("Task System"):::task
    end

    %% Mixin & Low-Level Integration
    subgraph "Mixin & Low-Level Integration"
        MX("Mixin Layer"):::mixin
    end

    %% Account & Networking
    subgraph "Account & Networking"
        AC("Account Management"):::account
    end

    %% Connections
    SI -->|"init_modules"| MS
    SI -->|"bind_events"| EV
    SI -->|"setup_GUI"| GUI
    SI -->|"load_config"| CFG
    SI -->|"setup_mixin"| MX

    MX -->|"game_events"| EV
    EV -->|"notify_handler"| EH
    EH -->|"handle_events"| MS
    EV -->|"dispatch_events"| MS

    CMD -->|"trigger_module"| MS
    CMD -->|"update_config"| CFG

    CFG <-->|"sync_config"| GUI

    MS -->|"schedule_tasks"| TS
    TS -->|"async_updates"| MS

    MS -->|"account_interaction"| AC
    CFG -->|"update_account"| AC

    %% Click Events
    click SI "https://github.com/toshimichi0915/sushi-client/blob/forge_1.12.2/src/main/java/net/sushiclient/client/SushiInitializer.java"
    click SM "https://github.com/toshimichi0915/sushi-client/blob/forge_1.12.2/src/main/java/net/sushiclient/client/SushiMod.java"
    click MC "https://github.com/toshimichi0915/sushi-client/blob/forge_1.12.2/src/main/java/net/sushiclient/client/ModConfig.java"
    click MS "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/modules"
    click EV "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/events"
    click EH "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/handlers"
    click CMD "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/command"
    click GUI "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/gui"
    click HUD "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/gui/hud"
    click CFG "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/config"
    click TS "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/task"
    click MX "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/mixin"
    click AC "https://github.com/toshimichi0915/sushi-client/tree/forge_1.12.2/src/main/java/net/sushiclient/client/account"

    %% Styles
    classDef core fill:#a3c1ad,stroke:#333,stroke-width:2px;
    classDef module fill:#8dd3c7,stroke:#333,stroke-width:2px;
    classDef event fill:#bebada,stroke:#333,stroke-width:2px;
    classDef command fill:#fb8072,stroke:#333,stroke-width:2px;
    classDef gui fill:#80b1d3,stroke:#333,stroke-width:2px;
    classDef config fill:#fdb462,stroke:#333,stroke-width:2px;
    classDef task fill:#b3de69,stroke:#333,stroke-width:2px;
    classDef mixin fill:#fccde5,stroke:#333,stroke-width:2px;
    classDef account fill:#d9d9d9,stroke:#333,stroke-width:2px;
```
