|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +ExtraSounds Next is a Minecraft mod that adds UI sounds (clicks, scrolls, typing, inventory interactions, etc.) to the game. It supports multiple Minecraft versions (1.18.2 through 1.21.1) and multiple mod loaders (Fabric, NeoForge, Legacy Forge) from a single codebase using Stonecutter. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Build all versions |
| 13 | +./gradlew buildAndCollect --no-daemon |
| 14 | + |
| 15 | +# Build specific version+platform |
| 16 | +./gradlew :1.21.1-fabric:build |
| 17 | +./gradlew :1.21.1-neoforge:build |
| 18 | +./gradlew :1.20.1-forge:build |
| 19 | + |
| 20 | +# Run Fabric client in dev |
| 21 | +./gradlew :1.21.1-fabric:runClient |
| 22 | + |
| 23 | +# Run data generation |
| 24 | +./gradlew :1.21.1-fabric:runDatagen |
| 25 | + |
| 26 | +# Publish a specific version to Modrinth |
| 27 | +./gradlew publish1.21.1 |
| 28 | +``` |
| 29 | + |
| 30 | +## Supported Versions Matrix |
| 31 | + |
| 32 | +| MC Version | Fabric | NeoForge | Legacy Forge | |
| 33 | +|------------|--------|----------|--------------| |
| 34 | +| 1.21.1 | yes | yes | - | |
| 35 | +| 1.20.1 | yes | - | yes | |
| 36 | +| 1.19.4 | yes | - | yes | |
| 37 | +| 1.19.2 | yes | - | yes | |
| 38 | +| 1.18.2 | yes | - | yes | |
| 39 | + |
| 40 | +Configured in `settings.gradle.kts`. VCS version is `1.21.1-fabric`. Active Stonecutter version is tracked in `.sc_active_version`. |
| 41 | + |
| 42 | +## Architecture |
| 43 | + |
| 44 | +### Stonecutter Conditional Compilation |
| 45 | + |
| 46 | +Platform-specific code uses Stonecutter comment directives. The "active" platform's code is uncommented; others are wrapped in block comments: |
| 47 | + |
| 48 | +```java |
| 49 | +//? if fabric { |
| 50 | +/*fabricCode();*/ |
| 51 | +//?} else { |
| 52 | +neoforgeOrForgeCode(); |
| 53 | +//?} |
| 54 | +``` |
| 55 | + |
| 56 | +Platform constants (`fabric`, `neoforge`, `forge`) are set in `stonecutter.gradle.kts` based on the project name suffix. String replacements handle API differences (e.g., `ResourceLocation` vs `Identifier` for 1.21.11+). |
| 57 | + |
| 58 | +### Build System |
| 59 | + |
| 60 | +- **Stonecutter 0.8.3** orchestrates multi-version/multi-loader builds |
| 61 | +- **build-logic/** contains a custom Gradle plugin (`mod-platform`) that handles platform-specific jar naming, access transformers, dependency declaration for Modrinth/CurseForge, and resource processing |
| 62 | +- Per-platform build scripts: `build.fabric.gradle.kts`, `build.neoforge.gradle.kts`, `build.forge.gradle.kts` |
| 63 | +- Version-specific properties in `versions/{version}-{platform}/gradle.properties` override `[VERSIONED]` placeholders from root `gradle.properties` |
| 64 | + |
| 65 | +### Source Structure (package: `dev.arbor.extrasoundsnext`) |
| 66 | + |
| 67 | +- **`ExtraSoundsNext.java`** — Core entry point with platform-abstracted utilities (`getLoader()`, `isClient()`, `isModLoaded()`) via Stonecutter conditionals |
| 68 | +- **`platform/fabric/`** — Fabric entry points using Fletching Table annotations |
| 69 | +- **`platform/neoforge/`** — NeoForge/Forge entry point with `@Mod` annotation |
| 70 | +- **`mapping/`** — Sound pack loading (`SoundPackLoader`), auto-generation (`DefaultAutoGenerator`), and addon framework (`SoundGenerator`) |
| 71 | +- **`sounds/`** — Sound playback (`SoundManager`), predefined sounds (`Sounds`), categories (`Categories`), volume mixing (`Mixers`) |
| 72 | +- **`mixin/`** — ~20 mixin classes organized by game system: `core/`, `gui/`, `hotbar/`, `inventory/`, `chat/`, `typing/`, `action/`, `misc/`, `screens/` |
| 73 | +- **`annotation/`** — Addon discovery framework (`@SoundsGenerator`, `ISoundsGenerator`, `AddonFinder`) |
| 74 | +- **`gui/`** — Custom sound settings screens |
| 75 | +- **`json/`** — Sound definition serialization |
| 76 | + |
| 77 | +### Sound Generation Framework |
| 78 | + |
| 79 | +Third-party mods can provide custom sounds via the `@SoundsGenerator` annotation on classes implementing `ISoundsGenerator`. The `AddonFinder` discovers these at runtime. `DefaultAutoGenerator` handles vanilla items/blocks by mapping material types to sounds. |
| 80 | + |
| 81 | +### Access Transformers |
| 82 | + |
| 83 | +- Fabric: `src/main/resources/aw/{version}.accesswidener` |
| 84 | +- Forge/NeoForge: autogen by accesswidener |
| 85 | + |
| 86 | +### Mixin Configuration |
| 87 | + |
| 88 | +Defined in `src/main/resources/extrasounds.mixins.json`. Uses Fletching Table for annotation-driven mixin registration. |
| 89 | + |
| 90 | +## Key Files |
| 91 | + |
| 92 | +| File | Purpose | |
| 93 | +|------|---------| |
| 94 | +| `settings.gradle.kts` | Version/loader matrix definition | |
| 95 | +| `stonecutter.gradle.kts` | Stonecutter parameters, swaps, constants | |
| 96 | +| `gradle.properties` | Mod metadata and `[VERSIONED]` dependency placeholders | |
| 97 | +| `build-logic/` | Custom `mod-platform` Gradle plugin | |
| 98 | +| `versions/*/gradle.properties` | Per-version dependency versions | |
0 commit comments