Build 1.21.10 with Stonecutter from the shared src/
Check / compile (pull_request) Successful in 7m13s
Check / compile (pull_request) Successful in 7m13s
Step 2 of #8. versions/1.21.10/src is gone; 1.21.10 builds from src/ as :1.21.10, with versions/1.21.10 keeping only gradle.properties and run/. API differences go behind version comments: render layers (ShaderUtils), Camera.update's World vs BlockView (CameraMixin), the text and textured-quad render states (RenderScopeImpl), Screen.init (SplashOverlayMixin) and jspecify's @NonNull (SaturnRenderState). Features 1.21.11 leaves out stay on 1.21.10, with a TODO for 1.21.11: WorldFeatureImpl.getWorldAge, SaturnScreenFabric.resize and EntityDrawerImpl clearing the hitbox. Hats now render on 1.21.10: its HatFeatureRenderer overrode the render-queue method with an empty body, and the working code sat in an old VertexConsumerProvider method nothing called. 1.21.10 now uses 1.21.11's render-queue implementation (HatFeatureRenderer, ObjModel, ObjRenderer), and also gets 1.21.11's null check on the player's display name. The 1.21.10 jar has the same entries, fabric.mod.json and mixin configs as before; only those four classes and ShaderUtils (a helper method for entityAlpha) have different bytecode. The 1.21.11 jar only differs in ShaderUtils. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+19
-4
@@ -7,8 +7,8 @@ How Saturn Client supports several Minecraft versions, and how to change or add
|
||||
Saturn is moving from one full copy of the version-specific code per Minecraft version to a single copy built with [Stonecutter](https://stonecutter.kikugie.dev/) (issue #8). During the move there are two kinds of version:
|
||||
|
||||
- `common/`: all version-independent code (mods, UI, cosmetics, the server client). It has no Minecraft dependency and reaches the game only through the interfaces in `org.saturnclient.common`.
|
||||
- `src/`: the version-specific code (providers, refs, mixins and the three mixin configs) for the versions built by Stonecutter, currently **1.21.11**. It's one copy: where Minecraft's API differs between them, the code goes behind version comments (see below). Each of these versions is the Gradle project `:<mc>`, and `versions/<mc>/` holds only its `gradle.properties` (Minecraft, Yarn, Fabric Loader and Fabric API versions), `build/` and `run/`.
|
||||
- `versions/<mc>/src/`: the versions not moved yet (1.21.4 to 1.21.10), each a full copy, as the Gradle project `:mc-<mc>` with its own `build.gradle`.
|
||||
- `src/`: the version-specific code (providers, refs, mixins and the three mixin configs) for the versions built by Stonecutter, currently **1.21.10 and 1.21.11**. It's one copy: where Minecraft's API differs between them, the code goes behind version comments (see below). Each of these versions is the Gradle project `:<mc>`, and `versions/<mc>/` holds only its `gradle.properties` (Minecraft, Yarn, Fabric Loader and Fabric API versions), `build/` and `run/`.
|
||||
- `versions/<mc>/src/`: the versions not moved yet (1.21.4 to 1.21.9), each a full copy, as the Gradle project `:mc-<mc>` with its own `build.gradle`.
|
||||
|
||||
`settings.gradle.kts` lists the Stonecutter versions in `stonecutterVersions` and includes every other folder under `versions/` as `:mc-<mc>`. The root `build.gradle.kts` builds each Stonecutter version, and `stonecutter.gradle.kts` configures the root project (shared repositories, the `common` wiring and `buildAll`). Loom's version for the Stonecutter versions is `loom_version` in the root `gradle.properties`.
|
||||
|
||||
@@ -20,9 +20,24 @@ The code in `src/` is always plain Java for the **active** version (1.21.11, set
|
||||
//? if >=1.21.9 {
|
||||
public void render(MatrixStack matrices, OrderedRenderCommandQueue queue, int light, PlayerEntityRenderState state, float limbAngle, float limbDistance) {
|
||||
//?} else
|
||||
/*public void render(MatrixStack matrices, VertexConsumerProvider consumers, int light, PlayerEntityRenderState state, float limbAngle, float limbDistance) {*/
|
||||
//public void render(MatrixStack matrices, VertexConsumerProvider consumers, int light, PlayerEntityRenderState state, float limbAngle, float limbDistance) {
|
||||
```
|
||||
|
||||
A condition without braces covers the next line only. For several lines, use braces and wrap the inactive block in `/* … */`:
|
||||
|
||||
```java
|
||||
//? if >=1.21.11 {
|
||||
import net.minecraft.client.render.RenderLayers;
|
||||
import net.minecraft.client.render.RenderSetup;
|
||||
//?} else {
|
||||
/*import net.minecraft.client.render.RenderPhase.Textures;
|
||||
*///?}
|
||||
```
|
||||
|
||||
Stonecutter rewrites inactive code into its own layout when switching versions (a single inactive line becomes `//code`), so write it that way to begin with, or run a switch and a reset before committing.
|
||||
|
||||
When a newer version leaves something out that an older one implements, keep the older version's code behind a condition and mark the newer branch with a `TODO`, rather than dropping it for every version. `WorldFeatureImpl.getWorldAge` and `SaturnScreenFabric.resize` are examples.
|
||||
|
||||
- `./gradlew "Set active project to <mc>"` (or the Stonecutter IntelliJ plugin) rewrites `src/` so that version's code is the uncommented one, for editing it in the IDE.
|
||||
- `./gradlew "Reset active project"` switches back to 1.21.11. **Run it before committing**, so `src/` is always committed with 1.21.11 active.
|
||||
- Each version's processed copy is compiled from `versions/<mc>/build/generated/stonecutter/`, which is also where to look when a non-active version fails to compile.
|
||||
@@ -36,7 +51,7 @@ Make the change in one version, usually the newest, then run:
|
||||
```sh
|
||||
scripts/port.sh # port uncommitted changes to every other version
|
||||
scripts/port.sh --dry-run # see what would apply cleanly first
|
||||
scripts/port.sh --to 1.21.9,1.21.10 # only some versions
|
||||
scripts/port.sh --to 1.21.8,1.21.9 # only some versions
|
||||
scripts/port.sh --commit <rev> # port what a commit changed instead
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user