# jorgemacias-12/minecraft-map-to-image architecture

> Architecture diagram of the GitHub repository jorgemacias-12/minecraft-map-to-image, 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/jorgemacias-12/minecraft-map-to-image
- Repository: https://github.com/jorgemacias-12/minecraft-map-to-image

## Overview

##### Project Type and Purpose
- The project is a C# Winforms desktop application.
- Its purpose is to load Minecraft save files (both Java and Bedrock editions) and convert specific item maps into image format. It provides a user-friendly UI for previewing and exporting these maps.
- The project leverages external libraries such as SharpNBT for parsing Minecraft-specific NBT files.

##### Analyzing the File Structure
- At the top level, you see a solution file (Minecraft-Map-To-Image.sln) and a project file (Minecraft-Map-To-Image.csproj), with Program.cs as the application entry point.
- The Properties directory contains assembly and resource files – these are standard for managing assembly-level metadata and resources.
- The src/ directory is split into several subdirectories:
- components: Contains UI components such as JProgressBar and a custom control (MinecraftEditionCard), which likely encapsulate specific user interface elements.
- logic: This is where the core functionality resides:
- “helpers” holds various helper classes (e.g., MinecraftDataHelper, MinecraftLoaderHelper, etc.) that handle the processing, loading, and possibly transformation of Minecraft data.
- “models” defines the data structures (e.g., MinecraftMap, MinecraftSave) representing the domain entities.
- “utils” contains utility code like Enums to help in decision-making and to improve code clarity.
- views: Contains the Winforms UI forms (SplashScreen, EditionSelector, MinecraftSaveExplorer, and BaseForm). These represent different screens and dialogs within the application.

##### Key Components
- Entry Point: Program.cs which initializes the application.
- User Interface (UI) Layer:
- Views: Main Winforms (SplashScreen, EditionSelector, MinecraftSaveExplorer, BaseForm)
- Components: Custom UI controls (e.g., JProgressBar, MinecraftEditionCard)
- Business Logic Layer:
- Logic/Helpers: Classes that process and load Minecraft data (e.g., MinecraftLoaderHelper, MinecraftMapLoaderHelper, MinecraftSaveLoaderHelper).
- Logic/Models: Domain entities that represent Minecraft maps and saves.
- Logic/Utils: Enums and possibly other utility functions used across the tool.
- External Dependencies:
- SharpNBT library (as noted in the README) for reading/writing Minecraft NBT files.
- .NET Framework (version 8 as per requirements) that underpins the application runtime.

##### Relationships and Interactions
- The Program.cs initializes the application by creating the primary form (likely the SplashScreen or BaseForm).
- UI views (from the views folder) interact with the users and then call methods in the logic layer.
- The logic layer’s helpers take charge of loading and parsing Minecraft save files and converting map data.
- Data models in the logic/models directory serve as the structured data passed between the UI and the logic.
- The custom UI components are used within forms to display progress or edition-specific content, suggesting a close tie between view presentation and the underlying data processing.

##### Essential Elements
- Clear labels and names for each identified component.
o From Program.cs to the SplashScreen or BaseForm.
o From UI views (e.g., MinecraftSaveExplorer) to logic (e.g., MinecraftLoaderHelper, MinecraftMapLoaderHelper).
o From logic components to external dependency (SharpNBT).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point
    subgraph "Entry Point"
        prog["Program.cs"]:::entry
    end

    %% UI Layer
    subgraph "UI Layer"
        splash["SplashScreen Form"]:::ui
        edition["EditionSelector Form"]:::ui
        explorer["MinecraftSaveExplorer Form"]:::ui
        baseForm["BaseForm Form"]:::ui
        progress["JProgressBar Control"]:::ui
        editionCard["MinecraftEditionCard Control"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        %% Helpers
        subgraph "Helpers"
            dataHelper["MinecraftDataHelper"]:::logic
            helper["MinecraftHelper"]:::logic
            loaderHelper["MinecraftLoaderHelper"]:::logic
            mapLoaderHelper["MinecraftMapLoaderHelper"]:::logic
            saveLoaderHelper["MinecraftSaveLoaderHelper"]:::logic
        end
        %% Models
        subgraph "Models"
            mapModel["MinecraftMap Model"]:::logic
            saveModel["MinecraftSave Model"]:::logic
        end
        %% Utils
        subgraph "Utils"
            enumsUtil["Enums"]:::logic
        end
    end

    %% External Dependencies
    subgraph "External Dependencies"
        sharpNBT["SharpNBT Library"]:::external
        dotNet[".NET Framework"]:::external
    end

    %% Connections between layers
    prog -->|"launches"| splash
    prog -->|"runsOn"| dotNet

    splash -->|"leadsTo"| edition
    edition -->|"selects"| explorer
    explorer -->|"opens"| baseForm

    baseForm -->|"incorporates"| progress
    baseForm -->|"incorporates"| editionCard

    explorer -->|"calls"| loaderHelper
    explorer -->|"calls"| saveLoaderHelper
    edition -->|"calls"| helper

    loaderHelper -->|"populates"| mapModel
    loaderHelper -->|"populates"| saveModel
    helper -->|"uses"| enumsUtil

    dataHelper -->|"uses"| sharpNBT
    loaderHelper -->|"uses"| sharpNBT
    mapLoaderHelper -->|"uses"| sharpNBT
    saveLoaderHelper -->|"uses"| sharpNBT

    %% Click Events for Entry Point and UI Views
    click prog "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/Program.cs"
    click splash "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/views/SplashScreen.cs"
    click edition "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/views/EditionSelector.cs"
    click explorer "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/views/MinecraftSaveExplorer.cs"
    click baseForm "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/views/BaseForm.cs"
    click progress "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/components/JProgressBar.cs"
    click editionCard "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/components/MinecraftEditionCard.cs"

    %% Click Events for Business Logic
    click dataHelper "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/helpers/MinecraftDataHelper.cs"
    click helper "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/helpers/MinecraftHelper.cs"
    click loaderHelper "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/helpers/MinecraftLoaderHelper.cs"
    click mapLoaderHelper "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/helpers/MinecraftMapLoaderHelper.cs"
    click saveLoaderHelper "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/helpers/MinecraftSaveLoaderHelper.cs"
    click mapModel "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/models/MinecraftMap.cs"
    click saveModel "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/models/MinecraftSave.cs"
    click enumsUtil "https://github.com/jorgemacias-12/minecraft-map-to-image/blob/main/src/logic/utils/Enums.cs"

    %% Styling
    classDef entry fill:#cccccc,stroke:#666666,stroke-width:2px,color:#000000;
    classDef ui fill:#a8d8ea,stroke:#333333,stroke-width:2px,color:#000000;
    classDef logic fill:#caffbf,stroke:#333333,stroke-width:2px,color:#000000;
    classDef external fill:#ffadad,stroke:#333333,stroke-width:2px,color:#000000;
```
