# skyblockermod/skyblocker architecture

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

- Interactive diagram: https://gitdiagram.com/skyblockermod/skyblocker
- Repository: https://github.com/skyblockermod/skyblocker

## Overview

##### Project Type & Purpose
- Skyblocker is a Fabric-based Minecraft client mod (Java library) that injects additional features, HUDs, GUI screens, and game‐event handlers into Hypixel Skyblock. It uses Gradle+buildSrc for build-time annotation processing and Mixin-based bytecode weaving to modify Minecraft classes at runtime.

##### Key Architectural Layers
a. Build & Instrumentation
- Gradle + buildSrc: custom annotation processors (InitProcessor, HudProcessor) generate injection metadata.
- Fabric Loom & Mixin: the `skyblocker.mixins.json` defines mixin classes that transform Minecraft bytecode on startup.
b. Initialization & Entry
- SkyblockerMod (Fabric entrypoint) registers event listeners, GUI screens, data fixers, commands, and config manager.
c. Core Subsystems
- Event System: `events` package listens to chat, network, world, and tick events.
- Feature Modules: grouped under `skyblocker/skyblock` (dungeons, slayers, rift, etc.) each exposing HUD widgets, solvers, and overlays.
- GUI & HUD: `hud`, `screen`, and `tabhud` packages implement MVC-style screens/widgets and a pipeline (`ScreenBuilder`, `WidgetManager`) for rendering.
- Configuration: `config` package loads JSON via Codec, provides config screens, and applies data fixer migrations.
- WebSocket Service: `utils.ws` package manages external WebSocket connections for sharing waypoints (Crystal Hollows).
- Utilities: `utils` contains HTTP/API clients, JSON utilities, schedulers, and shared data structures.
d. Assets & Resources
- `src/main/resources/assets/skyblocker`: textures, language files, skeleton maps for dungeons.
- Resourcepacks: dynamic recoloring for dungeon textures.

##### Relationships & Data Flows
- At **build time**, annotation processors scan `@Init` / `@RegisterWidget` annotations → generate metadata → packaged into JAR.
- On **mod startup**, Fabric loads `SkyblockerMod` → registers Mixins → initializes subsystems: config, event bus, WebSocket, GUI registry.
- **Game events** (tick, network, chat) fire into event listeners → delegated to feature modules (e.g., dungeon solver) → compute state → push to HUD manager.
- **Rendering pipeline** pulls widget state each frame → draws GUI overlays using Fabric’s rendering hooks via Mixins (InGameHudMixin).
- **Config** reads/writes JSON on disk; user triggers screens via commands or mod menu; data fixers migrate older schemas.
- **WebSocket** connects to external server → sends/receives waypoint messages → injects into in-game map overlay.

##### Architectural Patterns & Principles
- **Plugin/Module** pattern: each feature (dungeons, slayers, profile viewer) lives in its own package, implements common interfaces (Tickable, Widget).
- **Observer**: event listeners decoupled from feature logic via registration in Fabric’s event bus.
- **Builder/Pipeline**: GUI elements are composed at runtime via a pipeline of `WidgetPositioner`s.
- **AOP / Mixin**: cross-cutting concerns (render hook, network interception) injected without modifying vanilla code.
- **Data Migration**: config `datafixer` ensures backward compatibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies
    GE["Game Engine"]:::external
    GR["Game Renderer"]:::external
    Disk["Disk (JSON Config)"]:::external
    ES["External Server"]:::external
    Assets["Assets & Resourcepacks"]:::external

    %% Build-Time Components
    subgraph "Build-Time" 
        BS["Build System\n(Gradle + Annotation Processors)"]:::build
        IP1["InitProcessor"]:::build
        IP2["HudProcessor"]:::build
        BS --> IP1
        BS --> IP2
        IP1 -->|"generates metadata"| Meta["Injection Metadata"]:::build
        IP2 --> Meta
    end

    %% Runtime Integration
    subgraph "Runtime Integration"
        FL["Fabric Loader"]:::runtime
        JSON["skyblocker.mixins.json"]:::runtime
        MixinDir["Mixins Package"]:::runtime
        ME["Mixin Engine"]:::runtime
        FL --> ME
        JSON --> ME
        MixinDir --> ME
        SM["SkyblockerMod"]:::runtime
        ME --> SM
        FL --> SM
    end

    %% Core Subsystems
    SM --> EB["Event Bus & Listener Registry"]:::runtime
    SM --> GUIReg["GUI Registry"]:::runtime
    SM --> CM["Config Manager & Data Fixers"]:::service
    SM --> WS["WebSocket Service"]:::service
    SM --> UTIL["Utilities Layer"]:::utilities

    %% Feature Modules & UI Pipeline
    subgraph "Feature Modules" 
        FM["Feature Modules\n(Dungeons, Slayers, Rift, etc.)"]:::feature
    end
    subgraph "GUI/HUD Pipeline"
        SB["ScreenBuilder"]:::feature
        WM["WidgetManager"]:::feature
    end

    %% Connections
    GE --> EB
    EB --> FM
    FM --> SB
    FM --> WM
    SB --> GR
    WM --> GR
    GR --> GE

    CM --> Disk
    Disk --> CM

    WS --> ES
    ES --> WS

    SB --> Assets
    WM --> Assets

    UTIL --> WS
    UTIL --> CM
    UTIL --> FM

    %% Click Events
    click IP1 "https://github.com/skyblockermod/skyblocker/blob/master/buildSrc/src/main/java/de/hysky/skyblocker/init/InitProcessor.java"
    click IP2 "https://github.com/skyblockermod/skyblocker/blob/master/buildSrc/src/main/java/de/hysky/skyblocker/hud/HudProcessor.java"
    click JSON "https://github.com/skyblockermod/skyblocker/blob/master/src/main/resources/skyblocker.mixins.json"
    click MixinDir "https://github.com/skyblockermod/skyblocker/tree/master/src/main/java/de/hysky/skyblocker/mixins/"
    click SM "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/SkyblockerMod.java"
    click EB "https://github.com/skyblockermod/skyblocker/tree/master/src/main/java/de/hysky/skyblocker/events/"
    click FM "https://github.com/skyblockermod/skyblocker/tree/master/src/main/java/de/hysky/skyblocker/skyblock/"
    click SB "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/skyblock/tabhud/screenbuilder/ScreenBuilder.java"
    click WM "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/skyblock/tabhud/screenbuilder/WidgetManager.java"
    click CM "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/config/SkyblockerConfigManager.java"
    click CM "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/config/datafixer/ConfigDataFixer.java"
    click WS "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/utils/ws/SkyblockerWebSocket.java"
    click WS "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/utils/ws/Service.java"
    click WS "https://github.com/skyblockermod/skyblocker/blob/master/src/main/java/de/hysky/skyblocker/utils/ws/WsMessageHandler.java"
    click UTIL "https://github.com/skyblockermod/skyblocker/tree/master/src/main/java/de/hysky/skyblocker/utils/"
    click Assets "https://github.com/skyblockermod/skyblocker/tree/master/src/main/resources/assets/skyblocker/"
    click Assets "https://github.com/skyblockermod/skyblocker/tree/master/src/main/resources/resourcepacks/recolored_dungeon_items/"

    %% Styles
    classDef build fill:#bbdefb,stroke:#1e88e5;
    classDef runtime fill:#c8e6c9,stroke:#43a047;
    classDef feature fill:#ffe0b2,stroke:#fb8c00;
    classDef service fill:#e1bee7,stroke:#8e24aa;
    classDef external fill:#f5f5f5,stroke:#9e9e9e,stroke-dasharray: 5 5;
    classDef utilities fill:#eeeeee,stroke:#757575,stroke-dasharray: 2 2;
```
