Port multiloader build to Fabric and Forge 1.20.1
Build / build (push) Failing after 2h50m17s

This commit is contained in:
f1den
2026-07-05 18:36:57 +03:00
parent c11a278050
commit 8bc92b2341
25 changed files with 136 additions and 331 deletions
+41 -93
View File
@@ -1,109 +1,57 @@
# skinsg multiloader / multiversion build guide
# skinsg multiloader notes
Branch `multiloader`. Converts the single-loader NeoForge project into an
**Architectury** project building **Fabric + Forge + NeoForge** from one codebase.
MC version is chosen in `gradle.properties` (default **1.21.1**; switch to **1.20.1**
for the Create To Exile 2 Forge pack — see below).
Branch `multiloader` builds the mod for **Minecraft 1.20.1** on **Fabric** and **Forge** from one
shared `common` source set.
`main` is untouched (still the working NeoForge 1.21.1 build).
`main` remains the original single-loader NeoForge 1.21.1 line.
## 0. One-time restructure
From the repo root on the `multiloader` branch:
```bash
bash migrate-to-multiloader.sh
```
This `git mv`s the loader/version-agnostic code (`SkinsgConfig`, `gif/`, `client/`,
`mixin/`, `skinsg.mixins.json`) into `common/`, and removes the old NeoForge entry +
metadata (recreated per-loader). The new files (already committed on this branch):
- `common/…/SkinsgClient.java`, `common/…/commands/SkinsgCommands.java` (generic over source type)
- `fabric|forge|neoforge/…/Skinsg{Fabric,Forge,NeoForge}.java` + their mod metadata.
## Layout
## 1. Toolchain (important)
- **Gradle 8.10.2** — wrapper already pinned (Architectury Loom does NOT support Gradle 9).
- **JDK 21** for 1.21.1 (JDK 17 for 1.20.1). Gradle toolchains auto-pick Liberica 21/17 if installed.
- **Internet/proxy**: Gradle must reach `maven.architectury.dev`, `maven.fabricmc.net`,
`maven.minecraftforge.net`, `maven.neoforged.net`, `maven.parchmentmc.org`. If direct
fails on this network, add to `~/.gradle/gradle.properties`:
```
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1080
```
(CI already sets the internal `172.21.5.18:1080` proxy.)
- Plugin versions in root `build.gradle` are `architectury-plugin 3.4-SNAPSHOT` /
`dev.architectury.loom 1.7-SNAPSHOT`. If a SNAPSHOT won't resolve, pin the current
release from maven.architectury.dev (e.g. loom `1.7.4`, plugin `3.4.159`).
- `common/` - shared config, GIF decoder, cape manager, mixins, and generic Brigadier command tree.
- `fabric/` - Fabric client entrypoint and `fabric.mod.json`.
- `forge/` - Forge client entrypoint and `mods.toml`.
- `neoforge/` - retained scaffold, but not included in `enabled_platforms` for the 1.20.1 build.
The old single-loader `src/` tree has been migrated into `common/`; do not run the migration helper
again on this branch.
## Versions
Configured in `gradle.properties`:
- Minecraft `1.20.1`
- Architectury API `9.2.14`
- Fabric Loader `0.16.9`
- Fabric API `0.92.5+1.20.1`
- Forge `1.20.1-47.4.10`
- Parchment `2023.09.03`
- Java `17`
## Build
## 2. Build
```bash
./gradlew build
```
Output jars (the ones WITHOUT a classifier):
- `fabric/build/libs/skinsg-fabric-0.1.0.jar`
- `forge/build/libs/skinsg-forge-0.1.0.jar`
- `neoforge/build/libs/skinsg-neoforge-0.1.0.jar`
Dev test: `./gradlew :neoforge:runClient` (or `:fabric:`, `:forge:`).
Runtime jars are collected into:
## 3. Switch to 1.20.1 (what CtE2 needs: Forge 1.20.1)
CtE2 = Forge **1.20.1-47.4.10**. Do this on a `multiloader-1.20.1` branch (or flip props):
- `build/libs/skinsg-fabric-0.1.0.jar`
- `build/libs/skinsg-forge-0.1.0.jar`
### a) `gradle.properties`
```
minecraft_version=1.20.1
minecraft_version_range=[1.20.1]
parchment_minecraft=1.20.1
parchment_version=2023.09.03
architectury_api_version=9.2.14
fabric_loader_version=0.16.9
fabric_api_version=0.92.5+1.20.1
forge_version=1.20.1-47.4.10
neoforge_version=47.1.106 # 1.20.1 NeoForge (only if you build the neoforge target too)
```
### b) mixins: JAVA_17
In `common/…/resources/skinsg.mixins.json` set `"compatibilityLevel": "JAVA_17"`.
The per-loader `build/libs` folders still contain intermediate/source/dev-shadow jars.
### c) metadata version ranges → `[1.20,1.21)`, and `java >=17` in fabric.mod.json,
`loaderVersion="[47,)"` + `forge`/`minecraft` ranges in `forge/…/mods.toml`.
## 1.20.1 port details
### d) CapeMagicMixin — **rewrite** (1.20.1 has no `PlayerSkin`)
1.20.1 exposes the cape as a `ResourceLocation`, so target `getCloakTextureLocation`
instead of `getSkin`. Replace `common/…/mixin/CapeMagicMixin.java` with:
```java
package xyz.nightsync.skinsg.mixin;
- `CapeMagicMixin` targets `AbstractClientPlayer#getCloakTextureLocation`, because 1.20.1 does not
expose the 1.21 `PlayerSkin` return object.
- `CapeManager` uses the 1.20.1 `new ResourceLocation(namespace, path)` constructor.
- `skinsg.mixins.json` uses `JAVA_17`.
- `settings.gradle` includes only platforms listed in `enabled_platforms`.
import com.mojang.authlib.GameProfile;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import xyz.nightsync.skinsg.client.CapeManager;
## Manual runtime checks
@Mixin(AbstractClientPlayer.class)
public abstract class CapeMagicMixin {
@Inject(method = "getCloakTextureLocation", at = @At("RETURN"), cancellable = true)
private void skinsg$overrideCape(CallbackInfoReturnable<ResourceLocation> cir) {
GameProfile profile = ((AbstractClientPlayer) (Object) this).getGameProfile();
ResourceLocation animated = CapeManager.getCape(profile.getId());
if (animated != null) cir.setReturnValue(animated);
}
}
```
`SkinMagicMixin` (HttpTexture.processLegacySkin) targets the same method on 1.20.1 —
should compile unchanged; verify the two `@Shadow` helper names still exist in 1.20.1 mappings.
Compile/build is verified, but actual rendering still needs an in-game client check:
### e) CapeManager — one line
`ResourceLocation.fromNamespaceAndPath(MODID, ...)` (1.21 only) → `new ResourceLocation(MODID, ...)` on 1.20.1.
### f) build → `forge/build/libs/skinsg-forge-0.1.0.jar` → drop into
`/srv/nightsyncweb/launcher/data/updates/CreateToExile2/mods/` (remove the current
NeoForge jar first), then on .12: `glperms sync`.
## Known TODO / verify-in-game (this is the part only you can confirm)
- Mixin targets/`@Shadow` names against the actual 1.20.1 vs 1.21.1 Mojmap+Parchment mappings.
- Forge 1.21.1 (52.x) `TickEvent.ClientTickEvent` import path (kept the 1.20/1.21 Forge API).
- Architectury/Loom exact plugin+API versions (bump if resolve fails).
- Actual cape/skin rendering — launch each target and look.
- Fabric 1.20.1 with Fabric API and Architectury API.
- Forge 1.20.1-47.4.10 with Architectury API.
- A configured `config/skinsg.json` `baseUrl` serving `GET /api/minecraft/cape/<uuid>?gif`.