# rasyidrizky/nangor-valley architecture

> Architecture diagram of the GitHub repository rasyidrizky/nangor-valley, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rasyidrizky/nangor-valley
- Repository: https://github.com/rasyidrizky/nangor-valley

## Overview

Nangor Valley is a Java 2D farming-life simulation. The player-facing loop runs from keyboard input into the game panel and player, where movement and world interactions enable farming, inventory/tool use, travel, NPC relationships, fishing, and cooking; time and season/weather shape the simulation. The graph groups rendering/runtime coordination, world navigation, farming, player activities, and social/economic systems. README capabilities are retained, but several links are dashed because their implementation was not sampled; edges with evidence cite the README or an indexed excerpt showing the relationship.

Main entry points: [`src/entity/Player.java`](https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Player.java) (Player), [`src/main/GamePanel.java`](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/GamePanel.java) (Game Panel), [`src/tile/TileActionHandler.java`](https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/TileActionHandler.java) (Farm Tile Actions), [`src/main/KeyHandler.java`](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/KeyHandler.java) (Keyboard Input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_input["Keyboard Input<br/>[KeyHandler.java]"]
  node_game["Game Panel<br/>[GamePanel.java]"]
  node_time["Time &amp; Seasons<br/>[GameTime.java]"]
  node_time_thread["Time Thread<br/>[TimeThread.java]"]
  node_ui["Game UI<br/>[UI.java]"]
end

subgraph group_world["World Navigation"]
  node_tiles["Tile &amp; Map Manager<br/>[TileManager.java]"]
  node_travel["World Travel<br/>[EventHandler.java]"]
  node_entity["Entity Model<br/>[Entity.java]"]
end

subgraph group_farming["Farming"]
  node_tile_actions["Farm Tile Actions"]
  node_planted["Growing Crops<br/>[PlantedCrop.java]"]
  node_crops["Crop Items"]
  node_seeds["Seed Items"]
end

subgraph group_activities["Player Activities"]
  node_player["Player<br/>[Player.java]"]
  node_inventory["Inventory &amp; Tools<br/>[Inventory.java]"]
  node_fishing["Fishing"]
  node_recipes["Recipe Catalog"]
  node_cooking["Cooking"]
end

subgraph group_community["Community &amp; Economy"]
  node_npc["NPC Characters<br/>[Abigail.java]"]
  node_npc_handler["NPC Interactions<br/>[NPCHandler.java]"]
  node_market["Prices &amp; Selling<br/>[PriceBook.java]"]
end

node_actor(("Player"))

node_actor -.->|"presses keys"| node_input
node_input -->|"controls"| node_player
node_input -->|"chooses destination"| node_travel
node_game -->|"registers input"| node_input
node_game -->|"starts clock"| node_time_thread
node_game -->|"owns time state"| node_time
node_game -->|"owns map manager"| node_tiles
node_game -->|"owns tile handler"| node_tile_actions
node_game -->|"loads recipes"| node_recipes
node_game -.->|"renders interface"| node_ui
node_player -->|"extends model"| node_entity
node_entity -->|"checks collision"| node_player
node_travel -->|"teleports"| node_player
node_player -.->|"uses farm tiles"| node_tile_actions
node_tile_actions -->|"creates crop state"| node_planted
node_tile_actions -->|"creates harvest item"| node_crops
node_tile_actions -->|"handles planting"| node_seeds
node_player -->|"manages items"| node_inventory
node_player -->|"uses fishing areas"| node_fishing
node_recipes -.->|"provides recipes"| node_cooking
node_cooking -->|"consumes ingredients"| node_player
node_cooking -->|"creates output item"| node_entity
node_player -->|"gifts items"| node_npc_handler
node_npc_handler -->|"updates relationships"| node_npc
node_npc -->|"interacts with"| node_player
node_player -.->|"sells harvest"| node_market
node_actor -.->|"farms and explores"| node_player
node_actor -.->|"meets characters"| node_npc
node_actor -.->|"fishes"| node_fishing
node_actor -.->|"cooks food"| node_cooking

click node_player "https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Player.java"
click node_input "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/KeyHandler.java"
click node_game "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/GamePanel.java"
click node_time "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/GameTime.java"
click node_time_thread "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/TimeThread.java"
click node_ui "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/UI.java"
click node_tiles "https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/TileManager.java"
click node_travel "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/EventHandler.java"
click node_entity "https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Entity.java"
click node_tile_actions "https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/TileActionHandler.java"
click node_planted "https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/PlantedCrop.java"
click node_crops "https://github.com/rasyidrizky/nangor-valley/tree/main/src/object/Crops"
click node_seeds "https://github.com/rasyidrizky/nangor-valley/tree/main/src/object/Seeds"
click node_inventory "https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Inventory.java"
click node_fishing "https://github.com/rasyidrizky/nangor-valley/blob/main/src/object/OBJ_FishingArea.java"
click node_recipes "https://github.com/rasyidrizky/nangor-valley/blob/main/src/recipe/RecipeRegistry.java"
click node_cooking "https://github.com/rasyidrizky/nangor-valley/blob/main/src/recipe/CookingManager.java"
click node_npc "https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Abigail.java"
click node_npc_handler "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/NPCHandler.java"
click node_market "https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/PriceBook.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_input,node_game,node_time,node_time_thread,node_ui toneBlue
class node_tiles,node_travel,node_entity toneAmber
class node_tile_actions,node_planted,node_crops,node_seeds toneMint
class node_player,node_inventory,node_fishing,node_recipes,node_cooking toneRose
class node_npc,node_npc_handler,node_market,node_actor toneIndigo
```

## Components

### Game Runtime

- [Keyboard Input](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/KeyHandler.java): `src/main/KeyHandler.java`
- [Game Panel](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/GamePanel.java): `src/main/GamePanel.java`
- [Time & Seasons](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/GameTime.java): `src/main/GameTime.java`
- [Time Thread](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/TimeThread.java): `src/main/TimeThread.java`
- [Game UI](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/UI.java): `src/main/UI.java`

### World Navigation

- [Tile & Map Manager](https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/TileManager.java): `src/tile/TileManager.java`
- [World Travel](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/EventHandler.java): `src/main/EventHandler.java`
- [Entity Model](https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Entity.java): `src/entity/Entity.java`

### Farming

- [Farm Tile Actions](https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/TileActionHandler.java): `src/tile/TileActionHandler.java`
- [Growing Crops](https://github.com/rasyidrizky/nangor-valley/blob/main/src/tile/PlantedCrop.java): `src/tile/PlantedCrop.java`
- [Crop Items](https://github.com/rasyidrizky/nangor-valley/tree/main/src/object/Crops): `src/object/Crops`
- [Seed Items](https://github.com/rasyidrizky/nangor-valley/tree/main/src/object/Seeds): `src/object/Seeds`

### Player Activities

- [Player](https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Player.java): `src/entity/Player.java`
- [Inventory & Tools](https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Inventory.java): `src/entity/Inventory.java`
- [Fishing](https://github.com/rasyidrizky/nangor-valley/blob/main/src/object/OBJ_FishingArea.java): `src/object/OBJ_FishingArea.java`
- [Recipe Catalog](https://github.com/rasyidrizky/nangor-valley/blob/main/src/recipe/RecipeRegistry.java): `src/recipe/RecipeRegistry.java`
- [Cooking](https://github.com/rasyidrizky/nangor-valley/blob/main/src/recipe/CookingManager.java): `src/recipe/CookingManager.java`

### Community & Economy

- [NPC Characters](https://github.com/rasyidrizky/nangor-valley/blob/main/src/entity/Abigail.java): `src/entity/Abigail.java`
- [NPC Interactions](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/NPCHandler.java): `src/main/NPCHandler.java`
- [Prices & Selling](https://github.com/rasyidrizky/nangor-valley/blob/main/src/main/PriceBook.java): `src/main/PriceBook.java`

### Other components

- **Player**

## Connections

- Player → Keyboard Input: presses keys
- Keyboard Input → Player: controls (evidence: `src/main/KeyHandler.java`)
- Keyboard Input → World Travel: chooses destination (evidence: `src/main/KeyHandler.java`)
- Game Panel → Keyboard Input: registers input (evidence: `src/main/GamePanel.java`)
- Game Panel → Time Thread: starts clock (evidence: `src/main/GamePanel.java`)
- Game Panel → Time & Seasons: owns time state (evidence: `src/main/GamePanel.java`)
- Game Panel → Tile & Map Manager: owns map manager (evidence: `src/main/GamePanel.java`)
- Game Panel → Farm Tile Actions: owns tile handler (evidence: `src/main/GamePanel.java`)
- Game Panel → Recipe Catalog: loads recipes (evidence: `src/main/GamePanel.java`)
- Game Panel → Game UI: renders interface
- Player → Entity Model: extends model (evidence: `src/entity/Player.java`)
- Entity Model → Player: checks collision (evidence: `src/entity/Entity.java`)
- World Travel → Player: teleports (evidence: `src/main/EventHandler.java`)
- Player → Farm Tile Actions: uses farm tiles (evidence: `src/tile/TileActionHandler.java`)
- Farm Tile Actions → Growing Crops: creates crop state (evidence: `src/tile/TileActionHandler.java`)
- Farm Tile Actions → Crop Items: creates harvest item (evidence: `src/tile/TileActionHandler.java`)
- Farm Tile Actions → Seed Items: handles planting (evidence: `src/tile/TileActionHandler.java`)
- Player → Inventory & Tools: manages items (evidence: `src/entity/Player.java`)
- Player → Fishing: uses fishing areas (evidence: `src/object/OBJ_FishingArea.java`)
- Recipe Catalog → Cooking: provides recipes
- Cooking → Player: consumes ingredients (evidence: `src/recipe/CookingManager.java`)
- Cooking → Entity Model: creates output item (evidence: `src/recipe/CookingManager.java`)
- Player → NPC Interactions: gifts items
- NPC Interactions → NPC Characters: updates relationships (evidence: `src/main/NPCHandler.java`)
- NPC Characters → Player: interacts with (evidence: `src/entity/Abigail.java`)
- Player → Prices & Selling: sells harvest
- Player → Player: farms and explores
- Player → NPC Characters: meets characters
- Player → Fishing: fishes
- Player → Cooking: cooks food
