# edayot/itemio architecture

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

- Interactive diagram: https://gitdiagram.com/edayot/itemio
- Repository: https://github.com/edayot/itemio

## Overview

##### Main Components
- Cable System – Represented by the files under data/itemio/functions/impl/cable. This system manages the initialization, updating, network regeneration, and destruction of cables.
- Container System – Found under data/itemio/functions/impl/container. It covers both vanilla and custom container behaviors, automated output/input handling, and various sub-flows for different container types.
- Filter System – Under data/itemio/functions/impl/filters. This set of functions supports filtering by item predicates, merging criteria, and handling of various filter call types.
- Servo & Utility Functions – The servo directory and other utility files (for ticking and other routine tasks) comprise functions that assist in transfer logic and model updates.
- Data Assets & Integration Files – This includes predicates, tags, item modifiers, and structures (found in data/itemio/tags, data/itemio/predicates, data/itemio/structures) which define and map in-game behavior.
- Core Python/Plugin Layer – The “itemio” Python package (with plugin.py, types.py, and utils.py) provides an interface or bootstrapping layer for integrating or managing the datapack's functionalities, possibly during build or development.
- CI/CD & Deployment – The .github/workflows and associated scripts show that continuous integration (build, testing, deployment to Smithed & Modrinth) is part of the development lifecycle.
- Documentation & Templates – The docs and templates directories help users understand and customize the integration in their datapacks.

##### Relationships and Interactions
- Data Flow: Show how a Minecraft datapack that loads ItemIO first triggers initialization functions (note the “init” functions under cable, container, and servo). Then represent periodic updates (tick functions) and event-driven function calls (such as auto-handled output, cable updates, and container repartitioning).

##### Architectural Patterns and Design Principles
- Modularity and Encapsulation: The structure clearly shows modular design; each system (e.g., cables, containers, filters) is contained within its own directory with well-defined function groups, which suggests separation of concerns.
- Reusability: There are shared utilities (such as the “utils” directory) and common YAML configuration files (common.yaml, beet.yaml) indicating that configuration and shared logic are abstracted for reuse.
- CI/CD Automation: Represent how GitHub workflows and scripts (like push-to-modrinth.py or release.yml) trigger build and deployment pipelines, integrating with external modding platforms.

##### Relevant Technologies, Frameworks, and Libraries
- Minecraft Datapack Framework – The entire system is built around Minecraft’s datapack architecture.
- LanternLoad – A required loader/dependency for operating ItemIO.
- Python – The “itemio” package suggests some Python tooling supports building, testing, or plugin management.
- GitHub Actions – For continuous integration and deployment to modding platforms like Smithed and Modrinth.

- On the infrastructure side, create components for “Build & Deployment” (CI/CD workflows), “Python Utilities” (itemio package), and “Documentation & Templates”. Connect these to the datapack core to indicate how development and deployment support updates to the in-game logic.
- Don’t forget to include dependencies like LanternLoad as an external dependency feeding into the datapack core.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Datapack Core Layer
    subgraph "Datapack Core"
        CableSystem["Cable System"]:::datapack
        ContainerSystem["Container System"]:::datapack
        FilterSystem["Filter System"]:::datapack
        subgraph "Servo & Utility Functions"
            ServoFunctions["Servo Functions"]:::datapack
            UtilityFunctions["Utility Functions"]:::datapack
        end
        subgraph "Data Assets & Integration"
            Tags["Tags"]:::datapack
            Predicates["Predicates"]:::datapack
            Structures["Structures"]:::datapack
            ItemModifiers["Item Modifiers"]:::datapack
        end
    end

    %% Build & Support Infrastructure Layer
    subgraph "Build & Support Infrastructure"
        subgraph "Core Python/Plugin Layer"
            Plugin["Plugin"]:::infra
            Types["Types"]:::infra
            PyUtils["Python Utils"]:::infra
        end
        CICD["CI/CD & Deployment"]:::infra
        Docs["Documentation"]:::infra
        Templates["Templates"]:::infra
        LanternLoad["LanternLoad"]:::infra
    end

    %% Relationships within Datapack Core
    LanternLoad -->|"init"| CableSystem
    CableSystem -->|"calls"| ContainerSystem
    ContainerSystem -->|"triggers"| FilterSystem
    ContainerSystem -->|"updates"| ServoFunctions
    CableSystem -->|"updates"| ServoFunctions

    %% Python Layer supports Datapack Core
    Plugin -->|"build-support"| CableSystem
    Plugin -->|"build-support"| ContainerSystem
    Plugin -->|"build-support"| FilterSystem
    Plugin -->|"build-support"| ServoFunctions

    %% CI/CD and Documentation support Python Layer
    CICD -->|"deploys"| Plugin
    Docs -->|"guides"| Plugin
    Templates -->|"templates"| Plugin

    %% Filter System uses Data Assets
    FilterSystem -->|"uses"| Tags
    FilterSystem -->|"uses"| Predicates
    FilterSystem -->|"uses"| Structures
    FilterSystem -->|"uses"| ItemModifiers

    %% Styles
    classDef datapack fill:#AED6F1,stroke:#1F618D,stroke-width:2px,color:#000;
    classDef infra fill:#A9DFBF,stroke:#1D8348,stroke-width:2px,color:#000;

    %% Click Events for Component Mapping
    click CableSystem "https://github.com/edayot/itemio/tree/master/data/itemio/functions/impl/cable"
    click ContainerSystem "https://github.com/edayot/itemio/tree/master/data/itemio/functions/impl/container"
    click FilterSystem "https://github.com/edayot/itemio/tree/master/data/itemio/functions/impl/filters"
    click ServoFunctions "https://github.com/edayot/itemio/tree/master/data/itemio/functions/impl/servo"
    click UtilityFunctions "https://github.com/edayot/itemio/tree/master/data/itemio/functions/impl/utils"
    click Tags "https://github.com/edayot/itemio/tree/master/data/itemio/tags"
    click Predicates "https://github.com/edayot/itemio/tree/master/data/itemio/predicates"
    click Structures "https://github.com/edayot/itemio/tree/master/data/itemio/structures"
    click ItemModifiers "https://github.com/edayot/itemio/tree/master/data/itemio/item_modifiers"
    click Plugin "https://github.com/edayot/itemio/blob/master/itemio/plugin.py"
    click Types "https://github.com/edayot/itemio/blob/master/itemio/types.py"
    click PyUtils "https://github.com/edayot/itemio/blob/master/itemio/utils.py"
    click CICD "https://github.com/edayot/itemio/tree/master/.github/workflows"
    click Docs "https://github.com/edayot/itemio/tree/master/docs"
    click Templates "https://github.com/edayot/itemio/tree/master/templates"
```
