# a-team-pjnceadc/autoemc-gtnh architecture

> Architecture diagram of the GitHub repository a-team-pjnceadc/autoemc-gtnh, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/a-team-pjnceadc/autoemc-gtnh
- Repository: https://github.com/a-team-pjnceadc/autoemc-gtnh

## Overview

AutoEMC-GTNH is a ProjectE add-on that fills in missing EMC prices for Minecraft/GTNH items. Its main workflow scans crafting, smelting, and machine recipes; recursively selects and prices production paths while preserving existing prices; then caches and registers the results with ProjectE. Players can inspect a selected item’s price and aligned recipe tree with a command. The README documents important pricing rules and optional integrations; some implementation links below rely on that documentation because their source was not excerpted.

Main entry points: [`src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcRunner.java) (Compute and publish), [`src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java`](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java) (Recipe collector), [`src/main/java/com/gtnh/autoemc/emc/EmcEngine.java`](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcEngine.java) (Recursive evaluator), [`src/main/java/com/gtnh/autoemc/emc/GtMachines.java`](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/GtMachines.java) (GT machine scan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Startup and API"]
  node_server["Server lifecycle<br/>[MyMod.java]"]
  node_config["Pricing config<br/>[AutoEmcConfig.java]"]
end

subgraph group_recipes["Recipe discovery"]
  node_recipe_api["Recipe source API<br/>[RecipeSource.java]"]
  node_recipe_collect["Recipe collector"]
  node_gt_scan["GT machine scan<br/>[GtMachines.java]"]
  node_recipe_scan["Recipe scan API<br/>[RecipeScan.java]"]
  node_recipe_model["Recipe model<br/>[EmcRecipe.java]"]
end

subgraph group_pricing["EMC pricing"]
  node_item_key["Item identity<br/>[ItemKey.java]"]
  node_engine["Recursive evaluator<br/>[EmcEngine.java]"]
  node_math["Cost arithmetic<br/>[EmcMath.java]"]
  node_fluid["Fluid pricing<br/>[FluidProducer.java]"]
  node_runner["Compute and publish<br/>[EmcRunner.java]"]
  node_cache[("Value and chain cache<br/>[ValueStore.java]")]
end

subgraph group_registration["Price registration"]
  node_projecte["ProjectE mapper"]
  node_px_compat["Expansion bridge"]
  node_registry_api["EMC registry API<br/>[EmcKey.java]"]
  node_registry_impl["Registry implementation"]
  node_type_bridge["Type table bridge"]
  node_mixin["Mapper mixin"]
end

subgraph group_tree["Recipe tree viewing"]
  node_command["View command"]
  node_network["Tree chain network"]
  node_tree_client["Client tree opener"]
end

node_player(("Player"))
node_gtnh[("GTNH recipes")]
node_nei["NEI RecipeTree"]

node_server -->|"starts pricing"| node_runner
node_runner -->|"collects recipes"| node_recipe_collect
node_recipe_collect -->|"uses sources"| node_recipe_api
node_recipe_collect -->|"scans machines"| node_gt_scan
node_gt_scan -.->|"reads recipes"| node_gtnh
node_recipe_collect -->|"iterates recipes"| node_recipe_scan
node_recipe_collect -->|"builds producers"| node_recipe_model
node_runner -->|"evaluates prices"| node_engine
node_engine -->|"keys items"| node_item_key
node_engine -->|"prices candidates"| node_recipe_model
node_engine -->|"calculates costs"| node_math
node_engine -->|"resolves fluids"| node_fluid
node_runner -->|"reads settings"| node_config
node_runner -->|"loads and saves"| node_cache
node_runner -->|"registers prices"| node_projecte
node_runner -->|"registers optionally"| node_px_compat
node_runner -->|"uses registry"| node_registry_api
node_registry_api -->|"delegates to"| node_registry_impl
node_registry_impl -->|"mirrors values"| node_type_bridge
node_mixin -->|"notifies table"| node_type_bridge
node_player -->|"requests view"| node_command
node_command -->|"sends chain"| node_network
node_network -->|"delivers chain"| node_tree_client
node_tree_client -.->|"opens aligned tree"| node_nei

click node_server "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/MyMod.java"
click node_config "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/AutoEmcConfig.java"
click node_recipe_api "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/api/recipe/RecipeSource.java"
click node_recipe_collect "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java"
click node_gt_scan "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/GtMachines.java"
click node_recipe_scan "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/api/recipe/RecipeScan.java"
click node_recipe_model "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcRecipe.java"
click node_item_key "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/ItemKey.java"
click node_engine "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcEngine.java"
click node_math "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcMath.java"
click node_fluid "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/FluidProducer.java"
click node_runner "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcRunner.java"
click node_cache "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/ValueStore.java"
click node_px_compat "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/compat/ProjectExpansionCompat.java"
click node_registry_api "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/api/registry/EmcKey.java"
click node_registry_impl "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/registry/EmcRegistryImpl.java"
click node_type_bridge "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/registry/TypeTableBridge.java"
click node_mixin "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/mixins/late/EmcMapperTypeMixin.java"
click node_command "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/command/CommandProjecteAutoEmc.java"
click node_network "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/net/ChannelAutoEmc.java"
click node_tree_client "https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/client/RecipeTreeOpener.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_server,node_config toneBlue
class node_recipe_api,node_recipe_collect,node_gt_scan,node_recipe_scan,node_recipe_model,node_gtnh toneAmber
class node_item_key,node_engine,node_math,node_fluid,node_runner,node_cache toneMint
class node_projecte,node_px_compat,node_registry_api,node_registry_impl,node_type_bridge,node_mixin toneRose
class node_command,node_network,node_tree_client,node_player,node_nei toneIndigo
```

## Components

### Startup and API

- [Server lifecycle](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/MyMod.java): `src/main/java/com/gtnh/autoemc/MyMod.java`
- [Pricing config](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/AutoEmcConfig.java): `src/main/java/com/gtnh/autoemc/emc/AutoEmcConfig.java`

### Recipe discovery

- [Recipe source API](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/api/recipe/RecipeSource.java): `src/main/java/com/gtnh/autoemc/api/recipe/RecipeSource.java`
- [Recipe collector](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java): `src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java`
- [GT machine scan](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/GtMachines.java): `src/main/java/com/gtnh/autoemc/emc/GtMachines.java`
- [Recipe scan API](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/api/recipe/RecipeScan.java): `src/main/java/com/gtnh/autoemc/api/recipe/RecipeScan.java`
- [Recipe model](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcRecipe.java): `src/main/java/com/gtnh/autoemc/emc/EmcRecipe.java`

### EMC pricing

- [Item identity](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/ItemKey.java): `src/main/java/com/gtnh/autoemc/emc/ItemKey.java`
- [Recursive evaluator](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcEngine.java): `src/main/java/com/gtnh/autoemc/emc/EmcEngine.java`
- [Cost arithmetic](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcMath.java): `src/main/java/com/gtnh/autoemc/emc/EmcMath.java`
- [Fluid pricing](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/FluidProducer.java): `src/main/java/com/gtnh/autoemc/emc/FluidProducer.java`
- [Compute and publish](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/EmcRunner.java): `src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`
- [Value and chain cache](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/emc/ValueStore.java): `src/main/java/com/gtnh/autoemc/emc/ValueStore.java`

### Price registration

- **ProjectE mapper**
- [Expansion bridge](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/compat/ProjectExpansionCompat.java): `src/main/java/com/gtnh/autoemc/compat/ProjectExpansionCompat.java`
- [EMC registry API](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/api/registry/EmcKey.java): `src/main/java/com/gtnh/autoemc/api/registry/EmcKey.java`
- [Registry implementation](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/registry/EmcRegistryImpl.java): `src/main/java/com/gtnh/autoemc/registry/EmcRegistryImpl.java`
- [Type table bridge](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/registry/TypeTableBridge.java): `src/main/java/com/gtnh/autoemc/registry/TypeTableBridge.java`
- [Mapper mixin](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/mixins/late/EmcMapperTypeMixin.java): `src/main/java/com/gtnh/autoemc/mixins/late/EmcMapperTypeMixin.java`

### Recipe tree viewing

- [View command](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/command/CommandProjecteAutoEmc.java): `src/main/java/com/gtnh/autoemc/command/CommandProjecteAutoEmc.java`
- [Tree chain network](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/net/ChannelAutoEmc.java): `src/main/java/com/gtnh/autoemc/net/ChannelAutoEmc.java`
- [Client tree opener](https://github.com/a-team-pjnceadc/autoemc-gtnh/blob/main/src/main/java/com/gtnh/autoemc/client/RecipeTreeOpener.java): `src/main/java/com/gtnh/autoemc/client/RecipeTreeOpener.java`

### Other components

- **Player**
- **GTNH recipes**
- **NEI RecipeTree**

## Connections

- Server lifecycle → Compute and publish: starts pricing (evidence: `src/main/java/com/gtnh/autoemc/MyMod.java`)
- Compute and publish → Recipe collector: collects recipes (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`)
- Recipe collector → Recipe source API: uses sources (evidence: `src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java`)
- Recipe collector → GT machine scan: scans machines (evidence: `src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java`)
- GT machine scan → GTNH recipes: reads recipes (evidence: `README.md`)
- Recipe collector → Recipe scan API: iterates recipes (evidence: `src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java`)
- Recipe collector → Recipe model: builds producers (evidence: `src/main/java/com/gtnh/autoemc/emc/RecipeCollector.java`)
- Compute and publish → Recursive evaluator: evaluates prices (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`)
- Recursive evaluator → Item identity: keys items (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcEngine.java`)
- Recursive evaluator → Recipe model: prices candidates (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcEngine.java`)
- Recursive evaluator → Cost arithmetic: calculates costs (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcEngine.java`)
- Recursive evaluator → Fluid pricing: resolves fluids (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcEngine.java`)
- Compute and publish → Pricing config: reads settings (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`)
- Compute and publish → Value and chain cache: loads and saves (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`)
- Compute and publish → ProjectE mapper: registers prices (evidence: `README.md`)
- Compute and publish → Expansion bridge: registers optionally (evidence: `src/main/java/com/gtnh/autoemc/emc/EmcRunner.java`)
- Compute and publish → EMC registry API: uses registry
- EMC registry API → Registry implementation: delegates to (evidence: `src/main/java/com/gtnh/autoemc/registry/EmcRegistryImpl.java`)
- Registry implementation → Type table bridge: mirrors values (evidence: `src/main/java/com/gtnh/autoemc/registry/EmcRegistryImpl.java`)
- Mapper mixin → Type table bridge: notifies table (evidence: `src/main/java/com/gtnh/autoemc/mixins/late/EmcMapperTypeMixin.java`)
- Player → View command: requests view (evidence: `README.md`)
- View command → Tree chain network: sends chain (evidence: `src/main/java/com/gtnh/autoemc/command/CommandProjecteAutoEmc.java`)
- Tree chain network → Client tree opener: delivers chain
- Client tree opener → NEI RecipeTree: opens aligned tree (evidence: `README.md`)
