# bubi274/trainersworkshop architecture

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

- Interactive diagram: https://gitdiagram.com/bubi274/trainersworkshop
- Repository: https://github.com/bubi274/trainersworkshop

## Overview

Trainer’s Workshop is a server-authoritative Cobblemon addon for editing Pokémon and RCT trainers, plus a Shiny Berry item. Players use registered items to initiate interactions; editor actions travel between the client screen and server sessions, where edits are validated and applied or saved. Survival edits additionally charge inventory items. Trainer overrides affect later battles and persist across restarts; Raid Dens can optionally provide a Shiny Berry reward. The graph follows documented behavior and shown references; unsampled subsystem internals are represented only where the README or source index supports them.

Main entry points: [`src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt) (Mod Bootstrap), [`src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt`](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt) (Entity Interaction), [`src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt`](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt) (Editor Screen), [`src/main/kotlin/io/github/bubi274/trainersworkshop/registry/ModItems.kt`](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/registry/ModItems.kt) (Workshop Items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Mod and Items"]
  node_bootstrap["Mod Bootstrap"]
  node_items["Workshop Items<br/>[ModItems.kt]"]
end

subgraph group_interaction["Player Interactions"]
  node_interaction["Entity Interaction"]
  node_shiny["Shiny Berry<br/>[ShinyBerryItem.kt]"]
  node_traineritem["Trainer Editor Item"]
end

subgraph group_editor["Editor Workflow"]
  node_client["Client Editor<br/>[ClientEditor.kt]"]
  node_screen["Editor Screen<br/>[EditorScreen.kt]"]
  node_gui["GUI Components<br/>[GuiKit.kt]"]
  node_payloads["Editor Payloads<br/>[EditorPayloads.kt]"]
  node_sessions["Editor Sessions<br/>[EditorSessions.kt]"]
  node_pokemon["Pokémon Editing<br/>[PokemonEditing.kt]"]
  node_costs["Survival Costs<br/>[SurvivalCosts.kt]"]
end

subgraph group_trainers["Trainer Integration"]
  node_traineredit["Trainer Editing<br/>[TrainerEditing.kt]"]
  node_overrides[("Trainer Overrides")]
  node_rct["RCT Compatibility<br/>[RctCompat.kt]"]
end

subgraph group_integrations["Config and Integrations"]
  node_raid["Raid Dens Reward<br/>[RaidDensCompat.kt]"]
  node_config["Workshop Config<br/>[WorkshopConfig.kt]"]
end

node_player(("Player"))

node_bootstrap -->|"registers"| node_items
node_bootstrap -->|"registers"| node_interaction
node_bootstrap -->|"registers"| node_payloads
node_bootstrap -->|"registers"| node_sessions
node_bootstrap -->|"loads"| node_config
node_bootstrap -->|"registers"| node_raid
node_bootstrap -->|"initializes"| node_rct
node_player -->|"uses"| node_items
node_items -->|"targeted by"| node_interaction
node_interaction -->|"dispatches to"| node_shiny
node_interaction -->|"dispatches to"| node_traineritem
node_player -->|"right-clicks"| node_interaction
node_traineritem -->|"opens"| node_traineredit
node_client -->|"opens"| node_screen
node_screen -->|"sends actions"| node_client
node_screen -->|"renders with"| node_gui
node_client -->|"sends state requests"| node_payloads
node_sessions -->|"receives actions"| node_payloads
node_sessions -->|"validates and applies"| node_pokemon
node_pokemon -->|"uses costs"| node_costs
node_screen -->|"computes preview"| node_costs
node_traineredit -->|"saves changes"| node_overrides
node_traineredit -->|"reads trainer data"| node_rct
node_overrides -->|"supplies battle changes"| node_rct
node_raid -->|"reads reward chance"| node_config
node_raid -->|"adds berry reward"| node_items

click node_bootstrap "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt"
click node_items "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/registry/ModItems.kt"
click node_interaction "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt"
click node_shiny "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/item/ShinyBerryItem.kt"
click node_traineritem "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/item/TrainerEditorItem.kt"
click node_client "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/ClientEditor.kt"
click node_screen "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt"
click node_gui "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/GuiKit.kt"
click node_payloads "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/network/EditorPayloads.kt"
click node_sessions "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/EditorSessions.kt"
click node_pokemon "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/PokemonEditing.kt"
click node_costs "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/SurvivalCosts.kt"
click node_traineredit "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerEditing.kt"
click node_overrides "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerOverrides.kt"
click node_rct "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/compat/rct/RctCompat.kt"
click node_raid "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/compat/RaidDensCompat.kt"
click node_config "https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/config/WorkshopConfig.kt"

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_bootstrap,node_items toneBlue
class node_interaction,node_shiny,node_traineritem toneAmber
class node_client,node_screen,node_gui,node_payloads,node_sessions,node_pokemon,node_costs toneMint
class node_traineredit,node_overrides,node_rct toneRose
class node_raid,node_config,node_player toneIndigo
```

## Components

### Mod and Items

- [Mod Bootstrap](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`
- [Workshop Items](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/registry/ModItems.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/registry/ModItems.kt`

### Player Interactions

- [Entity Interaction](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt`
- [Shiny Berry](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/item/ShinyBerryItem.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/item/ShinyBerryItem.kt`
- [Trainer Editor Item](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/item/TrainerEditorItem.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/item/TrainerEditorItem.kt`

### Editor Workflow

- [Client Editor](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/ClientEditor.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/client/ClientEditor.kt`
- [Editor Screen](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt`
- [GUI Components](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/GuiKit.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/GuiKit.kt`
- [Editor Payloads](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/network/EditorPayloads.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/network/EditorPayloads.kt`
- [Editor Sessions](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/EditorSessions.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/EditorSessions.kt`
- [Pokémon Editing](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/PokemonEditing.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/PokemonEditing.kt`
- [Survival Costs](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/SurvivalCosts.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/SurvivalCosts.kt`

### Trainer Integration

- [Trainer Editing](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerEditing.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerEditing.kt`
- [Trainer Overrides](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerOverrides.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerOverrides.kt`
- [RCT Compatibility](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/compat/rct/RctCompat.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/compat/rct/RctCompat.kt`

### Config and Integrations

- [Raid Dens Reward](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/compat/RaidDensCompat.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/compat/RaidDensCompat.kt`
- [Workshop Config](https://github.com/bubi274/trainersworkshop/blob/main/src/main/kotlin/io/github/bubi274/trainersworkshop/config/WorkshopConfig.kt): `src/main/kotlin/io/github/bubi274/trainersworkshop/config/WorkshopConfig.kt`

### Other components

- **Player**

## Connections

- Mod Bootstrap → Workshop Items: registers (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Mod Bootstrap → Entity Interaction: registers (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Mod Bootstrap → Editor Payloads: registers (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Mod Bootstrap → Editor Sessions: registers (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Mod Bootstrap → Workshop Config: loads (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Mod Bootstrap → Raid Dens Reward: registers (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Mod Bootstrap → RCT Compatibility: initializes (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/TrainersWorkshop.kt`)
- Player → Workshop Items: uses (evidence: `README.md`)
- Workshop Items → Entity Interaction: targeted by (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt`)
- Entity Interaction → Shiny Berry: dispatches to (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt`)
- Entity Interaction → Trainer Editor Item: dispatches to (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/interaction/PokemonInteractionHandler.kt`)
- Player → Entity Interaction: right-clicks (evidence: `README.md`)
- Trainer Editor Item → Trainer Editing: opens (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/item/TrainerEditorItem.kt`)
- Client Editor → Editor Screen: opens (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/client/ClientEditor.kt`)
- Editor Screen → Client Editor: sends actions (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt`)
- Editor Screen → GUI Components: renders with (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt`)
- Client Editor → Editor Payloads: sends state requests (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/client/ClientEditor.kt`)
- Editor Sessions → Editor Payloads: receives actions (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/EditorSessions.kt`)
- Editor Sessions → Pokémon Editing: validates and applies (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/EditorSessions.kt`)
- Pokémon Editing → Survival Costs: uses costs (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/PokemonEditing.kt`)
- Editor Screen → Survival Costs: computes preview (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/client/gui/EditorScreen.kt`)
- Trainer Editing → Trainer Overrides: saves changes (evidence: `README.md`)
- Trainer Editing → RCT Compatibility: reads trainer data (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/editor/TrainerEditing.kt`)
- Trainer Overrides → RCT Compatibility: supplies battle changes (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/compat/rct/RctAccess.kt`)
- Raid Dens Reward → Workshop Config: reads reward chance (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/compat/RaidDensCompat.kt`)
- Raid Dens Reward → Workshop Items: adds berry reward (evidence: `src/main/kotlin/io/github/bubi274/trainersworkshop/compat/RaidDensCompat.kt`)
