# widz-a/gamemodedetector architecture

> Architecture diagram of the GitHub repository widz-a/gamemodedetector, 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/widz-a/gamemodedetector
- Repository: https://github.com/widz-a/gamemodedetector

## Overview

Gamemode Detector is a Fabric client mod that watches online players’ game modes and notifies the user when a change is observed. Its main workflow runs on client ticks: it compares each player’s current mode with remembered state, applies the enabled setting, formats a configured message, and displays it in chat or the action bar. Users can also query a mode with a client command and configure notification behavior through the keybind or ModMenu. The source excerpts show the main runtime and UI wiring; other resource metadata was not sampled.

Main entry points: [`src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java) (Tick monitor), [`src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java`](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java) (Mode query command), [`src/main/java/withicality/gamemodedetector/menu/TheConfig.java`](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/menu/TheConfig.java) (Notification settings), [`src/main/java/withicality/gamemodedetector/menu/ModMenu.java`](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/menu/ModMenu.java) (ModMenu settings entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitoring["Detection and messaging"]
  node_tick_monitor["Tick monitor"]
  node_mode_state[("Mode state")]
  node_message_format["Message formatting"]
  node_color_codes["Color codes<br/>[ChatColor.java]"]
end

subgraph group_controls["User controls"]
  node_command["Mode query command"]
  node_config["Notification settings<br/>[TheConfig.java]"]
  node_modmenu["ModMenu settings entry<br/>[ModMenu.java]"]
end

node_player(("Minecraft player"))
node_client(("Minecraft client"))
node_hud["Chat and action bar"]

node_client -->|"runs ticks"| node_tick_monitor
node_tick_monitor -->|"reads online modes"| node_player
node_tick_monitor -->|"compares and updates"| node_mode_state
node_tick_monitor -->|"checks settings"| node_config
node_tick_monitor -->|"builds notification"| node_message_format
node_message_format -->|"translates colors"| node_color_codes
node_tick_monitor -->|"displays notification"| node_hud
node_client -->|"registers command"| node_command
node_command -->|"queries mode"| node_mode_state
node_command -->|"builds query text"| node_message_format
node_command -->|"sends response"| node_hud
node_client -->|"registers settings"| node_config
node_client -->|"opens settings"| node_config
node_modmenu -->|"opens settings"| node_config

click node_tick_monitor "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java"
click node_mode_state "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java"
click node_message_format "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java"
click node_color_codes "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/ChatColor.java"
click node_command "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java"
click node_config "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/menu/TheConfig.java"
click node_modmenu "https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/menu/ModMenu.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_tick_monitor,node_mode_state,node_message_format,node_color_codes,node_client toneBlue
class node_command,node_config,node_modmenu toneAmber
class node_player,node_hud toneIndigo
```

## Components

### Detection and messaging

- [Tick monitor](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java): `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`
- [Mode state](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java): `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`
- [Message formatting](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java): `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`
- [Color codes](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/ChatColor.java): `src/main/java/withicality/gamemodedetector/ChatColor.java`

### User controls

- [Mode query command](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java): `src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java`
- [Notification settings](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/menu/TheConfig.java): `src/main/java/withicality/gamemodedetector/menu/TheConfig.java`
- [ModMenu settings entry](https://github.com/widz-a/gamemodedetector/blob/master/src/main/java/withicality/gamemodedetector/menu/ModMenu.java): `src/main/java/withicality/gamemodedetector/menu/ModMenu.java`

### Other components

- **Minecraft player**
- **Minecraft client**
- **Chat and action bar**

## Connections

- Minecraft client → Tick monitor: runs ticks (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Tick monitor → Minecraft player: reads online modes (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Tick monitor → Mode state: compares and updates (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Tick monitor → Notification settings: checks settings (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Tick monitor → Message formatting: builds notification (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Message formatting → Color codes: translates colors (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Tick monitor → Chat and action bar: displays notification (evidence: `src/main/java/withicality/gamemodedetector/GamemodeDetectorClient.java`)
- Minecraft client → Mode query command: registers command
- Mode query command → Mode state: queries mode (evidence: `src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java`)
- Mode query command → Message formatting: builds query text (evidence: `src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java`)
- Mode query command → Chat and action bar: sends response (evidence: `src/main/java/withicality/gamemodedetector/commands/CheckGamemodeCommand.java`)
- Minecraft client → Notification settings: registers settings
- Minecraft client → Notification settings: opens settings
- ModMenu settings entry → Notification settings: opens settings (evidence: `src/main/java/withicality/gamemodedetector/menu/ModMenu.java`)
