# jrbudda/minecrift architecture

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

- Interactive diagram: https://gitdiagram.com/jrbudda/minecrift
- Repository: https://github.com/jrbudda/minecrift

## Overview

##### Main Components
- Build/Installation Workflow – Represent the various scripts (install.bat/.py/.sh, build.bat, getchanges, applychanges) and how they interact with the code repositories.
- Patch Management System – Include both the “mcppatches” folder (for patching the deobfuscated Minecraft code) and the “patches” folder (for ongoing modifications). Show that changes are generated (using getchanges) and then applied (via applychanges).
- Source Code and VR-Specific Logic – Display the “src” folder structure with its primary packages:
– com.mtbs3d.minecrift (for VR integration, gameplay modifications, settings, control interfaces, and GUI)
– jopenvr (the Java wrappers for interfacing with OpenVR and native VR components)
- External Dependencies and Environment Setup – Include components like the MCP (downloaded and extracted into “mcp908”), external libraries, Java JDK, and Python 2.7 that are necessary for the build process.

##### Relationships and Interactions
- Data Flow in the Build Process:
– The “install” scripts download MCP and external dependencies.
– The downloaded MCP provides a decompiled and deobfuscated base (located in mcp908, even if not visible directly in the repo, it is central per the README).
– Patches from “mcppatches” are applied first to generate a near-vanilla Minecraft source.
– Next, further modifications from “patches” are layered on top.
– Then, custom Vivecraft code from “src” is merged in to form the final VR-enabled source code.
– The build process (triggered via build.bat and related scripts) then creates a jar and uses installer configurations (in the “installer” folder) to package the final executable installer.
- Version control and update mechanism:
– A process using “getchanges.bat” compares current changes against the original unmodified decompiled code, generating new patches.
– “applychanges.bat” can reapply these patches to update the codebase after pulling new changes from GitHub.

##### Architectural Patterns and Design Principles
- Layered/Pipeline Architecture – The overall process works as a sequential pipeline: environment setup → MCP decompilation → patch application → source code injection → packaging/installer build.
- Extensibility – By using patch files instead of directly distributing Minecraft’s code, the system allows easier updates to the underlying game while preserving Vivecraft modifications.

##### Technologies and Frameworks
- Java – Core language for Vivecraft’s source code, installer, and launch4j wrapper.
- Python (scripts like install.py, build.py, etc.) – Utilized in the build and patch application process.
- Shell and Batch Scripts – Part of the cross-platform build workflow.
- Launch4j – For wrapping the Java application as a Windows executable installer.
- OpenVR integration via the jopenvr package.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build/Installation Workflow Subgraph
    subgraph "Build/Installation Workflow"
        subgraph "Install Scripts"
            direction TB
            inb["install.bat"]:::workflow
            inpy["install.py"]:::workflow
            insh["install.sh"]:::workflow
        end
        subgraph "Build Scripts"
            direction TB
            bb["build.bat"]:::workflow
            bpy["build.py"]:::workflow
            bsh["build.sh"]:::workflow
        end
        subgraph "Patch Update Scripts"
            direction TB
            gcb["getchanges.bat"]:::workflow
            gcpy["getchanges.py"]:::workflow
            gcs["getchanges.sh"]:::workflow
            acb["applychanges.bat"]:::workflow
            acpy["applychanges.py"]:::workflow
            acs["applychanges.sh"]:::workflow
        end
        subgraph "Packaging Scripts"
            direction TB
            cb["create_install.bat"]:::workflow
            cpy["create_install.py"]:::workflow
            csh["create_install.sh"]:::workflow
        end
    end

    %% Main Pipeline
    ES["Environment Setup (Java,Python,ExternalLibraries)"]:::infra
    MCP["MCP Setup (mcp908Download&Extract)"]:::infra
    DS["Decompiled Minecraft Source"]:::infra
    BP["Apply Base Patches (mcppatches)"]:::patch
    VP["Apply Vivecraft Patches (patches)"]:::patch
    CC["Merge Custom Vivecraft Code"]:::code
    MC["Minecrift (src/com/mtbs3d/minecrift)"]:::code
    JV["OpenVR (src/jopenvr)"]:::code
    BPROC["Build Process (JarCreation)"]:::build
    IP["Installer Packaging (installer)"]:::installer
    FD["FinalVR-EnabledBuild (Installer.exe)"]:::installer

    %% Connections from Build/Installation Workflow Representatives
    inb --> ES
    bb  --> BPROC
    gcb --> VP
    cb  --> IP

    %% Main Pipeline Flow
    ES --> MCP
    MCP --> DS
    DS --> BP
    BP --> VP
    VP --> CC
    CC --> BPROC
    BPROC --> IP
    IP --> FD

    %% Custom Code Detailing
    CC --> MC
    CC --> JV

    %% Styles
    classDef infra fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef patch fill:#A9DFBF,stroke:#117A65,stroke-width:2px;
    classDef code fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef build fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef installer fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef workflow fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;

    %% Click Events for Build/Installation Workflow Nodes
    click inb "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/install.bat"
    click inpy "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/install.py"
    click insh "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/install.sh"
    click bb "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/build.bat"
    click bpy "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/build.py"
    click bsh "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/build.sh"
    click gcb "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/getchanges.bat"
    click gcpy "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/getchanges.py"
    click gcs "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/getchanges.sh"
    click acb "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/applychanges.bat"
    click acpy "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/applychanges.py"
    click acs "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/applychanges.sh"
    click cb "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/create_install.bat"
    click cpy "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/create_install.py"
    click csh "https://github.com/jrbudda/minecrift/blob/vive_1_7_10/create_install.sh"

    %% Click Events for Patch Management and Source Code
    click BP "https://github.com/jrbudda/minecrift/tree/vive_1_7_10/mcppatches/"
    click VP "https://github.com/jrbudda/minecrift/tree/vive_1_7_10/patches/"
    click MC "https://github.com/jrbudda/minecrift/tree/vive_1_7_10/src/com/mtbs3d/minecrift/"
    click JV "https://github.com/jrbudda/minecrift/tree/vive_1_7_10/src/jopenvr/"
    click IP "https://github.com/jrbudda/minecrift/tree/vive_1_7_10/installer/"
```
