# pitan76/storagebox-fabric architecture

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

## Overview

##### And Represent the Main Components
- Mod Entry Point: Mark the mod’s initialization class (e.g., StorageBoxMod) as the central entry point that registers components with Fabric.
- Client & Server Logic: Separate the system into:
– Client-side Logic: Include classes like StorageBoxClient, StorageBoxScreen, StorageBoxScreenHandler, and potentially rendering hooks (ItemRendererHooks, StorageBoxModel) that are responsible for UI, rendering, and input handling.
– Server-side Logic: Indicate StorageBoxServer and inventory management classes (e.g., StorageBoxInventory, StorageBoxItem) that handle game state, data persistence, and server-side validation.
- Mixin Components: Illustrate the mixin packages (under mixin/), which include custom classes (ItemEntityAccessor, KeyBindingAccessor, etc.) that modify or extend the behavior of Minecraft’s default classes.

##### Relationships and Data Flow
- Link from StorageBoxClient to UI components (StorageBoxScreen, StorageBoxScreenHandler) showing the flow of user interaction and data.
- Connections between data files (recipes in data/storagebox/recipes) and how they might interact with server-side logic to create coherent gameplay elements.

##### Architectural Patterns
- Modularity: Note the separation of client and server logic as a critical pattern in the design of a Minecraft mod.
- Extension via Mixins: Emphasize how mixins are used to inject or override game behavior. Represent these as layers or overlays that connect to the “Minecraft Core Engine.”
- Asset-Data Separation: Clearly differentiate between the code (in the “src” directories) and the configuration/resources (in “resources”), underscoring a clean separation of concerns.

##### Integrate Relevant Technologies
- Java: Since all code is written in Java.
- Fabric API: Although not explicitly mentioned, the presence of fabric.mod.json and client mixin configurations indicate reliance on the Fabric toolchain.
- Gradle Build System: Include an element representing the build and dependency management via Gradle (e.g., build.gradle, gradle files).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build System
    GS("Gradle Build System"):::gradle

    %% Mod Entry Point
    SM("StorageBoxMod"):::entry

    %% Client Side Subgraph
    subgraph "Client Side Logic"
        SC("StorageBoxClient"):::client
        SS("StorageBoxScreen"):::client
        SSH("StorageBoxScreenHandler"):::client
        SMOD("StorageBoxModel"):::client
    end

    %% Server Side Subgraph
    subgraph "Server Side Logic"
        SSrv("StorageBoxServer"):::server
        SINV("StorageBoxInventory"):::server
        SITEM("StorageBoxItem"):::server
    end

    %% Mixins Subgraph
    subgraph "Mixin Components"
        MEA("ItemEntityAccessor"):::mixin
        MKA("KeyBindingAccessor"):::mixin
        MPM("ItemPickupMixin"):::mixin
        MRA("ItemRendererAccessor"):::mixin
        MRSM("RenderStorageBoxMixin"):::mixin
    end

    %% Core Game Engine
    MC("Minecraft Core Engine"):::mixin

    %% Resources & Assets Subgraph
    subgraph "Resources & Assets"
        AS("Assets (textures, models, lang)"):::resource
        DC("Data Configurations (recipes)"):::resource
        MCfg("Mod Configuration"):::resource
        CMC("Client Mixin Config"):::resource
        SMC("Server Mixin Config"):::resource
    end

    %% Connections
    GS -->|"builds"| SM
    SM -->|"registers-client"| SC
    SM -->|"registers-server"| SSrv
    MCfg -->|"provides-mod-info"| SM
    SC -->|"triggers-UI"| SS
    SC -->|"handles-screen"| SSH
    SC -->|"invokes-render"| SMOD
    SSrv -->|"manages-inventory"| SINV
    SSrv -->|"defines-item"| SITEM

    %% Mixin injection to Minecraft Core
    MEA ---|"injects"| MC
    MKA ---|"injects"| MC
    MPM ---|"injects"| MC
    MRA ---|"injects"| MC
    MRSM ---|"injects"| MC

    %% Resources usage
    AS -->|"supplies-assets"| SS
    DC -->|"supplies-data"| SSrv
    CMC -->|"configures-mixins"| MEA
    CMC -->|"configures-mixins"| MKA
    SMC -->|"configures-mixins"| MPM
    SMC -->|"configures-mixins"| MRA
    SMC -->|"configures-mixins"| MRSM

    %% Class Definitions
    classDef entry fill:#FDB813,stroke:#000,stroke-width:2px;
    classDef client fill:#85C1E9,stroke:#000,stroke-width:2px;
    classDef server fill:#82E0AA,stroke:#000,stroke-width:2px;
    classDef mixin fill:#F5B7B1,stroke:#000,stroke-width:2px;
    classDef resource fill:#D7BDE2,stroke:#000,stroke-width:2px;
    classDef gradle fill:#F7DC6F,stroke:#000,stroke-width:2px;

    %% Click Events
    click SM "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxMod.java"
    click SC "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxClient.java"
    click SS "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxScreen.java"
    click SSH "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxScreenHandler.java"
    click SMOD "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxModel.java"
    click SSrv "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxServer.java"
    click SINV "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxInventory.java"
    click SITEM "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/StorageBoxItem.java"
    click MEA "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/mixin/ItemEntityAccessor.java"
    click MKA "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/mixin/KeyBindingAccessor.java"
    click MPM "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/mixin/ItemPickupMixin.java"
    click MRA "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/mixin/ItemRendererAccessor.java"
    click MRSM "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/java/ml/pkom/storagebox/mixin/RenderStorageBoxMixin.java"
    click AS "https://github.com/pitan76/storagebox-fabric/tree/main/src/main/resources/assets/storagebox/"
    click DC "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/resources/data/storagebox/recipes/storagebox.json"
    click MCfg "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/resources/fabric.mod.json"
    click CMC "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/resources/storagebox.client.mixins.json"
    click SMC "https://github.com/pitan76/storagebox-fabric/blob/main/src/main/resources/storagebox.mixins.json"
```
