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:
1 parent
6e3de2716c
commit
c11a278050
18 files changed
+684
-188
No files matched your search
+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.
|
||||
+42
-150
@@ -1,168 +1,60 @@
|
||||
// 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).
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle.userdev' version '7.1.20'
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
||||
id "com.gradleup.shadow" version "8.3.5" apply false
|
||||
}
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
|
||||
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
|
||||
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
|
||||
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
|
||||
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
|
||||
distributionType = Wrapper.DistributionType.BIN
|
||||
architectury {
|
||||
minecraft = rootProject.minecraft_version
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
group = mod_group_id
|
||||
|
||||
repositories {
|
||||
// Add here additional repositories if required by some of the dependencies below.
|
||||
allprojects {
|
||||
group = rootProject.mod_group_id
|
||||
version = rootProject.mod_version
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
subprojects {
|
||||
apply plugin: "dev.architectury.loom"
|
||||
apply plugin: "architectury-plugin"
|
||||
apply plugin: "maven-publish"
|
||||
|
||||
// Mojang ships Java 21 to end users in 1.21.1, so mods should target Java 21.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
def isLegacy = rootProject.minecraft_version == "1.20.1"
|
||||
def javaVer = isLegacy ? 17 : 21
|
||||
|
||||
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
systemProperty 'forge.logging.console.level', 'debug'
|
||||
|
||||
modSource project.sourceSets.main
|
||||
base {
|
||||
// built jars: skinsg-fabric-<ver>.jar, skinsg-forge-<ver>.jar, ...
|
||||
archivesName = "${rootProject.mod_id}-${project.name}"
|
||||
}
|
||||
|
||||
client {
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
argument '--nogui'
|
||||
}
|
||||
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// By default, the server will crash when no gametests are provided.
|
||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||
gameTestServer {
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
data {
|
||||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||
// workingDirectory project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
arguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||
}
|
||||
}
|
||||
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
// Sets up a dependency configuration called 'localRuntime'.
|
||||
// This configuration should be used instead of 'runtimeOnly' to declare
|
||||
// a dependency that will be present for runtime testing but that is
|
||||
// "optional", meaning it will not be pulled by dependents of this mod.
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom localRuntime
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Specify the version of Minecraft to use.
|
||||
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
|
||||
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
|
||||
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
||||
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
||||
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
||||
implementation "net.neoforged:neoforge:${neo_version}"
|
||||
|
||||
// Example optional mod dependency with JEI
|
||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
|
||||
// compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
|
||||
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
|
||||
// localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
|
||||
|
||||
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||
// The group id is ignored when searching -- in this case, it is "blank"
|
||||
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
|
||||
|
||||
// Example mod dependency using a file as dependency
|
||||
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
|
||||
|
||||
// Example project dependency using a sister or child project:
|
||||
// implementation project(":myproject")
|
||||
|
||||
// For more info:
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.withType(ProcessResources).configureEach {
|
||||
var replaceProperties = [
|
||||
minecraft_version : minecraft_version,
|
||||
minecraft_version_range: minecraft_version_range,
|
||||
neo_version : neo_version,
|
||||
loader_version_range : loader_version_range,
|
||||
mod_id : mod_id,
|
||||
mod_name : mod_name,
|
||||
mod_license : mod_license,
|
||||
mod_version : mod_version,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/neoforge.mods.toml']) {
|
||||
expand replaceProperties
|
||||
}
|
||||
}
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
publishing {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/repo"
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://maven.neoforged.net/releases/" }
|
||||
maven { url "https://maven.minecraftforge.net/" }
|
||||
maven { url "https://maven.parchmentmc.org" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||
mappings loom.layered {
|
||||
officialMojangMappings()
|
||||
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_minecraft}:${rootProject.parchment_version}@zip")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
java {
|
||||
withSourcesJar()
|
||||
sourceCompatibility = JavaVersion.toVersion(javaVer)
|
||||
targetCompatibility = JavaVersion.toVersion(javaVer)
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(javaVer)
|
||||
}
|
||||
|
||||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
||||
idea {
|
||||
module {
|
||||
downloadSources = true
|
||||
downloadJavadoc = true
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = javaVer
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
architectury {
|
||||
common(rootProject.enabled_platforms.split(","))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Fabric Loader is used at compile time only for the @Environment annotations,
|
||||
// which Architectury remaps to the right annotation on each platform.
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modApi "dev.architectury:architectury:${rootProject.architectury_api_version}"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package xyz.nightsync.skinsg;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import xyz.nightsync.skinsg.client.CapeManager;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Loader-agnostic client bootstrap. Each loader entrypoint calls {@link #init(Path)}
|
||||
* with its own config directory, then wires the client command + client tick using
|
||||
* {@link xyz.nightsync.skinsg.commands.SkinsgCommands} and {@link CapeManager}.
|
||||
*/
|
||||
public final class SkinsgClient {
|
||||
|
||||
private static SkinsgConfig config;
|
||||
|
||||
private SkinsgClient() {}
|
||||
|
||||
public static void init(Path configDir) {
|
||||
config = SkinsgConfig.load(configDir);
|
||||
CapeManager.init(config, () -> {
|
||||
var p = Minecraft.getInstance().player;
|
||||
return p != null ? p.getUUID() : null;
|
||||
});
|
||||
}
|
||||
|
||||
public static SkinsgConfig config() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/** Call every client tick from the loader event. */
|
||||
public static void tick() {
|
||||
CapeManager.clientTick();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package xyz.nightsync.skinsg.commands;
|
||||
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||
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 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
|
||||
* {@code FabricClientCommandSource}; Forge/NeoForge use {@code CommandSourceStack}.
|
||||
* Each loader supplies a {@link Feedback} that speaks to its own source, then
|
||||
* registers {@code build(cfg, feedback)} into its client dispatcher.
|
||||
*/
|
||||
public final class SkinsgCommands {
|
||||
|
||||
/** Per-loader chat feedback so common code doesn't touch a loader source type. */
|
||||
public interface Feedback<S> {
|
||||
void success(S source, String message);
|
||||
void failure(S source, String message);
|
||||
}
|
||||
|
||||
public static final String ALL = "@a";
|
||||
|
||||
private SkinsgCommands() {}
|
||||
|
||||
public static <S> LiteralArgumentBuilder<S> build(SkinsgConfig cfg, Feedback<S> fb) {
|
||||
SuggestionProvider<S> 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();
|
||||
};
|
||||
|
||||
return literal("skinsg")
|
||||
.then(literal("playgif")
|
||||
.executes(c -> { cfg.setNone(); CapeManager.releaseAll(); return ok(fb, c, "GIF capes: off"); })
|
||||
.then(argument("target", StringArgumentType.word()).suggests(targets)
|
||||
.executes(c -> playgif(fb, cfg, c))))
|
||||
.then(literal("stopgif")
|
||||
.executes(c -> { cfg.setNone(); CapeManager.releaseAll(); return ok(fb, c, "GIF capes: off"); })
|
||||
.then(argument("target", StringArgumentType.word()).suggests(targets)
|
||||
.executes(c -> stopgif(fb, cfg, c))))
|
||||
.then(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))
|
||||
.executes(c -> speed(fb, cfg, c)))));
|
||||
}
|
||||
|
||||
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"); }
|
||||
Set<UUID> ids = resolve(target);
|
||||
if (ids.isEmpty()) return err(fb, c, "player not found: " + target);
|
||||
cfg.enableFor(ids);
|
||||
return ok(fb, c, "GIF capes: on for " + target);
|
||||
}
|
||||
|
||||
private static <S> int stopgif(Feedback<S> fb, SkinsgConfig cfg, CommandContext<S> c) {
|
||||
String target = StringArgumentType.getString(c, "target");
|
||||
if (ALL.equals(target)) { cfg.setNone(); CapeManager.releaseAll(); return ok(fb, c, "GIF capes: off"); }
|
||||
Set<UUID> ids = resolve(target);
|
||||
if (ids.isEmpty()) return err(fb, c, "player not found: " + target);
|
||||
cfg.disableFor(ids);
|
||||
for (UUID id : ids) CapeManager.releaseIfPresent(id);
|
||||
return ok(fb, c, "GIF capes: stopped for " + target);
|
||||
}
|
||||
|
||||
private static <S> int speed(Feedback<S> fb, SkinsgConfig cfg, CommandContext<S> c) {
|
||||
String target = StringArgumentType.getString(c, "target");
|
||||
int percent = IntegerArgumentType.getInteger(c, "percent");
|
||||
if (ALL.equals(target)) { cfg.setGlobalSpeed(percent); return ok(fb, c, "GIF speed: " + percent + "% (all)"); }
|
||||
Set<UUID> ids = resolve(target);
|
||||
if (ids.isEmpty()) return err(fb, c, "player not found: " + target);
|
||||
for (UUID id : ids) cfg.setSpeed(id, percent);
|
||||
return ok(fb, 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 <S> int ok(Feedback<S> fb, CommandContext<S> c, String text) {
|
||||
fb.success(c.getSource(), "[skinsg] " + text);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static <S> int err(Feedback<S> fb, CommandContext<S> c, String text) {
|
||||
fb.failure(c.getSource(), "[skinsg] " + text);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
plugins {
|
||||
id "com.gradleup.shadow"
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
configurations {
|
||||
common
|
||||
shadowBundle
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentFabric.extendsFrom common
|
||||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_api_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowBundle project(path: ":common", configuration: "transformProductionFabric")
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand version: project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowBundle]
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
archiveClassifier = null
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package xyz.nightsync.skinsg.fabric;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import xyz.nightsync.skinsg.SkinsgClient;
|
||||
import xyz.nightsync.skinsg.commands.SkinsgCommands;
|
||||
|
||||
public final class SkinsgFabric implements ClientModInitializer {
|
||||
|
||||
private static final SkinsgCommands.Feedback<FabricClientCommandSource> FEEDBACK = new SkinsgCommands.Feedback<>() {
|
||||
@Override public void success(FabricClientCommandSource s, String m) { s.sendFeedback(Component.literal(m)); }
|
||||
@Override public void failure(FabricClientCommandSource s, String m) { s.sendError(Component.literal(m)); }
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
SkinsgClient.init(FabricLoader.getInstance().getConfigDir());
|
||||
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registry) ->
|
||||
dispatcher.register(SkinsgCommands.build(SkinsgClient.config(), FEEDBACK)));
|
||||
ClientTickEvents.END_CLIENT_TICK.register(mc -> SkinsgClient.tick());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "skinsg",
|
||||
"version": "${version}",
|
||||
"name": "HD Skin Support (Gravit)",
|
||||
"description": "Client-side HD skins (up to 2048) and animated GIF cape support.",
|
||||
"authors": ["Nghtly"],
|
||||
"license": "All Rights Reserved",
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"client": ["xyz.nightsync.skinsg.fabric.SkinsgFabric"]
|
||||
},
|
||||
"mixins": ["skinsg.mixins.json"],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16",
|
||||
"minecraft": "~1.21.1",
|
||||
"java": ">=21",
|
||||
"fabric-api": "*",
|
||||
"architectury": ">=13.0.8"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
plugins {
|
||||
id "com.gradleup.shadow"
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
forge()
|
||||
}
|
||||
|
||||
loom {
|
||||
forge {
|
||||
convertAccessWideners = true
|
||||
mixinConfig "skinsg.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
common
|
||||
shadowBundle
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentForge.extendsFrom common
|
||||
}
|
||||
|
||||
dependencies {
|
||||
forge "net.minecraftforge:forge:${rootProject.forge_version}"
|
||||
modApi "dev.architectury:architectury-forge:${rootProject.architectury_api_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowBundle project(path: ":common", configuration: "transformProductionForge")
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand version: project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowBundle]
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
archiveClassifier = null
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package xyz.nightsync.skinsg.forge;
|
||||
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import xyz.nightsync.skinsg.SkinsgClient;
|
||||
import xyz.nightsync.skinsg.commands.SkinsgCommands;
|
||||
|
||||
@Mod("skinsg")
|
||||
public final class SkinsgForge {
|
||||
|
||||
private static final SkinsgCommands.Feedback<CommandSourceStack> FEEDBACK = new SkinsgCommands.Feedback<>() {
|
||||
@Override public void success(CommandSourceStack s, String m) { s.sendSuccess(() -> Component.literal(m), false); }
|
||||
@Override public void failure(CommandSourceStack s, String m) { s.sendFailure(Component.literal(m)); }
|
||||
};
|
||||
|
||||
public SkinsgForge() {
|
||||
// Client-side only; guard so a server never touches client classes.
|
||||
if (net.minecraftforge.fml.loading.FMLEnvironment.dist != Dist.CLIENT) return;
|
||||
SkinsgClient.init(FMLPaths.CONFIGDIR.get());
|
||||
MinecraftForge.EVENT_BUS.addListener((RegisterClientCommandsEvent e) ->
|
||||
e.getDispatcher().register(SkinsgCommands.build(SkinsgClient.config(), FEEDBACK)));
|
||||
MinecraftForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
|
||||
if (e.phase == TickEvent.Phase.END) SkinsgClient.tick();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[52,)"
|
||||
license = "All Rights Reserved"
|
||||
|
||||
[[mods]]
|
||||
modId = "skinsg"
|
||||
version = "${version}"
|
||||
displayName = "HD Skin Support (Gravit)"
|
||||
authors = "Nghtly"
|
||||
description = '''Client-side HD skins (up to 2048) and animated GIF cape support.'''
|
||||
|
||||
[[dependencies.skinsg]]
|
||||
modId = "forge"
|
||||
type = "required"
|
||||
versionRange = "[52,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.skinsg]]
|
||||
modId = "minecraft"
|
||||
type = "required"
|
||||
versionRange = "[1.21,1.22)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.skinsg]]
|
||||
modId = "architectury"
|
||||
type = "required"
|
||||
versionRange = "[13.0.8,)"
|
||||
ordering = "AFTER"
|
||||
side = "CLIENT"
|
||||
+26
-33
@@ -1,39 +1,32 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
|
||||
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
|
||||
# --- Mod ---
|
||||
mod_id=skinsg
|
||||
mod_name=HD Skin Support (Gravit)
|
||||
mod_version=0.1.0
|
||||
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
|
||||
|
||||
# Loaders / APIs for 1.21.1
|
||||
architectury_api_version=13.0.8
|
||||
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
|
||||
|
||||
enabled_platforms=fabric,forge,neoforge
|
||||
|
||||
# NeoGradle parchment (kept for reference; loom uses parchment_* above)
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.21.1
|
||||
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
|
||||
# Environment Properties
|
||||
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||
minecraft_version=1.21.1
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.21.1]
|
||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||
neo_version=21.1.219
|
||||
# The loader version range can only use the major version of FML as bounds
|
||||
loader_version_range=[1,)
|
||||
|
||||
## Mod Properties
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=skinsg
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=HD Skin Support (Gravit)
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=0.1.0
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
mod_group_id=xyz.nightsync.skinsg
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
# Architectury Loom needs Gradle 8.x (not 9.x). 8.10.2 is known-good with Loom 1.7.
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# One-time restructure of the single-loader NeoForge tree into the Architectury
|
||||
# multiloader layout. Run once from the repo root on the `multiloader` branch:
|
||||
# bash migrate-to-multiloader.sh
|
||||
# It only MOVES the loader/version-agnostic code (config, gif, client, mixins)
|
||||
# into common/, and the NeoForge metadata into neoforge/. The changed files
|
||||
# (generic commands, per-loader entrypoints, mod metadata) are added separately.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
CJ=common/src/main/java/xyz/nightsync/skinsg
|
||||
CR=common/src/main/resources
|
||||
mkdir -p "$CJ" "$CR" neoforge/src/main/resources/META-INF
|
||||
|
||||
# --- loader/version-agnostic core -> common ---
|
||||
git mv src/main/java/xyz/nightsync/skinsg/SkinsgConfig.java "$CJ"/
|
||||
git mv src/main/java/xyz/nightsync/skinsg/gif "$CJ"/
|
||||
git mv src/main/java/xyz/nightsync/skinsg/client "$CJ"/
|
||||
git mv src/main/java/xyz/nightsync/skinsg/mixin "$CJ"/
|
||||
git mv src/main/resources/skinsg.mixins.json "$CR"/
|
||||
|
||||
# --- superseded / rewritten: generic commands, per-loader entrypoints + fresh metadata ---
|
||||
git rm src/main/java/xyz/nightsync/skinsg/commands/SkinsgCommands.java
|
||||
git rm src/main/java/xyz/nightsync/skinsg/SkinsgMod.java
|
||||
git rm src/main/resources/META-INF/neoforge.mods.toml
|
||||
|
||||
# clean up now-empty old source roots
|
||||
rm -rf src
|
||||
|
||||
echo "Migration done. Now add the new files (SkinsgCommands generic, SkinsgClient,"
|
||||
echo "per-loader entrypoints + metadata) — see MULTILOADER.md — then ./gradlew build."
|
||||
@@ -0,0 +1,41 @@
|
||||
plugins {
|
||||
id "com.gradleup.shadow"
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
}
|
||||
|
||||
configurations {
|
||||
common
|
||||
shadowBundle
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentNeoForge.extendsFrom common
|
||||
}
|
||||
|
||||
dependencies {
|
||||
neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}"
|
||||
modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_api_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowBundle project(path: ":common", configuration: "transformProductionNeoForge")
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("META-INF/neoforge.mods.toml") {
|
||||
expand version: project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowBundle]
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
archiveClassifier = null
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package xyz.nightsync.skinsg.neoforge;
|
||||
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.chat.Component;
|
||||
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.SkinsgClient;
|
||||
import xyz.nightsync.skinsg.commands.SkinsgCommands;
|
||||
|
||||
@Mod(value = "skinsg", dist = Dist.CLIENT)
|
||||
public final class SkinsgNeoForge {
|
||||
|
||||
private static final SkinsgCommands.Feedback<CommandSourceStack> FEEDBACK = new SkinsgCommands.Feedback<>() {
|
||||
@Override public void success(CommandSourceStack s, String m) { s.sendSuccess(() -> Component.literal(m), false); }
|
||||
@Override public void failure(CommandSourceStack s, String m) { s.sendFailure(Component.literal(m)); }
|
||||
};
|
||||
|
||||
public SkinsgNeoForge(IEventBus modBus) {
|
||||
SkinsgClient.init(FMLPaths.CONFIGDIR.get());
|
||||
NeoForge.EVENT_BUS.addListener((RegisterClientCommandsEvent e) ->
|
||||
e.getDispatcher().register(SkinsgCommands.build(SkinsgClient.config(), FEEDBACK)));
|
||||
NeoForge.EVENT_BUS.addListener((ClientTickEvent.Post e) -> SkinsgClient.tick());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[1,)"
|
||||
license = "All Rights Reserved"
|
||||
|
||||
[[mods]]
|
||||
modId = "skinsg"
|
||||
version = "${version}"
|
||||
displayName = "HD Skin Support (Gravit)"
|
||||
authors = "Nghtly"
|
||||
description = '''Client-side HD skins (up to 2048) and animated GIF cape support.'''
|
||||
|
||||
[[mixins]]
|
||||
config = "skinsg.mixins.json"
|
||||
|
||||
[[dependencies.skinsg]]
|
||||
modId = "neoforge"
|
||||
type = "required"
|
||||
versionRange = "[21.1,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.skinsg]]
|
||||
modId = "minecraft"
|
||||
type = "required"
|
||||
versionRange = "[1.21,1.22)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.skinsg]]
|
||||
modId = "architectury"
|
||||
type = "required"
|
||||
versionRange = "[13.0.8,)"
|
||||
ordering = "AFTER"
|
||||
side = "CLIENT"
|
||||
+10
-4
@@ -1,10 +1,16 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://maven.minecraftforge.net/" }
|
||||
maven { url "https://maven.neoforged.net/releases/" }
|
||||
gradlePluginPortal()
|
||||
maven { url = 'https://maven.neoforged.net/releases' }
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||
}
|
||||
rootProject.name = "skinsg"
|
||||
|
||||
include("common")
|
||||
include("fabric")
|
||||
include("forge")
|
||||
include("neoforge")
|
||||
Reference in new issue
Block a user