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

This commit is contained in:
f1den committed 2026-07-05 18:36:57 +03:00
1 parent c11a278050
commit 8bc92b2341
25 files changed
+136 -331

No files matched your search

+2 -2
View File
@@ -2,7 +2,7 @@ name: Build
on:
push:
branches: [main]
branches: [main, multiloader]
pull_request:
env:
@@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
java-version: '17'
cache: gradle
- run: chmod +x ./gradlew
- run: ./gradlew build --no-daemon
+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
java-version: '17'
cache: gradle
- run: chmod +x ./gradlew
- run: ./gradlew build --no-daemon
+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`.
+10 -4
View File
@@ -4,8 +4,8 @@ Client-side Minecraft mod that adds **HD skins** (up to 2048×2048) and, importa
**animated GIF cape support** — including HD and transparent GIFs — on top of a UUID-keyed
asset API. Built for GravitLauncher setups but backend-agnostic.
Currently targets **NeoForge 1.21.1**. Fabric/Forge and 1.20.1 / 1.19.2 are planned — the core
(GIF decoder, cape state, mixins) is written to be loader/version agnostic.
This branch targets **Fabric and Forge 1.20.1** through an Architectury multiloader build. The core
(GIF decoder, cape state, mixins) is shared between loaders.
## Features
@@ -32,7 +32,8 @@ launcher already serves, so they need no extra endpoint.
## Install
Drop `skinsg-x.y.z.jar` into your `mods/` folder on a NeoForge 1.21.1 client. Client-side only.
Drop the matching `skinsg-fabric-x.y.z.jar` or `skinsg-forge-x.y.z.jar` into your Minecraft 1.20.1
client's `mods/` folder. Client-side only.
## Configuration
@@ -80,7 +81,12 @@ All settings persist in `config/skinsg.json`.
./gradlew build
```
Output: `build/libs/skinsg-<version>.jar`. Requires JDK 21.
Runtime jars:
- `build/libs/skinsg-fabric-<version>.jar`
- `build/libs/skinsg-forge-<version>.jar`
Requires JDK 17.
## License
+24 -7
View File
@@ -1,11 +1,10 @@
// Root build for the Architectury multiloader (Fabric / Forge / NeoForge).
// Follows the standard Architectury 1.7.x example-template layout. Target MC
// version is driven by gradle.properties (minecraft_version + the *_version
// props). Default is 1.21.1; switch to 1.20.1 by editing gradle.properties and
// swapping the version-specific mixin sources (see MULTILOADER.md).
// Root build for the Architectury multiloader (Fabric / Forge).
// Target MC version is driven by gradle.properties (minecraft_version + the
// *_version props). This branch targets Minecraft 1.20.1 / Java 17.
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "base"
id "architectury-plugin" version "3.4.164"
id "dev.architectury.loom" version "1.7.435" apply false
id "com.gradleup.shadow" version "8.3.5" apply false
}
@@ -58,3 +57,21 @@ subprojects {
options.release = javaVer
}
}
def runtimePlatforms = rootProject.enabled_platforms.split(",").collect { it.trim() }.findAll { !it.isEmpty() }
tasks.register("collectRuntimeJars", Copy) {
into layout.buildDirectory.dir("libs")
doFirst {
delete(layout.buildDirectory.dir("libs"))
}
runtimePlatforms.each { platform ->
def remap = project(":${platform}").tasks.named("remapJar")
dependsOn remap
from(remap.flatMap { it.archiveFile })
}
}
tasks.named("build") {
dependsOn tasks.named("collectRuntimeJars")
}
@@ -122,7 +122,7 @@ public final class CapeManager {
try {
DynamicTexture tex = new DynamicTexture(gif.width, gif.height, true);
((AbstractTexture) tex).setFilter(false, false);
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(MODID, "cape/" + entry.uuid + "/anim");
ResourceLocation id = new ResourceLocation(MODID, "cape/" + entry.uuid + "/anim");
Minecraft.getInstance().getTextureManager().register(id, tex);
entry.attach(gif, tex, id);
} catch (Throwable t) {
@@ -1,8 +1,10 @@
package xyz.nightsync.skinsg.commands;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import net.minecraft.client.Minecraft;
@@ -14,9 +16,6 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal;
import static com.mojang.brigadier.builder.RequiredArgumentBuilder.argument;
/**
* Loader-agnostic client command tree, built with RAW Brigadier builders so it is
* generic over the command source type {@code S}. Fabric client commands use
@@ -46,23 +45,31 @@ public final class SkinsgCommands {
return b.buildFuture();
};
return literal("skinsg")
.then(literal("playgif")
return SkinsgCommands.<S>literal("skinsg")
.then(SkinsgCommands.<S>literal("playgif")
.executes(c -> { cfg.setNone(); CapeManager.releaseAll(); return ok(fb, c, "GIF capes: off"); })
.then(argument("target", StringArgumentType.word()).suggests(targets)
.then(SkinsgCommands.<S, String>argument("target", StringArgumentType.word()).suggests(targets)
.executes(c -> playgif(fb, cfg, c))))
.then(literal("stopgif")
.then(SkinsgCommands.<S>literal("stopgif")
.executes(c -> { cfg.setNone(); CapeManager.releaseAll(); return ok(fb, c, "GIF capes: off"); })
.then(argument("target", StringArgumentType.word()).suggests(targets)
.then(SkinsgCommands.<S, String>argument("target", StringArgumentType.word()).suggests(targets)
.executes(c -> stopgif(fb, cfg, c))))
.then(literal("self")
.then(SkinsgCommands.<S>literal("self")
.executes(c -> { cfg.setSelf(); CapeManager.releaseAll(); return ok(fb, c, "GIF capes: self only"); }))
.then(literal("speed")
.then(argument("target", StringArgumentType.word()).suggests(targets)
.then(argument("percent", IntegerArgumentType.integer(1, 2000))
.then(SkinsgCommands.<S>literal("speed")
.then(SkinsgCommands.<S, String>argument("target", StringArgumentType.word()).suggests(targets)
.then(SkinsgCommands.<S, Integer>argument("percent", IntegerArgumentType.integer(1, 2000))
.executes(c -> speed(fb, cfg, c)))));
}
private static <S> LiteralArgumentBuilder<S> literal(String name) {
return LiteralArgumentBuilder.literal(name);
}
private static <S, T> RequiredArgumentBuilder<S, T> argument(String name, ArgumentType<T> type) {
return RequiredArgumentBuilder.argument(name, type);
}
private static <S> int playgif(Feedback<S> fb, SkinsgConfig cfg, CommandContext<S> c) {
String target = StringArgumentType.getString(c, "target");
if (ALL.equals(target)) { cfg.setAll(); return ok(fb, c, "GIF capes: everyone"); }
@@ -2,7 +2,6 @@ package xyz.nightsync.skinsg.mixin;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -13,14 +12,10 @@ import xyz.nightsync.skinsg.client.CapeManager;
@Mixin(AbstractClientPlayer.class)
public abstract class CapeMagicMixin {
@Inject(method = "getSkin", at = @At("RETURN"), cancellable = true)
private void skinsg$overrideCape(CallbackInfoReturnable<PlayerSkin> cir) {
@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) return;
PlayerSkin s = cir.getReturnValue();
if (s == null) return;
cir.setReturnValue(new PlayerSkin(
s.texture(), s.textureUrl(), animated, s.elytraTexture(), s.model(), s.secure()));
if (animated != null) cir.setReturnValue(animated);
}
}
@@ -1,7 +1,7 @@
{
"required": true,
"minVersion": "0.8",
"compatibilityLevel": "JAVA_21",
"compatibilityLevel": "JAVA_17",
"package": "xyz.nightsync.skinsg.mixin",
"refmap": "skinsg.refmap.json",
"client": [
+1
View File
@@ -0,0 +1 @@
loom.platform=fabric
+3 -3
View File
@@ -13,9 +13,9 @@
"mixins": ["skinsg.mixins.json"],
"depends": {
"fabricloader": ">=0.16",
"minecraft": "~1.21.1",
"java": ">=21",
"minecraft": "~1.20.1",
"java": ">=17",
"fabric-api": "*",
"architectury": ">=13.0.8"
"architectury": ">=9.2.14"
}
}
+1
View File
@@ -0,0 +1 @@
loom.platform=forge
+4 -4
View File
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[52,)"
loaderVersion = "[47,)"
license = "All Rights Reserved"
[[mods]]
@@ -12,20 +12,20 @@ description = '''Client-side HD skins (up to 2048) and animated GIF cape support
[[dependencies.skinsg]]
modId = "forge"
type = "required"
versionRange = "[52,)"
versionRange = "[47,)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.skinsg]]
modId = "minecraft"
type = "required"
versionRange = "[1.21,1.22)"
versionRange = "[1.20.1,1.21)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.skinsg]]
modId = "architectury"
type = "required"
versionRange = "[13.0.8,)"
versionRange = "[9.2.14,)"
ordering = "AFTER"
side = "CLIENT"
+13 -13
View File
@@ -11,22 +11,22 @@ mod_group_id=xyz.nightsync.skinsg
mod_license=All Rights Reserved
mod_author=Nghtly
# --- Stage 1 target: Minecraft 1.21.1 (Architectury multiloader) ---
minecraft_version=1.21.1
minecraft_version_range=[1.21.1]
parchment_minecraft=1.21.1
parchment_version=2024.11.17
# --- Target: Minecraft 1.20.1 (Architectury Fabric / Forge) ---
minecraft_version=1.20.1
minecraft_version_range=[1.20.1]
parchment_minecraft=1.20.1
parchment_version=2023.09.03
# Loaders / APIs for 1.21.1
architectury_api_version=13.0.8
# Loaders / APIs for 1.20.1
architectury_api_version=9.2.14
fabric_loader_version=0.16.9
fabric_api_version=0.115.0+1.21.1
forge_version=1.21.1-52.0.63
neoforge_version=21.1.219
fabric_api_version=0.92.5+1.20.1
forge_version=1.20.1-47.4.10
neoforge_version=47.1.106
enabled_platforms=fabric,forge,neoforge
enabled_platforms=fabric,forge
# NeoGradle parchment (kept for reference; loom uses parchment_* above)
neogradle.subsystems.parchment.minecraftVersion=1.21.1
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
neogradle.subsystems.parchment.minecraftVersion=1.20.1
neogradle.subsystems.parchment.mappingsVersion=2023.09.03
loader_version_range=[1,)
+5
View File
@@ -8,6 +8,11 @@
set -euo pipefail
cd "$(dirname "$0")"
if [[ ! -e src/main/java/xyz/nightsync/skinsg/SkinsgConfig.java ]]; then
echo "Migration already applied; src/ is not present."
exit 0
fi
CJ=common/src/main/java/xyz/nightsync/skinsg
CR=common/src/main/resources
mkdir -p "$CJ" "$CR" neoforge/src/main/resources/META-INF
+1
View File
@@ -0,0 +1 @@
loom.platform=neoforge
+6 -3
View File
@@ -11,6 +11,9 @@ pluginManagement {
rootProject.name = "skinsg"
include("common")
include("fabric")
include("forge")
include("neoforge")
def props = new Properties()
file("gradle.properties").withInputStream { props.load(it) }
props.getProperty("enabled_platforms", "fabric,forge").split(",").collect { it.trim() }.findAll { !it.isEmpty() }.each { platform ->
include(platform)
}
@@ -1,41 +0,0 @@
package xyz.nightsync.skinsg;
import net.minecraft.client.Minecraft;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.client.event.ClientTickEvent;
import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent;
import net.neoforged.neoforge.common.NeoForge;
import xyz.nightsync.skinsg.client.CapeManager;
import xyz.nightsync.skinsg.commands.SkinsgCommands;
@Mod(value = SkinsgMod.MODID, dist = Dist.CLIENT)
public final class SkinsgMod {
public static final String MODID = "skinsg";
private static SkinsgConfig config;
public SkinsgMod(IEventBus modBus) {
config = SkinsgConfig.load(FMLPaths.CONFIGDIR.get());
CapeManager.init(config, () -> {
var p = Minecraft.getInstance().player;
return p != null ? p.getUUID() : null;
});
NeoForge.EVENT_BUS.addListener(this::onRegisterCommands);
NeoForge.EVENT_BUS.addListener(this::onClientTick);
}
public static SkinsgConfig config() {
return config;
}
private void onRegisterCommands(RegisterClientCommandsEvent e) {
SkinsgCommands.register(e.getDispatcher(), config);
}
private void onClientTick(ClientTickEvent.Post e) {
CapeManager.clientTick();
}
}
@@ -1,108 +0,0 @@
package xyz.nightsync.skinsg.commands;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerInfo;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component;
import xyz.nightsync.skinsg.SkinsgConfig;
import xyz.nightsync.skinsg.client.CapeManager;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import static net.minecraft.commands.Commands.argument;
import static net.minecraft.commands.Commands.literal;
public final class SkinsgCommands {
private static SkinsgConfig cfg;
public static final String ALL = "@a";
private SkinsgCommands() {}
private static final SuggestionProvider<CommandSourceStack> TARGETS = (ctx, b) -> {
b.suggest(ALL);
var conn = Minecraft.getInstance().getConnection();
if (conn != null) {
for (PlayerInfo pi : conn.getOnlinePlayers()) {
b.suggest(pi.getProfile().getName());
}
}
return b.buildFuture();
};
public static void register(CommandDispatcher<CommandSourceStack> d, SkinsgConfig config) {
cfg = config;
d.register(literal("skinsg")
.then(literal("playgif")
.executes(c -> { cfg.setNone(); CapeManager.releaseAll(); return msg(c, "GIF capes: off"); })
.then(argument("target", StringArgumentType.word()).suggests(TARGETS)
.executes(SkinsgCommands::playgif)))
.then(literal("stopgif")
.executes(c -> { cfg.setNone(); CapeManager.releaseAll(); return msg(c, "GIF capes: off"); })
.then(argument("target", StringArgumentType.word()).suggests(TARGETS)
.executes(SkinsgCommands::stopgif)))
.then(literal("self")
.executes(c -> { cfg.setSelf(); CapeManager.releaseAll(); return msg(c, "GIF capes: self only"); }))
.then(literal("speed")
.then(argument("target", StringArgumentType.word()).suggests(TARGETS)
.then(argument("percent", IntegerArgumentType.integer(1, 2000))
.executes(SkinsgCommands::speed)))));
}
private static int playgif(CommandContext<CommandSourceStack> c) {
String target = StringArgumentType.getString(c, "target");
if (ALL.equals(target)) { cfg.setAll(); return msg(c, "GIF capes: everyone"); }
Set<UUID> ids = resolve(target);
if (ids.isEmpty()) return err(c, "player not found: " + target);
cfg.enableFor(ids);
return msg(c, "GIF capes: on for " + target);
}
private static int stopgif(CommandContext<CommandSourceStack> c) {
String target = StringArgumentType.getString(c, "target");
if (ALL.equals(target)) { cfg.setNone(); CapeManager.releaseAll(); return msg(c, "GIF capes: off"); }
Set<UUID> ids = resolve(target);
if (ids.isEmpty()) return err(c, "player not found: " + target);
cfg.disableFor(ids);
for (UUID id : ids) CapeManager.releaseIfPresent(id);
return msg(c, "GIF capes: stopped for " + target);
}
private static int speed(CommandContext<CommandSourceStack> c) {
String target = StringArgumentType.getString(c, "target");
int percent = IntegerArgumentType.getInteger(c, "percent");
if (ALL.equals(target)) { cfg.setGlobalSpeed(percent); return msg(c, "GIF speed: " + percent + "% (all)"); }
Set<UUID> ids = resolve(target);
if (ids.isEmpty()) return err(c, "player not found: " + target);
for (UUID id : ids) cfg.setSpeed(id, percent);
return msg(c, "GIF speed: " + percent + "% for " + target);
}
private static Set<UUID> resolve(String name) {
Set<UUID> out = new HashSet<>();
var conn = Minecraft.getInstance().getConnection();
if (conn != null) {
for (PlayerInfo pi : conn.getOnlinePlayers()) {
if (pi.getProfile().getName().equalsIgnoreCase(name)) out.add(pi.getProfile().getId());
}
}
return out;
}
private static int msg(CommandContext<CommandSourceStack> c, String text) {
c.getSource().sendSuccess(() -> Component.literal("[skinsg] " + text), false);
return 1;
}
private static int err(CommandContext<CommandSourceStack> c, String text) {
c.getSource().sendFailure(Component.literal("[skinsg] " + text));
return 0;
}
}
@@ -1,30 +0,0 @@
modLoader="javafml"
loaderVersion="${loader_version_range}"
license="${mod_license}"
[[mods]]
modId="${mod_id}"
version="${mod_version}"
displayName="${mod_name}"
displayURL="https://git.mcbcorp.ru/Fiden/HDSkinSupportGravit"
authors="Nghtly"
description='''
HD skins (up to 2048x2048) and animated GIF capes, driven by a UUID-keyed asset API.
'''
[[mixins]]
config="${mod_id}.mixins.json"
[[dependencies.${mod_id}]]
modId="neoforge"
type="required"
versionRange="[21.1,)"
ordering="NONE"
side="CLIENT"
[[dependencies.${mod_id}]]
modId="minecraft"
type="required"
versionRange="${minecraft_version_range}"
ordering="NONE"
side="CLIENT"