# napasitng/neoforg-learn architecture

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

- Interactive diagram: https://gitdiagram.com/napasitng/neoforg-learn
- Repository: https://github.com/napasitng/neoforg-learn

## Overview

##### Project Type and Purpose
- This is a template Minecraft “mod” project using the NeoForged/Forge ecosystem.
- The goal is to generate a Java-based game extension (mod) that the Minecraft client/server will load at runtime.

##### High-Level File Structure Analysis
- Top‐level build files and configs:
- build.gradle, gradlew(.bat), gradle/…, settings.gradle → Gradle build system
- .github/workflows/build.yml → CI build pipeline
- Source code under src/main/java/com/example/examplemod:
- ExampleMod.java → main mod entry point (lifecycle hooks, event bus registrations)
- Config.java → mod configuration class
- Resources under src/main/resources/META-INF/neoforge.mods.toml → mod metadata descriptor

##### Key Architectural Elements
- Developer Environment
- GitHub repository (template) → versioning & CI
- IDE (IntelliJ/Eclipse) → code editing, Gradle integration
- Build System
- Gradle wrapper → deterministic builds, dependency resolution (Minecraft libraries, mappings)
- NeoGradle plugin → launch groups for dev environment (client/server)
- CI workflow → automated build & test on push
- Runtime Environment
- Minecraft client or server
- NeoForged/Forge Mod Loader → dynamic plugin loader, event bus
- Your mod JAR → loaded via neoforge.toml descriptor
- Config subsystem → runtime mod settings

1. Developer Workstation (IDE + GitHub)
2. Gradle Build System
3. Continuous Integration Server (GitHub Actions)
4. Minecraft + NeoForged Mod Loader
5. Mod Components (ExampleMod code, Config, Resources)
6. External Dependencies (Mojang mappings, Forge libraries)

- Developer → Git push → GitHub repo → triggers → CI pipeline
- Developer/IDE ↔ Gradle wrapper → build, refresh-dependencies
- Gradle → resolves → external dependencies (Mojang mappings, Forge jars)
- Gradle → compiles sources & packages → mod JAR + neoforge.mods.toml
- Minecraft client/server + NeoForged → loads → mod JAR at runtime
- Mod’s ExampleMod ↔ NeoForged event bus → registers game hooks
- Config ↔ mod’s runtime → reads/writes user settings file

c. Architectural Patterns and Principles
- Plugin architecture (mod loader dynamically discovers and loads your JAR)
- Separation of concerns: build configuration vs. source code vs. runtime metadata
- Convention over configuration: neoforge.toml in META-INF drives discovery
- Event‐driven design: ExampleMod listens on Forge’s event bus

d. Technologies & Frameworks
- Java 17+ (as specified by Gradle properties)
- NeoForged/Forge Mod Loader API
- Gradle & NeoGradle plugin
- GitHub Actions for CI

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Development" 
        direction TB
        DeveloperIDE["Developer Workstation\n(IDE)"]:::dev
        GitHubRepo["GitHub Repository"]:::dev
        README["README.md"]:::dev
        License["TEMPLATE_LICENSE.txt"]:::dev
        GitIgnore[".gitignore"]:::dev
        Gitattributes[".gitattributes"]:::dev
    end

    subgraph "Build" 
        direction TB
        GradleWrapper["Gradle Wrapper\n(gradlew, gradle/)"]:::build
        BuildConfig["Build Configs\n(build.gradle, settings.gradle)"]:::build
        CI["GitHub Actions CI"]:::build
        ExternalDeps["External Dependencies\n(Mojang mappings, Forge libs)"]:::build
    end

    subgraph "Runtime" 
        direction TB
        Minecraft["Minecraft Client/Server"]:::runtime
        Loader["NeoForged/Forge Mod Loader"]:::runtime
        ModJAR["Mod JAR"]:::runtime
        ExampleMod["ExampleMod.java"]:::runtime
        Config["Config.java"]:::runtime
        TOML["neoforge.mods.toml"]:::runtime
    end

    DeveloperIDE -->|"push code"| GitHubRepo
    GitHubRepo -->|"triggers"| CI
    DeveloperIDE -->|"invoke"| GradleWrapper
    CI -->|"runs build"| GradleWrapper
    GradleWrapper -->|"resolves"| ExternalDeps
    GradleWrapper -->|"compiles & packages"| ModJAR
    BuildConfig -->|"used by"| GradleWrapper

    ModJAR -->|"includes"| ExampleMod
    ModJAR -->|"includes"| Config
    ModJAR -->|"includes"| TOML

    Minecraft -->|"loads"| Loader
    Loader -->|"dynamic load"| ModJAR
    ExampleMod -->|"registers hooks on"| Loader
    Config -->|"provides settings to"| ExampleMod

    click CI "https://github.com/napasitng/neoforg-learn/blob/main/.github/workflows/build.yml"
    click GradleWrapper "https://github.com/napasitng/neoforg-learn/tree/main/gradlew"
    click GradleWrapper "https://github.com/napasitng/neoforg-learn/blob/main/gradlew.bat"
    click GradleWrapper "https://github.com/napasitng/neoforg-learn/blob/main/gradle/wrapper/gradle-wrapper.properties"
    click BuildConfig "https://github.com/napasitng/neoforg-learn/blob/main/build.gradle"
    click BuildConfig "https://github.com/napasitng/neoforg-learn/blob/main/settings.gradle"
    click ExampleMod "https://github.com/napasitng/neoforg-learn/blob/main/src/main/java/com/example/examplemod/ExampleMod.java"
    click Config "https://github.com/napasitng/neoforg-learn/blob/main/src/main/java/com/example/examplemod/Config.java"
    click TOML "https://github.com/napasitng/neoforg-learn/blob/main/src/main/resources/META-INF/neoforge.mods.toml"
    click README "https://github.com/napasitng/neoforg-learn/blob/main/README.md"
    click License "https://github.com/napasitng/neoforg-learn/blob/main/TEMPLATE_LICENSE.txt"
    click GitIgnore "https://github.com/napasitng/neoforg-learn/blob/main/.gitignore"
    click Gitattributes "https://github.com/napasitng/neoforg-learn/blob/main/.gitattributes"

    classDef dev fill:#D0E1FF,stroke:#0366d6,color:#0366d6;
    classDef build fill:#D4F8D4,stroke:#28a745,color:#236e3b;
    classDef runtime fill:#FFE3B8,stroke:#d69f29,color:#b36b00;
```
