# arielm24/sg_compass architecture

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

## Overview

##### Project Type & Purpose
- This project is a Minecraft mod developed for the Fabric mod loader.
- Its primary purpose is to enhance gameplay by providing coordinate display functionality when a compass is in the player's inventory.
- The mod takes advantage of Fabric’s mixin system to alter or extend game behavior.

##### File Structure
- Notice two main directories under src: “src/client” and “src/main”. This division indicates a separation of concerns between client-specific code and the core mod logic.
- Resource files are stored in “src/main/resources” (including the Fabric mod JSON file and mixin configurations) and “src/client/resources” (client-specific mixin configuration).
- The presence of build scripts (build.gradle, settings.gradle) and Gradle wrapper files indicates that the project is built using Gradle.

##### Main Components
- Fabric Mod Loader: Since the mod is built on the Fabric framework, include it as the initial integration point, representing how the mod is loaded into Minecraft.
- Mod Initialization Components:
- SGCompass (main entry point) – represents the core functionality.
- SGCompassClient (client entry point) – handling any client-specific behaviors.
- Mixin Components:
- Main Mixins (e.g., ExampleMixin.java) – define modifications to the game’s server-side or general behavior.
- Client Mixins (e.g., ExampleClientMixin.java) – handle client-specific modifications.
- Configuration & Resources:
- Fabric.mod.json – detailing mod metadata and entry points.
- Mixin configuration files (e.g., sg-compass.mixins.json in both client and main) – illustrate how mixins are applied.
- Supporting Infrastructure:
- The Gradle build system indicating project build and dependency management setups.

##### Relationships & Interactions
- That the Fabric Mod Loader acts as the orchestrator that loads the mod using the definitions in fabric.mod.json.
- Separation between client-specific enhancements (client module with ExampleClientMixin) and core mod behavior (main module with ExampleMixin).

##### Architectural Patterns & Design Principles
- Modular design: The separation between “main” and “client” modules following a clear modular design pattern.
- Mixin-based programming: Using mixins as an elegant way to alter game behavior without modifying the original code.
- Configuration-driven integration: Fabric’s mod JSON and mixin JSON files act as declarative configurations to manage mod entry points and code injection.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer: Build System and Fabric Loader
    gradle["Gradle Build System"]:::build
    fml["Fabric Mod Loader"]:::loader

    %% Middle Layer: Mod Modules
    subgraph "Main Mod Module"
        main_entry["SGCompass (Core Entry Point)"]:::entrypoint
        main_mixin["ExampleMixin (Main Mixin)"]:::mixin
        resource1["fabric.mod.json"]:::config
        resource2["sg-compass.mixins.json"]:::config
    end

    subgraph "Client Mod Module"
        client_entry["SGCompassClient (Client-Specific Entry Point)"]:::entrypoint
        client_mixin["ExampleClientMixin (Client Mixin)"]:::mixin
        client_resource["sg-compass.client.mixins.json"]:::config
    end

    %% Bottom Layer: Minecraft Core
    minecraft["Minecraft Core"]:::external

    %% Connections: Build and Initialization
    gradle -->|"Build"| fml
    fml -->|"Initialization"| main_entry
    fml -->|"Initialization"| client_entry
    resource1 -->|"Configures"| main_entry
    client_resource -->|"Configures"| client_entry

    %% Mixin Injection Paths
    main_mixin -->|"Injection"| minecraft
    resource2 -->|"Injection"| minecraft
    client_mixin -->|"Injection"| minecraft

    %% Styles
    classDef entrypoint fill:#c7f464,stroke:#333,stroke-width:2px;
    classDef mixin fill:#f7a3a3,stroke:#333,stroke-width:2px;
    classDef config fill:#a9d0f5,stroke:#333,stroke-width:2px;
    classDef loader fill:#d3c0eb,stroke:#333,stroke-width:2px;
    classDef build fill:#faffbd,stroke:#333,stroke-width:2px;
    classDef external fill:#dce775,stroke:#333,stroke-width:2px;

    %% Click Events
    click gradle "https://github.com/arielm24/sg_compass/blob/master/build.gradle"
    click main_entry "https://github.com/arielm24/sg_compass/blob/master/src/main/java/com/sg/compass/SGCompass.java"
    click main_mixin "https://github.com/arielm24/sg_compass/blob/master/src/main/java/com/sg/compass/mixin/ExampleMixin.java"
    click resource1 "https://github.com/arielm24/sg_compass/blob/master/src/main/resources/fabric.mod.json"
    click resource2 "https://github.com/arielm24/sg_compass/blob/master/src/main/resources/sg-compass.mixins.json"
    click client_entry "https://github.com/arielm24/sg_compass/blob/master/src/client/java/com/sg/compass/SGCompassClient.java"
    click client_mixin "https://github.com/arielm24/sg_compass/blob/master/src/client/java/com/sg/compass/mixin/client/ExampleClientMixin.java"
    click client_resource "https://github.com/arielm24/sg_compass/blob/master/src/client/resources/sg-compass.client.mixins.json"
```
