Multiloader scaffold: Architectury common+fabric+forge+neoforge (1.21.1)
Convert the single-loader NeoForge project into an Architectury multiloader: - root/settings/subproject build.gradle, Gradle pinned to 8.10.2 (Loom needs 8.x) - common: generic SkinsgCommands<S> + SkinsgClient bootstrap - per-loader entrypoints (Fabric ClientModInitializer, Forge/NeoForge @Mod) + metadata - migrate-to-multiloader.sh moves the loader/version-agnostic core into common/ - MULTILOADER.md: build/toolchain/proxy + 1.20.1 switch incl. rewritten cape mixin main (working NeoForge 1.21.1) untouched.
This commit is contained in:
+109
@@ -0,0 +1,109 @@
|
||||
# skinsg — multiloader / multiversion build guide
|
||||
|
||||
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).
|
||||
|
||||
`main` is untouched (still the working NeoForge 1.21.1 build).
|
||||
|
||||
## 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.
|
||||
|
||||
## 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`).
|
||||
|
||||
## 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:`).
|
||||
|
||||
## 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):
|
||||
|
||||
### 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"`.
|
||||
|
||||
### c) metadata version ranges → `[1.20,1.21)`, and `java >=17` in fabric.mod.json,
|
||||
`loaderVersion="[47,)"` + `forge`/`minecraft` ranges in `forge/…/mods.toml`.
|
||||
|
||||
### 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;
|
||||
|
||||
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;
|
||||
|
||||
@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.
|
||||
|
||||
### 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.
|
||||
Reference in New Issue
Block a user