|
| 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 | +GregTech Lite (GTLite) is a Minecraft 1.12.2 Forge modpack centered around GregTech CE Unofficial (GTCEu). It uses **PackWiz** for mod management and distribution, **GroovyScript** for recipe customization, and **BetterQuesting** for progression. |
| 8 | + |
| 9 | +- Pack metadata: `pack.toml` (name, version, Minecraft/Forge versions) |
| 10 | +- File manifest: `index.toml` (SHA256 hashes of all packed files) |
| 11 | +- Mod definitions: `mods/*.pw.toml` (PackWiz metadata referencing CurseForge) |
| 12 | +- Three local JARs in `mods/`: `gregtech-*.jar` (GTCEu), `gtlitecore-*.jar` (custom core mod), `morphismlib-*.jar` (dependency library) |
| 13 | + |
| 14 | +## Development Environment |
| 15 | + |
| 16 | +Requires Nix. Enter the dev shell with: |
| 17 | +```bash |
| 18 | +nix develop |
| 19 | +``` |
| 20 | +This provides: JDK 8, tomlq (yq), packwiz, zip. |
| 21 | + |
| 22 | +## Common Commands |
| 23 | + |
| 24 | +```bash |
| 25 | +# Export CurseForge client package |
| 26 | +packwiz curseforge export -o dist/output.zip |
| 27 | + |
| 28 | +# Add a mod from CurseForge |
| 29 | +packwiz curseforge install <mod-slug> |
| 30 | + |
| 31 | +# Update a mod |
| 32 | +packwiz update <mod-name> |
| 33 | + |
| 34 | +# Refresh index.toml after file changes |
| 35 | +packwiz refresh |
| 36 | +``` |
| 37 | + |
| 38 | +## Architecture |
| 39 | + |
| 40 | +### GroovyScript Recipes (`groovy/`) |
| 41 | + |
| 42 | +Recipe loading is configured in `groovy/runConfig.json` with two phases: |
| 43 | +- **preInit**: `event/` (MaterialEventHandler, TooltipEventHandler), `util/` (GroovyUtil) |
| 44 | +- **postInit**: `loader/` — OreDictionaryLoader, `loader/hooks/`, `loader/recipe/` |
| 45 | + |
| 46 | +Each file in `loader/recipe/` handles recipe modifications for a specific mod (e.g., `AppliedEnergistics2.groovy`, `EnderIO.groovy`, `GregTech.groovy`). All recipes are redesigned to follow GregTech's philosophy. |
| 47 | + |
| 48 | +**Recipe syntax patterns:** |
| 49 | +- Machine recipes: `recipemap('assembler').recipeBuilder().inputs(...).outputs(...).duration(...).EUt(VA[LV]).buildAndRegister()` |
| 50 | +- Crafting: `crafting.addShapeless(...)`, `crafting.shapedBuilder(...).key(...).build()` |
| 51 | +- Item references: `metaitem('circuit.good')`, `ore('plateSteel')`, `item('minecraft:stone')`, `fluid('water')` |
| 52 | +- Energy tiers: `VA[ULV]` through `VA[MAX]`, duration constants like `SECOND` |
| 53 | + |
| 54 | +### Quest System (`config/betterquesting/DefaultQuests/`) |
| 55 | + |
| 56 | +- `QuestLines/*.json` — Quest line definitions (20 lines covering LV through MAX voltage tiers) |
| 57 | +- `Quests/<questline-id>/<quest-id>.json` — Individual quest data |
| 58 | + |
| 59 | +Quest JSON uses a NBT-like format with type suffixes: `:2` = short, `:3` = int, `:7` = byte array, `:8` = string, `:9` = tag list, `:10` = compound tag, `:11` = int array. |
| 60 | + |
| 61 | +### Config (`config/`) |
| 62 | + |
| 63 | +Mod configuration files. Key ones: |
| 64 | +- `gregtech/gregtech.cfg` — GregTech balance and features |
| 65 | +- `AppliedEnergistics2/AppliedEnergistics2.cfg` — AE2 settings |
| 66 | +- `betterquesting.cfg` — Quest UI and behavior |
| 67 | + |
| 68 | +### Resources (`resources/`) |
| 69 | + |
| 70 | +Resource pack overrides: custom textures, lang files, and JEI integration. Organized by mod namespace (e.g., `gregtech/`, `appliedenergistics2/`, `minecraft/`). |
| 71 | + |
| 72 | +## CI/CD |
| 73 | + |
| 74 | +Three GitHub Actions workflows (all use Nix dev shell): |
| 75 | + |
| 76 | +- **pr.yml** ("PR Build"): Triggered on PRs to `main`. Ignores docs-only changes. Uses PR number and short SHA in artifact names (e.g., `gregtech-lite-pr42-a1b2c3d-curseforge.zip`). Concurrency groups by PR number to cancel stale builds. 3-day artifact retention. |
| 77 | +- **nightly.yml**: Triggered on push to `main` (+ `workflow_dispatch`). Builds artifacts, deploys manifest to `GregTechLite/gregtechlite.github.io` under `nightly/`, generates changelog from git history, force-updates `nightly` tag, publishes prerelease. 7-day artifact retention. |
| 78 | +- **release.yml**: Triggered by `v*` tags. Validates tag matches `pack.toml` version, builds artifacts, deploys manifest to `releases/{VERSION}/`, publishes GitHub Release. |
| 79 | + |
| 80 | +### Build Scripts (`.github/scripts/`) |
| 81 | + |
| 82 | +- `meta.sh` — Extracts metadata from `pack.toml` via `tomlq` and exports to `$GITHUB_ENV`: `NAME`, `SLUG`, `VERSION`, `MINECRAFT_VERSION`, `FORGE_VERSION`, `SHORT_SHA` |
| 83 | +- `client.sh` — Runs `packwiz curseforge export` into `dist/` |
| 84 | +- `server.sh` — Downloads Forge installer + packwiz-installer-bootstrap, runs Forge install, generates start scripts from `.github/templates/` (`start.sh.in`, `start.bat.in`, `eula.txt`, `README.txt.in`), creates server ZIP |
| 85 | +- `manifest.sh` — Copies `pack.toml`, `index.toml`, and all indexed files to `dist/manifest/` for deployment |
| 86 | +- `changelog.sh` — Generates incremental nightly changelog by diffing from previous `nightly` tag or latest `v*` tag |
| 87 | + |
| 88 | +## File Exclusions |
| 89 | + |
| 90 | +`.packwizignore` excludes development-only files (docs/, .github/, flake.nix, CLAUDE.md, logo.png, IDE metadata, etc.) from pack exports. Only game-relevant files ship to players. |
| 91 | + |
| 92 | +## Licensing |
| 93 | + |
| 94 | +- Modpack code: GNU AGPL 3.0 |
| 95 | +- Assets: CC BY-NC-SA 3.0 |
| 96 | +- Questbook content: CC BY-NC-ND 3.0 |
0 commit comments