mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-19 10:49:19 +00:00
Support 1.21. (#297)
This commit is contained in:
1 parent
cd1922844c
commit
64490f1d18
90 files changed
+733
-375
No files matched your search
@@ -1,8 +0,0 @@
|
||||
package customskinloader;
|
||||
|
||||
/**
|
||||
* @deprecated From 14.16, use <code>customskinloader.log.Logger</code> instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class Logger extends customskinloader.log.Logger {
|
||||
}
|
||||
@@ -2,7 +2,11 @@ package customskinloader.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.loader.ProfileLoader;
|
||||
@@ -10,7 +14,6 @@ import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.plugin.PluginLoader;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import customskinloader.utils.HttpTextureUtil;
|
||||
import customskinloader.utils.HttpUtil0;
|
||||
import customskinloader.utils.Version;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FakeCapeBuffer extends FakeSkinBuffer {
|
||||
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");
|
||||
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("minecraft", "textures/entity/elytra.png");
|
||||
private static int loadedGlobal = 0;
|
||||
private static FakeImage elytraImage;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package customskinloader.fake.itf;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.utils.TimeUtil;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -4,14 +4,7 @@ import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MinecraftUtil {
|
||||
}
|
||||
|
||||
//version.json can be found in 1.14+
|
||||
URL versionFile = MinecraftUtil.class.getResource("/version.json");
|
||||
URL versionFile = ClassLoader.getSystemClassLoader().getResource("version.json");
|
||||
if (versionFile != null) {
|
||||
try (
|
||||
InputStream is = versionFile.openStream();
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"name": "CustomSkinLoader",
|
||||
"version": "${modVersion}",
|
||||
"fullVersion": "${modFullVersion}",
|
||||
"mcVersion": "${mcVersion}",
|
||||
"mcFullVersions": "${mcFullVersions}",
|
||||
"forgeVersion": "${forgeVersion}",
|
||||
"dependencies": {
|
||||
"${dependencies}"
|
||||
},
|
||||
"gitVersion": "${gitVersion}",
|
||||
"buildUrl": "${buildUrl}",
|
||||
"buildTime": "${releaseTime}"
|
||||
|
||||
+1
-45
@@ -24,7 +24,6 @@ dependencies {
|
||||
|
||||
import customskinloader.gradle.util.RemapUtil
|
||||
import customskinloader.gradle.util.SourceUtil
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
@@ -37,48 +36,5 @@ mixin {
|
||||
reobfNotchSrgFile = "build/mixin.srg"
|
||||
}
|
||||
|
||||
SourceUtil.addDependencies project, project(":Common")
|
||||
SourceUtil.addDependencies project, project(":Common"), project(":Vanilla/Common")
|
||||
RemapUtil.remapSources project
|
||||
|
||||
// Resolve snapshot versions
|
||||
tasks.publishModrinth.doFirst {
|
||||
def snapshot = []
|
||||
gameVersions.groupBy { v -> v.endsWith("-Snapshot") }.with {
|
||||
this.tasks.publishModrinth.gameVersions = it[false]
|
||||
snapshot = it[true]
|
||||
}
|
||||
|
||||
// The CustomSkinLoader Fabric edition should support all Minecraft snapshot edition.
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def officialVersionList = [] as Set
|
||||
plugins.withId "net.minecraftforge.gradle.forge", { plugin ->
|
||||
def currentRelease = null
|
||||
// Get version manifest json.
|
||||
// https://github.com/MinecraftForge/ForgeGradle/blob/fc67182a61926f0bdb0d12da5fba7f4322f64d86/src/main/java/net/minecraftforge/gradle/common/BasePlugin.java#L229
|
||||
jsonSlurper.parse(plugin.cacheFile("McManifest.json")).versions.each { version ->
|
||||
if (version.type == "snapshot") {
|
||||
// If the first version is a snapshot, since Mojang no longer provides the target version for snapshots,
|
||||
// we assume that new snapshots will not be supported until the next release.
|
||||
if (currentRelease == null) {
|
||||
return
|
||||
}
|
||||
} else if (version.type == "release") {
|
||||
currentRelease = version.id.with {
|
||||
it.toString().split($/\./$).with { "${it[0]}.${it[1]}" }
|
||||
}
|
||||
} else {
|
||||
// We do not care about other types.
|
||||
return
|
||||
}
|
||||
if (snapshot.contains("${currentRelease}-Snapshot".toString())) {
|
||||
officialVersionList << version.id
|
||||
}
|
||||
}
|
||||
}
|
||||
jsonSlurper.parse(new URL("https://meta.fabricmc.net/v2/versions/game")).each { version ->
|
||||
// Exclude experimental editions which is not support in Modrinth.
|
||||
if (!version.stable && officialVersionList.contains(version.version)) {
|
||||
gameVersions << version.version.replace(" ", "-").replace("Pre-Release-", "pre") // Fix the id of the earlier preview versions of 1.14.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
minecraft_version=1.14
|
||||
minecraft_full_versions=1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21
|
||||
dependencies=Fabric|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21;\
|
||||
Quilt|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
|
||||
@@ -1,106 +1,11 @@
|
||||
package customskinloader.fabric;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import customskinloader.log.LogManager;
|
||||
import customskinloader.log.Logger;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
public static Logger logger = LogManager.getLogger("Fabric");
|
||||
private long world_version;
|
||||
private long protocol_version;
|
||||
|
||||
public class MixinConfigPlugin extends customskinloader.mixin.core.MixinConfigPlugin {
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
LogManager.setLogFile(Paths.get("./CustomSkinLoader/CustomSkinLoader.log"));
|
||||
URL versionJson = this.getClass().getResource("/version.json");
|
||||
if (versionJson != null) {
|
||||
logger.info("\"version.json\": " + versionJson.toString());
|
||||
try (
|
||||
InputStream is = versionJson.openStream();
|
||||
InputStreamReader isr = new InputStreamReader(is)
|
||||
) {
|
||||
JsonObject object = new JsonParser().parse(isr).getAsJsonObject();
|
||||
String name = object.get("name").getAsString();
|
||||
this.world_version = object.get("world_version").getAsLong();
|
||||
this.protocol_version = object.get("protocol_version").getAsLong();
|
||||
logger.info("MinecraftVersion: {name='" + name + "', world_version='" + this.world_version + "', protocol_version='" + this.protocol_version + "'}");
|
||||
} catch (Throwable t) {
|
||||
logger.warning("An exception occurred when reading \"version.json\"!");
|
||||
logger.warning(t);
|
||||
}
|
||||
} else {
|
||||
logger.warning("Can't read \"version.json\"! Ignore this message if the version you start is earlier than 18w47b.");
|
||||
}
|
||||
super.onLoad(mixinPackage);
|
||||
|
||||
// This mod will remap extra classes when in the development environment.
|
||||
DevEnvRemapper.initRemapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
boolean result = true;
|
||||
if (mixinClassName.endsWith(".MixinIImageBuffer")) {
|
||||
result = this.world_version <= 2204 && this.protocol_version <= 553; // 18w43b ~ 19w37a
|
||||
} else if (mixinClassName.endsWith(".MixinLayerCape") || mixinClassName.endsWith(".MixinRenderPlayer")) {
|
||||
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V1")) {
|
||||
result = this.world_version <= 3465 && (this.protocol_version <= 763 || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x4000008E)); // 18w43b ~ 1.20.1
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V2") || mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$CacheKey") || mixinClassName.endsWith(".MixinSkinManager$TextureCache")) {
|
||||
result = this.world_version >= 3567 && ((this.protocol_version >= 764 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V3")) {
|
||||
result = this.world_version >= 3684 && ((this.protocol_version >= 765 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x4000009D); // 23w42a+
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V1")) {
|
||||
result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V2")) {
|
||||
result = this.world_version >= 2723 && ((this.protocol_version >= 755 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000023); // 1.17-rc2+
|
||||
}
|
||||
logger.info("target: " + targetClassName + ", mixin: " + mixinClassName + ", result: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
// To be compatible with 0.7.11
|
||||
public void preApply(String targetClassName, org.spongepowered.asm.lib.tree.ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
// To be compatible with 0.7.11
|
||||
public void postApply(String targetClassName, org.spongepowered.asm.lib.tree.ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
accessWidener v2 intermediary
|
||||
accessible method net/minecraft/class_2960 <init> (Ljava/lang/String;Ljava/lang/String;)V
|
||||
@@ -16,5 +16,6 @@
|
||||
"environment": "client",
|
||||
"mixins": [
|
||||
"mixins.customskinloader.json"
|
||||
]
|
||||
],
|
||||
"accessWidener": "customskinloader.accesswidener"
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixinPriority": 1010,
|
||||
"package": "customskinloader.mixin",
|
||||
"client": [
|
||||
"MixinGuiPlayerTabOverlay",
|
||||
"MixinIImageBuffer",
|
||||
"MixinIResource",
|
||||
"MixinIResourceManager",
|
||||
"MixinLayerCape",
|
||||
"MixinMinecraft",
|
||||
"MixinRenderPlayer",
|
||||
"MixinSkinManager$1",
|
||||
"MixinSkinManager$CacheKey",
|
||||
"MixinSkinManager$TextureCache",
|
||||
"MixinSkinManager$V1",
|
||||
"MixinSkinManager$V2",
|
||||
"MixinSkinManager$V3",
|
||||
"MixinThreadDownloadImageData$V1",
|
||||
"MixinThreadDownloadImageData$V2"
|
||||
],
|
||||
"refmap": "mixins.customskinloader.refmap.json",
|
||||
"plugin": "customskinloader.fabric.MixinConfigPlugin",
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixinPriority": 1010,
|
||||
"package": "customskinloader.mixin",
|
||||
"client": [
|
||||
"MixinGuiPlayerTabOverlay",
|
||||
"MixinIImageBuffer",
|
||||
"MixinIResource",
|
||||
"MixinIResourceManager",
|
||||
"MixinLayerCape",
|
||||
"MixinMinecraft",
|
||||
"MixinRenderPlayer",
|
||||
"MixinSkinManager$1",
|
||||
"MixinSkinManager$CacheKey",
|
||||
"MixinSkinManager$TextureCache",
|
||||
"MixinSkinManager$V1",
|
||||
"MixinSkinManager$V2",
|
||||
"MixinSkinManager$V3",
|
||||
"MixinThreadDownloadImageData$V1",
|
||||
"MixinThreadDownloadImageData$V2"
|
||||
],
|
||||
"refmap": "mixins.customskinloader.refmap.json",
|
||||
"plugin": "customskinloader.fabric.MixinConfigPlugin",
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
minecraft_version=1.17.1
|
||||
minecraft_full_versions=1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4
|
||||
java_full_versions=16,17,18,19,20,21
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
srg_notch_map=Forge.tsrg
|
||||
@@ -0,0 +1,15 @@
|
||||
package cpw.mods.cl;
|
||||
|
||||
import java.lang.module.ModuleFinder;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
|
||||
public class JarModuleFinder implements ModuleFinder {
|
||||
public static JarModuleFinder of(SecureJar... jars) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class JarModuleReference {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cpw.mods.jarhandling;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public interface SecureJar {
|
||||
static SecureJar from(final Path... paths) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package java.lang;
|
||||
|
||||
import java.lang.module.Configuration;
|
||||
|
||||
public class ModuleLayer {
|
||||
public static ModuleLayer boot() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Configuration configuration() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package java.lang.module;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Configuration {
|
||||
public static Configuration resolve(ModuleFinder before, List<Configuration> parents, ModuleFinder after, Collection<String> roots) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Configuration empty() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Optional<ResolvedModule> findModule(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package java.lang.module;
|
||||
|
||||
public interface ModuleFinder {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package java.lang.module;
|
||||
|
||||
public class ModuleReference {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package java.lang.module;
|
||||
|
||||
public class ResolvedModule {
|
||||
public ModuleReference reference() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.neoforged.fml.common;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Mod {
|
||||
String value();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
minecraft_version=1.12.2
|
||||
minecraft_full_versions=1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1,1.12.2,1.13.2,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
File renamed without changes.
@@ -0,0 +1,6 @@
|
||||
dependencies=Forge|1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1,1.12.2,1.13.2,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-4
@@ -3,10 +3,6 @@ package customskinloader.forge.transformer;
|
||||
import customskinloader.forge.TransformerManager;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
public class FakeInterfacesTransformer {
|
||||
public static class FakeInterfaceTransformer implements TransformerManager.IClassTransformer {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,8 @@
|
||||
dependencies=Forge|1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4;\
|
||||
NeoForge|1.20.1
|
||||
java_full_versions=16,17,18,19,20,21,22
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
srg_notch_map=Forge.tsrg
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+24
-21
@@ -109,8 +109,8 @@ function initializeCoreMod() {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"))
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"));
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) { // 1.20.1-
|
||||
@@ -126,7 +126,7 @@ function initializeCoreMod() {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/client/resources/SkinManager$CacheKey") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V")) {
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createProperty", "(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/properties/Property;", false))
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createProperty", "(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/properties/Property;", false));
|
||||
} else if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/google/common/cache/LoadingCache") && checkName(node.name, "getUnchecked") && node.desc.equals("(Ljava/lang/Object;)Ljava/lang/Object;")) {
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadCache", "(Lcom/google/common/cache/LoadingCache;Ljava/lang/Object;Lcom/mojang/authlib/GameProfile;)Ljava/lang/Object;", false));
|
||||
@@ -227,6 +227,27 @@ function initializeCoreMod() {
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
'PlayerTabOverlayTransformer': {
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
'name': 'net/minecraft/client/gui/components/PlayerTabOverlay'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.methods.forEach(function (mn) {
|
||||
if ((checkName(mn.name, "m_94544_") && mn.desc.equals("(Lcom/mojang/blaze3d/vertex/PoseStack;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V")) // 1.19.4-
|
||||
|| (checkName(mn.name, "m_280406_") && mn.desc.equals("(Lnet/minecraft/client/gui/GuiGraphics;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V"))) { // 1.20+
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("net/minecraft/client/Minecraft") && checkName(node.name, "m_91090_") && node.desc.equals("()Z")) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||
mn.instructions.set(node, new InsnNode(Opcodes.ICONST_1));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
'RenderPlayer_LayerCapeTransformer': {
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
@@ -318,23 +339,5 @@ function initializeCoreMod() {
|
||||
return mn;
|
||||
}
|
||||
},
|
||||
'PlayerTabOverlayTransformer': {
|
||||
'target': {
|
||||
'type': 'METHOD',
|
||||
'class': 'net/minecraft/client/gui/components/PlayerTabOverlay',
|
||||
'methodName': 'm_94544_',
|
||||
'methodDesc': '(Lcom/mojang/blaze3d/vertex/PoseStack;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V'
|
||||
},
|
||||
'transformer': function (mn) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("net/minecraft/client/Minecraft") && checkName(node.name, "m_91090_") && node.desc.equals("()Z")) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||
mn.instructions.set(node, new InsnNode(Opcodes.ICONST_1));
|
||||
}
|
||||
}
|
||||
return mn;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIResource$V1
|
||||
func_199027_b ()Ljava/io/InputStream; getInputStream
|
||||
customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2
|
||||
open ()Ljava/io/InputStream; open
|
||||
customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager
|
||||
func_199002_a (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/resources/IResource; getResource
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
|
||||
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
|
||||
func_195551_G ()Lnet/minecraft/resources/IResourceManager; getResourceManager
|
||||
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
|
||||
profile ()Lcom/mojang/authlib/GameProfile; profile
|
||||
packedTextures ()Lcom/mojang/authlib/properties/Property; packedTextures
|
||||
net/minecraft/client/Minecraft net/minecraft/client/Minecraft
|
||||
gameDir gameDirectory
|
||||
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; getCurrentServer
|
||||
getMinecraft ()Lnet/minecraft/client/Minecraft; getInstance
|
||||
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; getResourceManager
|
||||
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; getSkinManager
|
||||
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; getTextureManager
|
||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
|
||||
net/minecraft/client/multiplayer/ServerData net/minecraft/client/multiplayer/ServerData
|
||||
serverIP ip
|
||||
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
|
||||
func_228644_e_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; entityTranslucent
|
||||
net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffer
|
||||
func_195786_a (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; process
|
||||
parseUserSkin (Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage; process
|
||||
skinAvailable ()V onTextureDownloaded
|
||||
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
|
||||
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer
|
||||
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer
|
||||
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
|
||||
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
|
||||
func_195699_a (IIIIIIZZ)V copyRect
|
||||
func_195700_a (III)V setPixelRGBA
|
||||
func_195702_a ()I getWidth
|
||||
func_195703_a (Lnet/minecraft/client/renderer/texture/NativeImage;)V copyFrom
|
||||
func_195709_a (II)I getPixelRGBA
|
||||
func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; read
|
||||
func_195714_b ()I getHeight
|
||||
func_195715_a (IIIII)V fillRect
|
||||
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture
|
||||
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
|
||||
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; getTexture
|
||||
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z register
|
||||
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
|
||||
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; getDefaultSkin
|
||||
net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource
|
||||
getInputStream ()Ljava/io/InputStream; getInputStream
|
||||
net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
|
||||
net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager
|
||||
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V registerSkins
|
||||
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; registerTexture
|
||||
net/minecraft/client/resources/SkinManager$1 net/minecraft/client/resources/SkinManager$1
|
||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resources/SkinManager$CacheKey
|
||||
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback
|
||||
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
|
||||
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache
|
||||
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
|
||||
net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
|
||||
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
|
||||
net/minecraft/util/StringUtils net/minecraft/util/StringUtil
|
||||
stripControlCodes (Ljava/lang/String;)Ljava/lang/String; stripColor
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Automatic-Module-Name" : "customskinloader",
|
||||
"MixinConfigs": "mixins.customskinloader.json"
|
||||
])
|
||||
}
|
||||
|
||||
exclude 'net/minecraft/client/resources/**'
|
||||
}
|
||||
sourceJar {
|
||||
exclude 'com/**'
|
||||
exclude 'net/**'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":Forge/Common")
|
||||
}
|
||||
|
||||
import customskinloader.gradle.util.RemapUtil
|
||||
import customskinloader.gradle.util.SourceUtil
|
||||
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
apply from: rootProject.file("buildSrc/patch.gradle")
|
||||
patchMixin()
|
||||
|
||||
mixin {
|
||||
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
||||
reobfSrgFile = "build/mixin.srg"
|
||||
reobfNotchSrgFile = "build/mixin.srg"
|
||||
}
|
||||
|
||||
SourceUtil.addDependencies project, project(":Common"), project(":Vanilla/Common")
|
||||
RemapUtil.remapSources project
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
dependencies=Forge|1.20.6,1.21;\
|
||||
NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21
|
||||
java_full_versions=17,18,19,20,21,22
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
srg_notch_map=Forge.tsrg
|
||||
@@ -0,0 +1,48 @@
|
||||
com/mojang/blaze3d/matrix/MatrixStack com/mojang/blaze3d/vertex/PoseStack
|
||||
net/minecraft/client/Minecraft net/minecraft/client/Minecraft
|
||||
isIntegratedServerRunning ()Z isLocalServer
|
||||
net/minecraft/client/entity/AbstractClientPlayer net/minecraft/client/player/AbstractClientPlayer
|
||||
net/minecraft/client/gui/Gui net/minecraft/client/gui/GuiGraphics
|
||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
|
||||
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V render
|
||||
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V render
|
||||
renderPlayerlist (Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V render
|
||||
net/minecraft/client/model/ModelRenderer net/minecraft/client/model/geom/ModelPart
|
||||
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/HttpTextureProcessor
|
||||
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/MultiBufferSource
|
||||
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
|
||||
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; entitySolid
|
||||
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
|
||||
processTask onDownloaded
|
||||
loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; load
|
||||
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; processLegacySkin
|
||||
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer
|
||||
renderItem (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;Lnet/minecraft/client/model/ModelRenderer;Lnet/minecraft/client/model/ModelRenderer;)V renderHand
|
||||
renderItem (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;Lnet/minecraft/client/entity/AbstractClientPlayer;Lnet/minecraft/client/model/ModelRenderer;Lnet/minecraft/client/model/ModelRenderer;)V renderHand
|
||||
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer
|
||||
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V render
|
||||
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V render
|
||||
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
|
||||
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
|
||||
net/minecraft/client/resources/PlayerSkin net/minecraft/client/resources/PlayerSkin
|
||||
net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager
|
||||
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V lambda$registerSkins$4
|
||||
func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V lambda$registerSkins$2
|
||||
getInsecureSkin (Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin; getInsecureSkin
|
||||
getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; getOrLoad
|
||||
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V registerSkins
|
||||
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; registerTexture
|
||||
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; getInsecureSkinInformation
|
||||
net/minecraft/client/resources/SkinManager$1 net/minecraft/client/resources/SkinManager$1
|
||||
lambda$load$0 (Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo; lambda$load$0
|
||||
lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; lambda$load$0
|
||||
load (Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture; load
|
||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resources/SkinManager$CacheKey
|
||||
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback
|
||||
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache
|
||||
type type
|
||||
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; registerTexture
|
||||
net/minecraft/client/resources/SkinManager$TextureInfo net/minecraft/client/resources/SkinManager$TextureInfo
|
||||
net/minecraft/scoreboard/ScoreObjective net/minecraft/world/scores/Objective
|
||||
net/minecraft/scoreboard/Scoreboard net/minecraft/world/scores/Scoreboard
|
||||
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
|
||||
@@ -0,0 +1,16 @@
|
||||
package customskinloader.forge;
|
||||
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod("customskinloader")
|
||||
public class ForgeMod {
|
||||
public ForgeMod() {
|
||||
this.setExtensionPoint();
|
||||
}
|
||||
|
||||
private void setExtensionPoint() {
|
||||
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> "customskinloader", (remote, isServer) -> isServer));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package customskinloader.forge;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.module.Configuration;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.lang.module.ResolvedModule;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import cpw.mods.cl.JarModuleFinder;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
public class MixinConfigPlugin extends customskinloader.mixin.core.MixinConfigPlugin {
|
||||
private final static MethodHandles.Lookup IMPL_LOOKUP = ((Supplier<MethodHandles.Lookup>) () -> {
|
||||
try {
|
||||
Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
theUnsafeField.setAccessible(true);
|
||||
Unsafe theUnsafe = (Unsafe) theUnsafeField.get(null);
|
||||
Field implLookupField = MethodHandles.Lookup.class.getDeclaredField("IMPL_LOOKUP");
|
||||
return (MethodHandles.Lookup) theUnsafe.getObject(theUnsafe.staticFieldBase(implLookupField), theUnsafe.staticFieldOffset(implLookupField));
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}).get();
|
||||
|
||||
static {
|
||||
try {
|
||||
fixMixinModifyArgs();
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Dynamically creates and configures a fake module to ensure the package (org.spongepowered.asm.synthetic.args) is correctly loaded.
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void fixMixinModifyArgs() throws Throwable {
|
||||
ClassLoader loader = MixinConfigPlugin.class.getClassLoader();
|
||||
Map<String, MethodHandle> handles = findPackageLookup(loader.getClass());
|
||||
if (handles != null) {
|
||||
Map<String, Object> packageToOurModules = (Map<String, Object>) handles.get("packageLookup").invokeWithArguments(loader);
|
||||
String packageName = "org.spongepowered.asm.synthetic.args";
|
||||
if (packageToOurModules.get(packageName) == null) {
|
||||
Path moduleRoot = Paths.get("./CustomSkinLoader/FakeModule");
|
||||
Path classPath = Files.createDirectories(moduleRoot.resolve(packageName.replace('.', '/')));
|
||||
Path classFile = classPath.resolve("package-info.class");
|
||||
if (!Files.exists(classFile)) {
|
||||
Files.createFile(classFile);
|
||||
}
|
||||
|
||||
Configuration config = Configuration.resolve(JarModuleFinder.of(SecureJar.from(moduleRoot)), ImmutableList.of(ModuleLayer.boot().configuration()), JarModuleFinder.of(), ImmutableList.of("FakeModule"));
|
||||
ResolvedModule module = config.findModule("FakeModule").orElse(null);
|
||||
packageToOurModules.put(packageName, module);
|
||||
|
||||
Object configuration = handles.get("configuration").invokeWithArguments(loader);
|
||||
Map<String, ResolvedModule> nameToModule = new HashMap<>((Map<String, ResolvedModule>) handles.get("nameToModuleGetter").invokeWithArguments(configuration));
|
||||
nameToModule.put("FakeModule", module);
|
||||
handles.get("nameToModuleSetter").invokeWithArguments(configuration, nameToModule);
|
||||
|
||||
MethodHandle resolvedRootsGetter = handles.get("resolvedRoots");
|
||||
if (resolvedRootsGetter != null) {
|
||||
((Map<String, ModuleReference>) resolvedRootsGetter.invokeWithArguments(loader)).put("FakeModule", module.reference());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, MethodHandle> findPackageLookup(Class<?> cl) throws Throwable {
|
||||
if (!ClassLoader.class.equals(cl)) {
|
||||
Map<String, MethodHandle> map = new HashMap<>();
|
||||
Field[] fields = cl.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
Type type = field.getGenericType();
|
||||
if (type instanceof ParameterizedType) {
|
||||
ParameterizedType paramType = (ParameterizedType) type;
|
||||
if (Map.class.equals(paramType.getRawType())) {
|
||||
Class<?> classJarModuleReference = findClass("cpw.mods.cl.JarModuleFinder$JarModuleReference");
|
||||
if (Arrays.equals(new Class<?>[] { String.class, ResolvedModule.class }, paramType.getActualTypeArguments())) {
|
||||
map.put("packageLookup", IMPL_LOOKUP.findGetter(cl, field.getName(), field.getType())); // Forge & NeoForge
|
||||
} else if (Arrays.equals(new Class<?>[] { String.class, classJarModuleReference }, paramType.getActualTypeArguments())) {
|
||||
map.put("resolvedRoots", IMPL_LOOKUP.findGetter(cl, field.getName(), field.getType())); // NeoForge
|
||||
}
|
||||
}
|
||||
} else if (Configuration.class.equals(field.getType())) {
|
||||
map.put("configuration", IMPL_LOOKUP.findGetter(cl, field.getName(), field.getType())); // NeoForge
|
||||
map.put("nameToModuleGetter", IMPL_LOOKUP.findGetter(field.getType(), "nameToModule", Map.class)); // NeoForge
|
||||
map.put("nameToModuleSetter", IMPL_LOOKUP.findSetter(field.getType(), "nameToModule", Map.class)); // NeoForge
|
||||
}
|
||||
}
|
||||
if (!map.isEmpty()) {
|
||||
return map;
|
||||
}
|
||||
return findPackageLookup(cl.getSuperclass());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Class<?> findClass(String name) {
|
||||
try {
|
||||
return Class.forName(name);
|
||||
} catch (Throwable t) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package customskinloader.forge;
|
||||
|
||||
import net.neoforged.fml.common.Mod;
|
||||
|
||||
@Mod("customskinloader")
|
||||
public class NeoForgeMod {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
# 1.21+
|
||||
public net.minecraft.resources.ResourceLocation <init>(Ljava/lang/String;Ljava/lang/String;)V
|
||||
@@ -0,0 +1,35 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[0,)" # The javafml version number for neoforge is 1
|
||||
license="GPL-3.0-only"
|
||||
issueTrackerURL="https://github.com/xfl03/MCCustomSkinLoader/issues"
|
||||
clientSideOnly=true # added by forge
|
||||
[[mods]]
|
||||
modId="customskinloader"
|
||||
version="${modFullVersion}"
|
||||
displayName="CustomSkinLoader"
|
||||
displayTest="IGNORE_ALL_VERSION" # neoforge 1.20.4+
|
||||
description='''
|
||||
Custom Skin Loader for Minecraft
|
||||
'''
|
||||
displayURL="https://github.com/xfl03/MCCustomSkinLoader"
|
||||
authors=["xfl03", "JLChnToZ"]
|
||||
[[dependencies.customskinloader]]
|
||||
modId="forge"
|
||||
mandatory=false
|
||||
type="optional" # added by neoforge 1.20.4+
|
||||
versionRange="[50,)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
[[dependencies.customskinloader]]
|
||||
modId="neoforge"
|
||||
mandatory=false
|
||||
type="required" # added by neoforge 1.20.4+
|
||||
versionRange="[20.2,)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
[[dependencies.customskinloader]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.20.2,)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
@@ -0,0 +1,37 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[2,)"
|
||||
license="GPL-3.0-only"
|
||||
issueTrackerURL="https://github.com/xfl03/MCCustomSkinLoader/issues"
|
||||
[[mods]]
|
||||
modId="customskinloader"
|
||||
version="${modFullVersion}"
|
||||
displayName="CustomSkinLoader"
|
||||
authors="xfl03, JLChnToZ"
|
||||
displayTest="IGNORE_ALL_VERSION"
|
||||
description='''
|
||||
Custom Skin Loader for Minecraft
|
||||
'''
|
||||
|
||||
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
|
||||
#[[mixins]]
|
||||
#config="{mod_id}.mixins.json"
|
||||
|
||||
# The [[accessTransformers]] block allows you to declare where your AT file is.
|
||||
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
|
||||
#[[accessTransformers]]
|
||||
#file="META-INF/accesstransformer.cfg"
|
||||
|
||||
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
|
||||
|
||||
[[dependencies.customskinloader]]
|
||||
modId="neoforge"
|
||||
type="required"
|
||||
versionRange="[20.5,)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
[[dependencies.customskinloader]]
|
||||
modId="minecraft"
|
||||
type="required"
|
||||
versionRange="[1.20.5,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixinPriority": 1010,
|
||||
"package": "customskinloader.mixin",
|
||||
"client": [
|
||||
"MixinGuiPlayerTabOverlay",
|
||||
"MixinIResource",
|
||||
"MixinIResourceManager",
|
||||
"MixinLayerCape",
|
||||
"MixinMinecraft",
|
||||
"MixinRenderPlayer",
|
||||
"MixinSkinManager$1",
|
||||
"MixinSkinManager$CacheKey",
|
||||
"MixinSkinManager$TextureCache",
|
||||
"MixinSkinManager$V2",
|
||||
"MixinSkinManager$V3",
|
||||
"MixinThreadDownloadImageData$V2"
|
||||
],
|
||||
"refmap": "mixins.customskinloader.refmap.json",
|
||||
"plugin": "customskinloader.forge.MixinConfigPlugin",
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "CustomSkinLoader resources",
|
||||
"pack_format": 18
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// This subproject is only to provide dependency for other subprojects.
|
||||
|
||||
dependencies {
|
||||
implementation project(':Common')
|
||||
implementation 'org.spongepowered:mixin:0.8.5'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
// Disable Mixin AP
|
||||
// Since 0.8.4, Mixin no longer provide the jar exclude AP, we should disable them manually
|
||||
options.compilerArgs << "-proc:none"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
mappings_version=stable_39
|
||||
# this subproject is only to provide dependency for other subprojects.
|
||||
is_real_project=false
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -40,7 +40,7 @@ public abstract class MixinSkinManager$1 {
|
||||
@Group(
|
||||
name = "lambda$load$0",
|
||||
min = 1,
|
||||
max = 1
|
||||
max = 2
|
||||
)
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$1;lambda$load$0(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo;",
|
||||
@@ -59,7 +59,7 @@ public abstract class MixinSkinManager$1 {
|
||||
@Group(
|
||||
name = "lambda$load$0",
|
||||
min = 1,
|
||||
max = 1
|
||||
max = 2
|
||||
)
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$1;lambda$load$0(Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;",
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,104 @@
|
||||
package customskinloader.mixin.core;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import customskinloader.log.LogManager;
|
||||
import customskinloader.log.Logger;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
public static Logger logger = LogManager.getLogger("Core");
|
||||
private long world_version;
|
||||
private long protocol_version;
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
LogManager.setLogFile(Paths.get("./CustomSkinLoader/CustomSkinLoader.log"));
|
||||
URL versionJson = ClassLoader.getSystemClassLoader().getResource("version.json");
|
||||
if (versionJson != null) {
|
||||
logger.info("\"version.json\": " + versionJson);
|
||||
try (
|
||||
InputStream is = versionJson.openStream();
|
||||
InputStreamReader isr = new InputStreamReader(is)
|
||||
) {
|
||||
JsonObject object = new JsonParser().parse(isr).getAsJsonObject();
|
||||
String name = object.get("name").getAsString();
|
||||
this.world_version = object.get("world_version").getAsLong();
|
||||
this.protocol_version = object.get("protocol_version").getAsLong();
|
||||
logger.info("MinecraftVersion: {name='" + name + "', world_version='" + this.world_version + "', protocol_version='" + this.protocol_version + "'}");
|
||||
} catch (Throwable t) {
|
||||
logger.warning("An exception occurred when reading \"version.json\"!");
|
||||
logger.warning(t);
|
||||
}
|
||||
} else {
|
||||
logger.warning("Can't read \"version.json\"! Ignore this message if the version you start is earlier than 18w47b.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
boolean result = true;
|
||||
if (mixinClassName.endsWith(".MixinIImageBuffer")) {
|
||||
result = this.world_version <= 2204 && this.protocol_version <= 553; // 18w43b ~ 19w37a
|
||||
} else if (mixinClassName.endsWith(".MixinLayerCape") || mixinClassName.endsWith(".MixinRenderPlayer")) {
|
||||
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V1")) {
|
||||
result = this.world_version <= 3465 && (this.protocol_version <= 763 || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x4000008E)); // 18w43b ~ 1.20.1
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V2") || mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$CacheKey") || mixinClassName.endsWith(".MixinSkinManager$TextureCache")) {
|
||||
result = this.world_version >= 3567 && ((this.protocol_version >= 764 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V3")) {
|
||||
result = this.world_version >= 3684 && ((this.protocol_version >= 765 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x4000009D); // 23w42a+
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V1")) {
|
||||
result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V2")) {
|
||||
result = this.world_version >= 2723 && ((this.protocol_version >= 755 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000023); // 1.17-rc2+
|
||||
}
|
||||
logger.info("target: " + targetClassName + ", mixin: " + mixinClassName + ", result: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
// To be compatible with 0.7.11
|
||||
public void preApply(String targetClassName, org.spongepowered.asm.lib.tree.ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
// To be compatible with 0.7.11
|
||||
public void postApply(String targetClassName, org.spongepowered.asm.lib.tree.ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File renamed without changes.
+2
-2
@@ -12,8 +12,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class SkinManager {
|
||||
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { }
|
||||
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { return null; }
|
||||
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) { return null; }
|
||||
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { }
|
||||
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinAvailableCallback skinAvailableCallback) { return null; }
|
||||
public void loadProfileTextures(final GameProfile profile, final SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { }
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) { return null; }
|
||||
|
||||
public interface SkinAvailableCallback {
|
||||
+8
-14
@@ -13,8 +13,6 @@ wrapper {
|
||||
gradleVersion = "4.9"
|
||||
}
|
||||
|
||||
import customskinloader.gradle.util.CurseForgeUtil
|
||||
import customskinloader.gradle.util.ModrinthUtil
|
||||
import customskinloader.gradle.util.RemapUtil
|
||||
import customskinloader.gradle.util.VersionUtil
|
||||
|
||||
@@ -60,11 +58,6 @@ subprojects {
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
exclude "com/**"
|
||||
exclude "net/minecraft/client/renderer/RenderType.class"
|
||||
exclude "net/minecraft/client/renderer/texture/**"
|
||||
exclude "net/minecraft/resources/**"
|
||||
}
|
||||
|
||||
// For real subprojects
|
||||
@@ -76,10 +69,7 @@ subprojects {
|
||||
expand([
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion : project.version,
|
||||
modShortFullVersion: shortVersion,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions : config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
dependencies : VersionUtil.getDependencies(project.ext.config.dependencies.toString()),
|
||||
gitVersion : System.getenv("CIRCLE_SHA1") ?: System.getenv("GITHUB_SHA"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL") ?: "https://github.com/xfl03/MCCustomSkinLoader/actions/runs/" + System.getenv("GITHUB_RUN_ID"),
|
||||
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
@@ -87,6 +77,13 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
exclude "com/**"
|
||||
exclude "net/minecraft/client/renderer/RenderType.class"
|
||||
exclude "net/minecraft/client/renderer/texture/**"
|
||||
exclude "net/minecraft/resources/**"
|
||||
}
|
||||
|
||||
task genSrgMap {
|
||||
doLast {
|
||||
if (!config.srg_notch_map.isEmpty()) {
|
||||
@@ -131,8 +128,5 @@ subprojects {
|
||||
}
|
||||
}
|
||||
build.finalizedBy afterBuild
|
||||
|
||||
CurseForgeUtil.provideCurseForge project
|
||||
ModrinthUtil.provideModrinth project
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
name=CustomSkinLoader
|
||||
group=customskinloader
|
||||
version=14.19.3
|
||||
version=14.20
|
||||
@@ -14,8 +14,7 @@ public class CslLatest {
|
||||
}
|
||||
|
||||
public String getUrl(String edition) {
|
||||
String e = edition.replace("ForgeLegacy", "Forge");
|
||||
return Optional.ofNullable(downloads.get(e))
|
||||
.orElseGet(() -> launchermeta.get(e));
|
||||
return Optional.ofNullable(downloads.get(edition))
|
||||
.orElseGet(() -> launchermeta.get(edition));
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,6 @@ public abstract class UploadBaseTask extends DefaultTask {
|
||||
}
|
||||
StorageService.put(key, file);
|
||||
String mcversion = VersionUtil.getMcVersion(file.getName());
|
||||
if (mcversion.equals("ForgeLegacy")) {
|
||||
mcversion = "Forge";
|
||||
}
|
||||
System.out.printf("csl-%s-%s\t%s%n",
|
||||
mcversion.replace(".", "").toLowerCase(),
|
||||
cslversion, CdnUtil.CLOUDFLARE_CDN_ROOT + key);
|
||||
@@ -66,9 +63,9 @@ public abstract class UploadBaseTask extends DefaultTask {
|
||||
.forEach(project -> {
|
||||
String edition = VersionUtil.getEdition(project);
|
||||
String url = latest.getUrl(edition);
|
||||
VersionUtil.getMcMajorVersions(
|
||||
ConfigUtil.getConfigString(project, "minecraft_full_versions"))
|
||||
.forEach(mcMajorVersion -> detail.addDetail(mcMajorVersion, edition, url));
|
||||
VersionUtil.parseDependencies(ConfigUtil.getConfigString(project, "dependencies"))
|
||||
.forEach((loader, version) -> VersionUtil.getMcMajorVersions(version)
|
||||
.forEach(mcMajorVersion -> detail.addDetail(mcMajorVersion, loader, url)));
|
||||
});
|
||||
|
||||
detail.sortDetails();
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
package customskinloader.gradle.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.matthewprenger.cursegradle.CurseArtifact;
|
||||
import com.matthewprenger.cursegradle.CurseExtension;
|
||||
import com.matthewprenger.cursegradle.CurseUploadTask;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.plugins.BasePluginConvention;
|
||||
|
||||
// https://www.curseforge.com/minecraft/mc-mods/customskinloader
|
||||
public class CurseForgeUtil {
|
||||
public static void provideCurseForge(Project project) {
|
||||
if (!project.getPlugins().hasPlugin("base")) return;
|
||||
|
||||
//Fix "Extension of type 'CurseExtension' does not exist."
|
||||
if (project.getExtensions().findByType(CurseExtension.class) == null) {
|
||||
project.getExtensions().create("curseforge", CurseExtension.class);
|
||||
}
|
||||
|
||||
// We don’t use the task provided by the plugin because it adds some dependencies that we don’t need.
|
||||
project.getTasks().create("publishCurseForge", CurseUploadTask.class, task -> {
|
||||
task.setGroup("publish");
|
||||
task.onlyIf(task0 -> System.getenv("CURSEFORGE_API_KEY") != null);
|
||||
|
||||
task.setApiKey(System.getenv("CURSEFORGE_API_KEY"));
|
||||
task.setProjectId("286924");
|
||||
|
||||
CurseArtifact artifact = new CurseArtifact();
|
||||
artifact.setArtifact(project.getTasks().getByName("jar"));
|
||||
List<Object> gameVersionStrings = new ArrayList<>();
|
||||
Optional.ofNullable(ConfigUtil.getConfigString(project, "minecraft_full_versions"))
|
||||
.ifPresent(versions -> Collections.addAll(gameVersionStrings, versions.split(","))); // Minecraft Versions
|
||||
Optional.ofNullable(ConfigUtil.getConfigString(project, "java_full_versions"))
|
||||
.ifPresent(versions -> {
|
||||
for (String javaVersion : versions.split(",")) {
|
||||
gameVersionStrings.add("Java " + javaVersion); // Java Versions
|
||||
}
|
||||
});
|
||||
gameVersionStrings.addAll(VersionUtil.getLoaders(project));
|
||||
artifact.setGameVersionStrings(gameVersionStrings);
|
||||
artifact.setChangelogType("text");
|
||||
artifact.setChangelog(System.getenv("GIT_COMMIT_DESC"));
|
||||
artifact.setDisplayName(project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName() + "-" + VersionUtil.getShortVersion(project.getRootProject()));
|
||||
artifact.setReleaseType(VersionUtil.isSnapshot(project.getRootProject()) ? "beta" : "release");
|
||||
task.setMainArtifact(artifact);
|
||||
|
||||
task.setAdditionalArtifacts(new ArrayList<>());
|
||||
|
||||
TaskUtil.withTask(project.getRootProject(), "upload", task0 -> task0.finalizedBy(task));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package customskinloader.gradle.util;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.modrinth.minotaur.TaskModrinthUpload;
|
||||
import com.modrinth.minotaur.request.VersionType;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.plugins.BasePluginConvention;
|
||||
|
||||
// https://modrinth.com/mod/customskinloader
|
||||
public class ModrinthUtil {
|
||||
public static void provideModrinth(Project project) {
|
||||
if (!project.getPlugins().hasPlugin("base")) return;
|
||||
|
||||
project.getTasks().create("publishModrinth", TaskModrinthUpload.class, task -> {
|
||||
task.setGroup("publish");
|
||||
task.onlyIf(task0 -> System.getenv("MODRINTH_TOKEN") != null);
|
||||
|
||||
task.token = System.getenv("MODRINTH_TOKEN");
|
||||
task.projectId = "idMHQ4n2";
|
||||
task.versionNumber = VersionUtil.getCSLVersion(project.getRootProject()) + "-" + project.getName().replace("/", "");
|
||||
task.versionName = project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName() + "-" + VersionUtil.getShortVersion(project.getRootProject());
|
||||
task.changelog = System.getenv("GIT_COMMIT_DESC");
|
||||
task.uploadFile = project.getTasks().getByName("jar");
|
||||
task.versionType = VersionUtil.isSnapshot(project.getRootProject()) ? VersionType.BETA : VersionType.RELEASE;
|
||||
task.failSilently = true;
|
||||
task.detectLoaders = false;
|
||||
|
||||
Optional.ofNullable(ConfigUtil.getConfigString(project, "minecraft_full_versions"))
|
||||
.ifPresent(versions -> {
|
||||
for (String gameVersion : versions.split(",")) {
|
||||
task.addGameVersion(gameVersion); // Minecraft Versions
|
||||
}
|
||||
});
|
||||
VersionUtil.getLoaders(project).stream().map(String::toLowerCase).forEach(task::addLoader);
|
||||
|
||||
TaskUtil.withTask(project.getRootProject(), "upload", task0 -> task0.finalizedBy(task));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,6 @@ public class VersionUtil {
|
||||
}
|
||||
|
||||
public static String getMcVersion(String filename) {
|
||||
if (filename.endsWith(".json")) {
|
||||
return filename.substring(0, filename.indexOf('-'));
|
||||
}
|
||||
return filename.substring(filename.indexOf('_') + 1, filename.indexOf('-'));
|
||||
}
|
||||
|
||||
@@ -60,18 +57,26 @@ public class VersionUtil {
|
||||
}
|
||||
|
||||
public static String getEdition(Project project) {
|
||||
return project.getName().contains("Vanilla") ?
|
||||
ConfigUtil.getConfigString(project, "minecraft_version") :
|
||||
project.getName().replace("/", "");
|
||||
return project.getName().replace("/", "");
|
||||
}
|
||||
|
||||
public static List<String> getLoaders(Project project) {
|
||||
String loaderName = project.getName().split("/")[0];
|
||||
List<String> loaders = new ArrayList<>(2);
|
||||
loaders.add(loaderName);
|
||||
if (loaderName.equals("Fabric")) {
|
||||
loaders.add("Quilt");
|
||||
public static Map<String, String> parseDependencies(String dependencies) {
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
if (dependencies != null) {
|
||||
String[] loaderVersions = dependencies.split(";");
|
||||
for (String loader : loaderVersions) {
|
||||
String[] mcVersions = loader.split("\\|");
|
||||
map.put(mcVersions[0], mcVersions[1]);
|
||||
}
|
||||
}
|
||||
return loaders;
|
||||
return map;
|
||||
}
|
||||
|
||||
public static String getDependencies(String dependencies) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String, String> dependency : parseDependencies(dependencies).entrySet()) {
|
||||
sb.append("\"").append(dependency.getKey()).append("\": \"").append(dependency.getValue()).append("\",\n ");
|
||||
}
|
||||
return sb.substring(1, sb.length() - 7);
|
||||
}
|
||||
}
|
||||
+8
-3
@@ -3,12 +3,17 @@ rootProject.name = "MCCustomSkinLoader"
|
||||
//Base Project
|
||||
include "Common"
|
||||
|
||||
//Vanilla Base Project
|
||||
include "Vanilla/Common"
|
||||
|
||||
//Forge Base Project
|
||||
include "Forge/Common"
|
||||
//Forge Edition for [1.8,1.16.5]
|
||||
include "Forge/Legacy"
|
||||
//Forge Edition for [1.17,)
|
||||
include "Forge/Active"
|
||||
include "Forge/V1"
|
||||
//Forge Edition for [1.17,1.20.4]
|
||||
include "Forge/V2"
|
||||
//Forge Edition for [1.20.5,) and NeoForge Edition for [1.20.2,)
|
||||
include "Forge/V3"
|
||||
|
||||
//Fabric Edition for [1.14,)
|
||||
include "Fabric"
|
||||
Reference in new issue
Block a user