@@ -8,16 +8,17 @@ This document explains how to maintain multiple Minecraft versions in parallel u
88# From the main repo
99cd /Users/andrew/www/take-your-minestream
1010
11- # Create version branches (example scheme)
12- # 1.21.x covers 1.21 / 1.21.1 / 1.21.5 / 1.21.6 unless a break occurs
13- git checkout -b mc/ 1.21.x 1.21.7-8
14- git checkout -b mc/1.20.1
15- git checkout -b mc/1.16.5
11+ # Current version branches
12+ git checkout 1.21.7 # Main branch (latest)
13+ git checkout 1.21.4 # Minecraft 1.21.4 support
14+ git checkout 1.21 # Minecraft 1.21 support
15+ git checkout 1.21.1 # Minecraft 1.21.1 support
1616
1717# Add parallel worktrees (separate folders mapped to branches)
18- git worktree add /Users/andrew/www/take-your-minestream-1.21.x mc/1.21.x
19- git worktree add /Users/andrew/www/take-your-minestream-1.20.1 mc/1.20.1
20- git worktree add /Users/andrew/www/take-your-minestream-1.16.5 mc/1.16.5
18+ git worktree add /Users/andrew/www/take-your-minestream-1.21.7 1.21.7
19+ git worktree add /Users/andrew/www/take-your-minestream-1.21.4 1.21.4
20+ git worktree add /Users/andrew/www/take-your-minestream-1.21 1.21
21+ git worktree add /Users/andrew/www/take-your-minestream-1.21.1 1.21.1
2122
2223# Enable Git conflict learning (saves time on repeated conflicts)
2324git config --global rerere.enabled true
@@ -29,11 +30,12 @@ Open each worktree folder in your IDE to build/run that version independently.
2930
3031### Branch scheme
3132
32- - ` mc/1.21.x ` — mainline for 1.21.\* (single JAR if compatible across patches)
33- - ` mc/1.20.1 ` — dedicated branch for 1.20.1
34- - ` mc/1.16.5 ` — dedicated branch for 1.16.5
33+ - ` 1.21.7 ` — main branch (latest Minecraft version)
34+ - ` 1.21.4 ` — dedicated branch for Minecraft 1.21.4
35+ - ` 1.21 ` — dedicated branch for Minecraft 1.21
36+ - ` 1.21.1 ` — dedicated branch for Minecraft 1.21.1
3537
36- If a 1.21. \* patch introduces breaking changes, split further (e.g., ` mc/1.21.0-1.21.1 ` and ` mc/1.21.5+ ` ) .
38+ Each branch maintains its own version-specific dependencies and configurations while sharing common codebase .
3739
3840### Why git worktree
3941
@@ -43,7 +45,7 @@ If a 1.21.\* patch introduces breaking changes, split further (e.g., `mc/1.21.0-
4345
4446### Daily workflow
4547
46- 1 . Implement and commit in one branch (e.g., ` mc/ 1.21.x ` ).
48+ 1 . Implement and commit in one branch (e.g., ` 1.21.7 ` ).
47492 . Backport/forward-port the same change to other branches using ` cherry-pick ` :
4850
4951 ``` bash
@@ -65,7 +67,7 @@ Create a small script to repeat cherry-picks safely:
6567#! /usr/bin/env bash
6668set -euo pipefail
6769SHA=" $1 "
68- for BR in mc/1.20.1 mc/1.16.5 ; do
70+ for BR in 1.21.4 1.21 1.21.1 ; do
6971 git fetch origin " $BR "
7072 git checkout " $BR "
7173 if ! git cherry-pick -x " $SHA " ; then
@@ -83,16 +85,20 @@ Usage: `./backport.sh <commit_sha>`
8385Run from each worktree folder to avoid cross-contamination:
8486
8587``` bash
86- # Example: 1.21.x worktree
87- cd /Users/andrew/www/take-your-minestream-1.21.x
88+ # Example: 1.21.7 worktree
89+ cd /Users/andrew/www/take-your-minestream-1.21.7
8890./gradlew runClient
8991
90- # Example: 1.20.1 worktree
91- cd /Users/andrew/www/take-your-minestream-1.20.1
92+ # Example: 1.21.4 worktree
93+ cd /Users/andrew/www/take-your-minestream-1.21.4
9294./gradlew runClient
9395
94- # Example: 1.16.5 worktree
95- cd /Users/andrew/www/take-your-minestream-1.16.5
96+ # Example: 1.21 worktree
97+ cd /Users/andrew/www/take-your-minestream-1.21
98+ ./gradlew runClient
99+
100+ # Example: 1.21.1 worktree
101+ cd /Users/andrew/www/take-your-minestream-1.21.1
96102./gradlew runClient
97103```
98104
@@ -125,17 +131,33 @@ Note: The same branch cannot be checked out in two worktrees simultaneously.
125131### CI and releases
126132
127133- Build each branch in a matrix job; upload separate JARs with correct ` gameVersions ` on Modrinth.
128- - For 1.21.x, try a single artifact targeting ` ~ 1.21` if testing confirms compatibility.
129- - Tag the repo once (e.g., ` vX.Y.Z ` ); attach artifacts per branch/version line.
134+ - Each branch builds its own JAR with version-specific naming (e.g., ` tyms- 1.21.4-1.1.0.jar ` )
135+ - Tag the repo once (e.g., ` vX.Y.Z ` ); attach artifacts per branch/version line
130136
131137### IDE tips
132138
133139- Open each worktree as a separate project window.
134140- Assign run configurations per project (fast switching between versions).
135- - Use clear log tags (e.g., ` [TYMS-121] ` , ` [TYMS-120] ` ) to spot version-specific issues quickly.
141+ - Use clear log tags (e.g., ` [TYMS-121.7] ` , ` [TYMS-121.4] ` , ` [TYMS-121] ` , ` [TYMS-121.1] ` ) to spot version-specific issues quickly.
142+
143+ ### Building multiple versions simultaneously
144+
145+ With the updated ` build.gradle ` , each branch now creates uniquely named JARs:
146+
147+ ``` bash
148+ # Build all versions in parallel
149+ git checkout 1.21.7 && ./gradlew build & # Creates tyms-1.21.7-1.1.0.jar
150+ git checkout 1.21.4 && ./gradlew build & # Creates tyms-1.21.4-1.1.0.jar
151+ git checkout 1.21 && ./gradlew build & # Creates tyms-1.21-1.1.0.jar
152+ git checkout 1.21.1 && ./gradlew build & # Creates tyms-1.21.1-1.1.0.jar
153+ wait
154+ ```
155+
156+ All JARs will be available in ` build/libs/ ` without overwriting each other.
136157
137158### FAQ
138159
139160- "Can I use the same branch in two worktrees?" — No.
140161- "Can I convert an existing folder into a worktree?" — Create a new worktree and move files if needed; direct conversion isn’t supported.
141162- "Do worktrees duplicate the repo on disk?" — No, Git reuses objects; only working files are separate.
163+ - "How do I manage different Minecraft versions?" — Use separate branches for each version, each with its own dependencies and configurations.
0 commit comments