# adr-hyng/anglers-desire architecture

> Architecture diagram of the GitHub repository adr-hyng/anglers-desire, 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/adr-hyng/anglers-desire
- Repository: https://github.com/adr-hyng/anglers-desire

## Overview

##### Main components
- Behavior Pack (BP): Contains game logic elements such as function files (mcfunctions), scripts (JavaScript files under BP/scripts), recipes, loot tables, entities, items, blocks, and spawn rules. This layer is responsible for defining how the addon changes vanilla game behavior.
- Resource Pack (RP): Holds assets for visuals and sounds including textures, models (geo.json files), animations, particles, and language texts. This represents the presentation layer for the in‐game effects.
- Source Code (src): Written in TypeScript, this portion mirrors the structure in BP (with directories like commands, custom_enchantment, enchantment_system, fishing_system, overrides, utils, etc.) and is likely compiled/transpiled to output the JS used by the addon. This folder organizes the core systems and modules behind the behavior pack.
- Build & Development Tools: Tools (Python scripts, tsconfig.json, package.json) and additional directories (like “tools” and “setup”) support building, processing the manifest, synchronizing configurations, and packaging the addon for deployment.
- Additional Assets and Configurations: Other folders (mcip, res, etc.) offer configuration assets (such as addon configuration, manifest files, thumbnails, and extra recipes) to support deployment, documentation, or marketing assets.

##### Relationships and interactions
- The Minecraft engine loads both the Behavior Pack and Resource Pack. The blueprint for changes is defined in BP (with functions, entities, events, loot tables, etc.) while RP provides the visual and audio overlays corresponding to these logical changes.
- Within the behavior pack, various systems interact:
– The fishing system (under BP/scripts and src/fishing_system) handles the customized fishing mechanics including hooks, events (like on_hook_created, on_hook_item), loot table management, and entity handling.
– The enchantment system and custom enchantment modules (in both BP/scripts and src/enchantment_system/custom_enchantment) extend vanilla enchantments and integrate special effects.
– Command handling (found in BP/scripts/commands and src/commands) lets players and servers configure the addon dynamically, triggering certain functions or refreshing configurations.
– Overrides (e.g., player, dimension, container) ensure that custom behaviors are injected where vanilla behavior would normally be.
- Utility modules (src/utils and BP/scripts/utils) support the core systems by offering common functionalities like pathfinding, randomization, logging, and even specialized math utilities (vector operations).

##### Architectural patterns and principles
- Modularization: Each system (fishing, enchantment, command, overrides, and utilities) is separated into its own module, making unit testing and maintenance easier.
- Separation of concerns: Visual and behavioral changes are divided between the Resource Pack (assets and visuals) and Behavior Pack/Source Code (logic and game mechanics).
- Consistent naming and parallel structure: Notice how similar features exist in both BP (often with compiled JavaScript files) and src (the original TypeScript files), which indicates a build process that compiles and syncs these modules.
- Event-driven / data flow design: Several event modules (e.g., on_hook_created, on_hook_item) indicate that the system reacts to in-game events, triggering various scripts.

##### Technology and frameworks
- Minecraft Bedrock Addon system: The entire project is built around enhancing and customizing Minecraft Bedrock’s FPS gameplay.
- JavaScript/TypeScript: The source code is primarily written in TypeScript (in src) and compiled to JavaScript (in BP/scripts). NodeJS build tools are likely in play (given the presence of package.json and tsconfig.json).
- Scripting and customization: The project uses custom configuration files (JSON) for items, entities, recipes, and loot tables that adhere to Minecraft’s asset format.

##### Elements
- Clear labels with descriptive names for each component (e.g., “Fishing System Module”, “Enchantment Module”, “Resource Pack – Models & Animations”, etc.).
- Annotations noting architectural patterns (modularity, event-driven design, separation of concerns) alongside the corresponding modules.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Top Level: Minecraft Engine
    Engine["Minecraft Engine"]:::engine

    %% Left side: Behavior Pack (BP)
    subgraph "Behavior Pack (BP)"
        BPmain["Behavior Pack"]:::bp
        BP_Fishing["Fishing System Module"]:::module
        BP_Enchant["Enchantment Module"]:::module
        BP_Commands["Command Handling Module"]:::module
        BP_Overrides["Overrides Module"]:::module
        BP_Utils["Utility Modules"]:::module
    end

    %% Right side: Resource Pack (RP)
    subgraph "Resource Pack (RP)"
        RP_Assets["Resource Pack – Visual Assets"]:::rp
    end

    %% Bottom Left: Source Code (src)
    subgraph "Source Code (src)"
        SRCmain["Source Code"]:::src
        SRC_Fishing["Fishing System Module"]:::module
        SRC_Enchant["Enchantment/Custom Enchantment Module"]:::module
        SRC_Commands["Command Handling Module"]:::module
        SRC_Overrides["Overrides Module"]:::module
        SRC_Utils["Utility Modules"]:::module
    end

    %% Bottom Right: Build & Development Tools and Additional Assets
    subgraph "Build & Dev & Assets"
        BuildTools["Build & Development Tools"]:::build
        AddAssets["Additional Assets & Configurations"]:::assets
    end

    %% Interconnections from Engine
    Engine -->|"loads"| BPmain
    Engine -->|"loadsVisuals"| RP_Assets
    Engine -->|"triggersHooks"| BP_Fishing
    Engine -->|"triggersCommands"| BP_Commands

    %% Relationships within Behavior Pack
    BPmain -->|"implements"| BP_Fishing
    BPmain -->|"integrates"| BP_Enchant
    BPmain -->|"processes"| BP_Commands
    BPmain -->|"patches"| BP_Overrides
    BPmain -->|"supports"| BP_Utils

    %% Relationships within Source Code
    SRCmain -->|"contains"| SRC_Fishing
    SRCmain -->|"contains"| SRC_Enchant
    SRCmain -->|"contains"| SRC_Commands
    SRCmain -->|"contains"| SRC_Overrides
    SRCmain -->|"contains"| SRC_Utils

    %% Build pipeline: compiling Source Code into Behavior Pack
    BuildTools -->|"builds"| SRCmain
    BuildTools -->|"syncs"| BPmain

    %% Linking Additional Assets to packs
    AddAssets -->|"configures"| BPmain
    AddAssets -->|"suppliesAssets"| RP_Assets

    %% Event-driven connection from BP Fishing to visuals
    BP_Fishing -->|"triggersVisuals"| RP_Assets

    %% Click Events for Component Mapping
    click BPmain "https://github.com/adr-hyng/anglers-desire/tree/main/BP/"
    click RP_Assets "https://github.com/adr-hyng/anglers-desire/tree/main/RP/"
    click SRCmain "https://github.com/adr-hyng/anglers-desire/tree/main/src/"
    click BuildTools "https://github.com/adr-hyng/anglers-desire/tree/main/tools/"
    click AddAssets "https://github.com/adr-hyng/anglers-desire/tree/main/mcip/"
    click BP_Fishing "https://github.com/adr-hyng/anglers-desire/tree/main/BP/scripts/fishing_system/"
    click SRC_Fishing "https://github.com/adr-hyng/anglers-desire/tree/main/src/fishing_system/"
    click BP_Enchant "https://github.com/adr-hyng/anglers-desire/tree/main/BP/scripts/enchantment_system/"
    click BP_Enchant "https://github.com/adr-hyng/anglers-desire/tree/main/BP/scripts/custom_enchantment/"
    click SRC_Enchant "https://github.com/adr-hyng/anglers-desire/tree/main/src/enchantment_system/"
    click SRC_Enchant "https://github.com/adr-hyng/anglers-desire/tree/main/src/custom_enchantment/"
    click BP_Commands "https://github.com/adr-hyng/anglers-desire/tree/main/BP/scripts/commands/"
    click SRC_Commands "https://github.com/adr-hyng/anglers-desire/tree/main/src/commands/"
    click BP_Overrides "https://github.com/adr-hyng/anglers-desire/tree/main/BP/scripts/overrides/"
    click SRC_Overrides "https://github.com/adr-hyng/anglers-desire/tree/main/src/overrides/"
    click BP_Utils "https://github.com/adr-hyng/anglers-desire/tree/main/BP/scripts/utils/"
    click SRC_Utils "https://github.com/adr-hyng/anglers-desire/tree/main/src/utils/"

    %% Styles
    classDef engine fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef bp fill:#b3e6ff,stroke:#333,stroke-width:2px;
    classDef rp fill:#caffbf,stroke:#333,stroke-width:2px;
    classDef src fill:#fff2b3,stroke:#333,stroke-width:2px;
    classDef build fill:#ffdab9,stroke:#333,stroke-width:2px;
    classDef assets fill:#e0bbff,stroke:#333,stroke-width:2px;
    classDef module fill:#ffe4c4,stroke:#333,stroke-width:2px;
```
