# skytils/skytilsmod architecture

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

- Interactive diagram: https://gitdiagram.com/skytils/skytilsmod
- Repository: https://github.com/skytils/skytilsmod

## Overview

##### Project Type and Purpose
- SkytilsMod is a client-side Minecraft Forge mod for Hypixel Skyblock. It uses Gradle multi-module structure, Kotlin & Java, Mixin/ASM bytecode transformers, an event bus, and an embedded HTTP/WebSocket API.

##### File Structure Analysis
- Top-level modules:
- `events/` – standalone event bus & mixin hooks
- `hypixel-api/` – (likely) wrapper for Hypixel REST endpoints
- `src/` – main SkytilsMod code: installer UI, tweaker, core services, features, commands, GUI, localapi & WS client
- `scripts/` – build-time TypeScript utilities (e.g., combine, split)
- Key folders under `src/main/kotlin/gg/skytils/skytilsmod/`:
- `tweaker/` – loading plugin & security manager
- `mixins/` – Mixin init & extension hooks
- `core/` – config, persistence, entity manager, data fetcher, update checker
- `events/` – custom event definitions & impls
- `commands/` – CLI commands & implementations
- `features/` – modular feature implementations (dungeons, farming, slayers…)
- `gui/` – Elementa-based overlays & configuration GUIs
- `localapi/` – Ktor HTTP routes for external tools
- `skytilsws/` – WebSocket client for real-time data

##### README Insights
- Describes hundreds of client-side utilities organized by category: general, dungeons, farming, mining…
- Emphasis on event-driven features, custom GUI overlays, mixin hooks, and external integration (local HTTP + WS).

##### Core Components & Their Interactions
a. Minecraft Client & Forge Mod Loader
- Minecraft runs under Forge; SkytilsMod is injected via a Tweaker and Mixin plugins.
b. Transformer Layer
- ASM & Mixin transformers modify game classes at load time (`mixins.skytils.json`).
c. Event Bus (`events/`)
- Captures game lifecycle events (packets, render, tick, GUI) and dispatches to registered listeners.
d. Core Services (`core/`)
- Config manager loads/saves user settings.
- EntityManager tracks in-game entities.
- DataFetcher obtains external data (e.g., Hypixel API).
- UpdateChecker calls GitHub Releases API.
- SoundQueue handles custom audio playback.
e. Features (`features/`)
- Subscribe to events to implement mod behaviors (dungeon solvers, spam hider, overlays).
f. Commands (`commands/`)
- Provide chat commands and route to GUI or core services.
g. GUI (`gui/`)
- Creates in-game overlays & configuration screens with Elementa.
h. Local API Server (`localapi/`)
- Ktor HTTP server exposing endpoints for waypoints, data, etc.
i. WebSocket Client (`skytilsws/`)
- Connects to remote WS (for live updates or cloud bridge).
j. Persistence
- `PersistentSave` writes config and user data to disk.

##### Architectural Patterns & Principles
- Modular event-driven architecture: decoupling game events (publish–subscribe).
- Layered design: transformer layer, core services, feature modules, presentation (GUI/API).
- Dependency inversion: features depend on interfaces in core & events modules.
- Separation of concerns: mixins/ASM only modify game; features only handle logic; GUI only handles rendering.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main container
    subgraph "Minecraft Client + Forge"
        direction TB

        subgraph "Loader/Tweaker"
            direction TB
            TweakerJava["Tweaker & Loader (Java)"]:::coregreen
            TweakerKotlin["SkytilsLoadingPluginKt"]:::coregreen
        end

        subgraph "Transformer Layer"
            direction TB
            SkytilsTransformer["SkytilsTransformer.kt"]:::coregreen
            ASMTransformers["transformers/"]:::coregreen
            MixinsConfig["mixins.skytils.json"]:::coregreen
        end

        subgraph "Event Bus"
            direction TB
            EventsModule["events module/"]:::coregreen
            RuntimeEvents["skytilsmod/events/"]:::coregreen
        end

        subgraph "Core Services"
            direction TB
            CoreServices["core/"]:::coregreen
            PersistentSave["PersistentSave.kt"]:::coregreen
        end

        subgraph "Features & Commands"
            direction TB
            Features["features/"]:::featureyellow
            Commands["commands/"]:::featureyellow
        end

        subgraph "GUI Overlays"
            direction TB
            GUI["gui/"]:::guiorange
            InstallerUI["SkytilsInstallerFrame.java"]:::guiorange
        end

        subgraph "Embedded API & WS"
            direction TB
            LocalAPI["LocalAPI.kt"]:::guiorange
            APIRoutes["routes/"]:::guiorange
            WSClient["skytilsws/client/"]:::externalblue
        end
    end

    %% External services
    GitHubReleases["GitHub Releases API"]:::externalblue
    HypixelAPI["Hypixel REST API"]:::externalblue
    ExternalTools["External Tools"]:::externalblue
    WSServer["WebSocket Server"]:::externalblue

    %% Connections
    TweakerJava -->|loads| SkytilsTransformer
    TweakerKotlin -->|loads| SkytilsTransformer
    SkytilsTransformer --> ASMTransformers
    ASMTransformers --> MixinsConfig
    MixinsConfig --> EventsModule
    EventsModule --> RuntimeEvents
    RuntimeEvents --> Features
    RuntimeEvents --> Commands
    Features --> GUI
    Commands --> GUI
    CoreServices --> PersistentSave
    CoreServices --> DataFetcher
    DataFetcher[DataFetcher]:::coregreen -->|HTTP| HypixelAPI
    UpdateChecker[UpdateChecker]:::coregreen -->|HTTP| GitHubReleases
    LocalAPI -->|HTTP| ExternalTools
    WSClient ---|WS| WSServer
    Features -->|uses| CoreServices
    Commands -->|uses| CoreServices
    GUI -->|renders| Features
    GUI -->|configures| CoreServices

    %% Definitions for DataFetcher and UpdateChecker inside Core Services
    CoreServices --> DataFetcher
    CoreServices --> UpdateChecker

    %% Click events
    click SkytilsTransformer "https://github.com/skytils/skytilsmod/blob/1.x/src/main/kotlin/gg/skytils/skytilsmod/asm/SkytilsTransformer.kt"
    click ASMTransformers "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/asm/transformers/"
    click MixinsConfig "https://github.com/skytils/skytilsmod/blob/1.x/src/main/resources/mixins.skytils.json"
    click EventsModule "https://github.com/skytils/skytilsmod/tree/1.x/events/src/main/kotlin/gg/skytils/event/"
    click RuntimeEvents "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/events/"
    click CoreServices "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/core/"
    click PersistentSave "https://github.com/skytils/skytilsmod/blob/1.x/src/main/kotlin/gg/skytils/skytilsmod/core/PersistentSave.kt"
    click Features "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/features/"
    click Commands "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/commands/"
    click GUI "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/gui/"
    click InstallerUI "https://github.com/skytils/skytilsmod/blob/1.x/src/main/java/SkytilsInstallerFrame.java"
    click LocalAPI "https://github.com/skytils/skytilsmod/blob/1.x/src/main/kotlin/gg/skytils/skytilsmod/localapi/LocalAPI.kt"
    click APIRoutes "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/localapi/routes/"
    click WSClient "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsws/client/"
    click TweakerJava "https://github.com/skytils/skytilsmod/tree/1.x/src/main/java/gg/skytils/skytilsmod/tweaker/"
    click TweakerKotlin "https://github.com/skytils/skytilsmod/blob/1.x/src/main/kotlin/gg/skytils/skytilsmod/tweaker/SkytilsLoadingPluginKt.kt"
    click MixinsInitPlugin "https://github.com/skytils/skytilsmod/blob/1.x/src/main/kotlin/gg/skytils/skytilsmod/mixins/SkytilsMixinInitPlugin.kt"
    click MixinsPlugin "https://github.com/skytils/skytilsmod/blob/1.x/src/main/kotlin/gg/skytils/skytilsmod/mixins/SkytilsMixinPlugin.kt"
    click MixinsExtensions "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/mixins/extensions/"
    click MixinsHooks "https://github.com/skytils/skytilsmod/tree/1.x/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/"
    click HypixelAPI "https://github.com/skytils/skytilsmod/tree/1.x/hypixel-api/"
    click CombineScript "https://github.com/skytils/skytilsmod/blob/1.x/scripts/combine.ts"
    click SplitScript "https://github.com/skytils/skytilsmod/blob/1.x/scripts/splitAndSave.ts"
    click ConverterScript "https://github.com/skytils/skytilsmod/blob/1.x/scripts/propertyConverter.ts"

    %% Styles
    classDef externalblue fill:#D0E8FF,stroke:#1E90FF,color:#000;
    classDef coregreen fill:#DFFFD0,stroke:#32CD32,color:#000;
    classDef featureyellow fill:#FFF8DC,stroke:#DAA520,color:#000;
    classDef guiorange fill:#FFEFD5,stroke:#FFA500,color:#000;
```
