# matthew117/fullthrottlenei architecture

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

- Interactive diagram: https://gitdiagram.com/matthew117/fullthrottlenei
- Repository: https://github.com/matthew117/fullthrottlenei

## Overview

##### Project Type and Purpose
- This is a Minecraft mod add-on (for FullThrottle Alchemist) that primarily adds integration with NEI (Not Enough Items) and enhanced alchemy support.
- Its purpose is to extend support for alchemy flasks, research vellums, and also to allow additional features (like custom element integration and configurable recipes) via a JSON configuration file.

##### File Structure – Key Components and Organization
- The project is split into two broad areas:
- “src/api”: This package provides the public API interfaces that define contracts, such as alchemy (IElementConsumer, IElementProvider), inventory (ItemInventory, ItemInventoryUtils), recipes (IGrindRecipe, IFreezeRecipe, BasicRecipe, Recipe, etc.) and various utility classes. This separation indicates an intention for modularity and potential for extensibility.
- “src/main”: This is the core implementation of the mod. It includes several sub-components:
◦ Main entry points and mod initialization (e.g., FullThrottleNEI.java).
◦ GUI components for both NEI and configuration (see the “gui” package, which includes classes like EditElementsGui, ExtContainerGui, and GhostSlot).
◦ ASM integration (in the “asm” package) and core plugin to inject or tweak behavior at runtime.
◦ Proxying mechanism (client and common proxies in the “proxy” package) to handle side-specific logic.
◦ Network functionality (in the “network” package) such as handling packets for drag-and-drop operations.
◦ JSON configuration parsing (in the “json” package) to read alchemy and recipe configurations.
◦ NEI recipe handlers (in the “nei” package) that bridge the mod’s functionality with NEI’s interfaces.
- The presence of build scripts (gradle files and the Gradle wrapper) indicates standard build automation.

- API Layer: Represent the “src/api” package as a set of blocks that includes:
- Alchemy APIs (Element, IElementConsumer, IElementProvider)
- Inventory APIs
- Recipe APIs (IGrindRecipe, IFreezeRecipe, BasicRecipe, etc.)
- Utility Functions (ReflectionHelper)
- Core Mod Layer (“src/main”):
- Mod Entry Point: (FullThrottleNEI.java) responsible for initializing the mod.
- Configuration & JSON Parsing: Classes that read JSON configuration (JsonData and related classes in the “json” package) and ConfigurationHandler in “config”.
- ASM/Transformation: Blocks for ASM modules (e.g., FixGrindingBonusTransformer, FullThrottleNEICorePlugin) that hook into Minecraft’s launch process.
- GUI Components: Blocks from the “gui” package (EditElementsGui, GuiHandler, GuiFactory, etc.) plus NEI integration from the “nei” package.
- Network Communication: Represent the “network” package components handling packets like DragDropPacket.

b. Relationships and Data Flow:
- Mod Entry Block (FullThrottleNEI.java) to the ASM transformer, GUI layers, configuration, and network modules.
- Interactions between the JSON configuration handlers and the API/recipe modules (since the JSON config defines custom recipes and element data).

c. Architectural Patterns and Design Principles:
- Separation of concerns: Clearly distinguish between interface definitions (in the API package) and their implementations/integrations (in the main package).
- Modularity: The use of ASM transformers for runtime modification, dedicated networking for user interactions, and clear separation of GUI components.
- Client/Server Separation: Use the proxy pattern for handling logic that depends on the client (GUI) versus the common side.

d. Relevant Technologies and Tools:
- That the mod uses Gradle as its build tool.
- ASM (for bytecode manipulation) as an architectural technique.
- Mention that JSON is used for configuration management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "API Layer"
        API_Alchemy["Alchemy Interfaces (Element, IElementConsumer, IElementProvider)"]
        API_Inventory["Inventory APIs (ItemInventory, ItemInventoryUtils)"]
        API_Recipes["Recipe APIs (BasicRecipe, IFreezeRecipe, IGrindRecipe, Recipe, ...)"]
        API_Util["Utility Functions (ReflectionHelper)"]
    end

    subgraph "Core Mod Layer"
        ModEntry["FullThrottleNEI Main Entry"]
        JSON["JSON Configuration Parsing"]
        ConfigHandler["Configuration Handler"]
        ASM["ASM Integration (FixGrindingBonusTransformer, FullThrottleNEICorePlugin)"]
        GUI["GUI Components (EditElementsGui, ExtContainerGui, GhostSlot, ...)"]
        NEIRecipes["NEI Recipe Handlers (AtelierCraftingRecipeHandler, AtelierDecompositionRecipeHandler, AtelierDiscoveryRecipeHandler, NEIFullThrottleConfig)"]
        Proxy["Proxy Components (ClientProxy, CommonProxy, IProxy)"]
        Network["Network Communication (DragDropPacket, PacketTypes)"]
    end

    %% Relationships within Core Mod Layer
    ModEntry -->|"initJSON"| JSON
    ModEntry -->|"initConfig"| ConfigHandler
    ModEntry -->|"setupASM"| ASM
    ModEntry -->|"initGUI"| GUI
    ModEntry -->|"setupNEI"| NEIRecipes
    ModEntry -->|"initProxy"| Proxy
    ModEntry -->|"initNetwork"| Network

    %% Data Flow from Core Mod to API
    JSON -->|"loadsRecipes"| API_Recipes
    NEIRecipes -->|"usesAPI"| API_Recipes

    %% Proxy and Network Communication (bidirectional)
    Proxy -->|"communicatesWith"| Network
    Network -->|"communicatesWith"| Proxy

    %% Styling
    classDef api fill:#CCE5FF,stroke:#333,stroke-width:2px;
    classDef mod fill:#D1F2EB,stroke:#333,stroke-width:2px;
    class API_Alchemy,API_Inventory,API_Recipes,API_Util api;
    class ModEntry,JSON,ConfigHandler,ASM,GUI,NEIRecipes,Proxy,Network mod;

    %% Click Events for API components
    click API_Alchemy "https://github.com/matthew117/fullthrottlenei/tree/master/src/api/java/pa/api/alchemy"
    click API_Inventory "https://github.com/matthew117/fullthrottlenei/tree/master/src/api/java/pa/api/inventory"
    click API_Recipes "https://github.com/matthew117/fullthrottlenei/tree/master/src/api/java/pa/api/recipe"
    click API_Util "https://github.com/matthew117/fullthrottlenei/blob/master/src/api/java/pa/api/util/ReflectionHelper.java"

    %% Click Events for Core Mod components
    click ModEntry "https://github.com/matthew117/fullthrottlenei/blob/master/src/main/java/net/matthewbates/fullthrottlenei/FullThrottleNEI.java"
    click JSON "https://github.com/matthew117/fullthrottlenei/tree/master/src/main/java/net/matthewbates/fullthrottlenei/json"
    click ConfigHandler "https://github.com/matthew117/fullthrottlenei/blob/master/src/main/java/net/matthewbates/fullthrottlenei/config/ConfigurationHandler.java"
    click ASM "https://github.com/matthew117/fullthrottlenei/tree/master/src/main/java/net/matthewbates/fullthrottlenei/asm"
    click GUI "https://github.com/matthew117/fullthrottlenei/tree/master/src/main/java/net/matthewbates/fullthrottlenei/gui"
    click NEIRecipes "https://github.com/matthew117/fullthrottlenei/tree/master/src/main/java/net/matthewbates/fullthrottlenei/nei"
    click Proxy "https://github.com/matthew117/fullthrottlenei/tree/master/src/main/java/net/matthewbates/fullthrottlenei/proxy"
    click Network "https://github.com/matthew117/fullthrottlenei/tree/master/src/main/java/net/matthewbates/fullthrottlenei/network"
```
