mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bab30e4f0a | ||
|
|
571d61118d | ||
|
|
5d3326c333 | ||
|
|
b2095998e5 | ||
|
|
cdf2fbe644 | ||
|
|
fa0f820143 | ||
|
|
23f08a3a64 | ||
|
|
3e4b06f5d1 | ||
|
|
18d31bed8f | ||
|
|
64490f1d18 | ||
|
|
cd1922844c | ||
|
|
4185e5bb5f | ||
|
|
7fd5ff84ee | ||
|
|
d2772697f3 |
No files matched your search
@@ -21,10 +21,10 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '8'
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
|
||||
./gradlew clean build --stacktrace
|
||||
-
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
name: Publish to Github Artifact
|
||||
with:
|
||||
name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }}
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
website: [CurseForge_Modrinth]
|
||||
modtype: [Fabric,Forge-Active,Forge-Legacy]
|
||||
modtype: [Fabric,ForgeV1,ForgeV2,ForgeV3]
|
||||
include:
|
||||
-
|
||||
website: ObjectStorage
|
||||
@@ -69,9 +69,9 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout Git Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
name: Download Artifact Zips
|
||||
with:
|
||||
path: build
|
||||
@@ -86,20 +86,40 @@ jobs:
|
||||
id: cslenv
|
||||
run: |
|
||||
output="$(ls build/libs | grep -v "sources")"
|
||||
if [[ "${{ matrix.modtype }}" == "Forge"* ]]; then
|
||||
modloader="Forge"
|
||||
path=$(echo ${{ matrix.modtype }} | sed "s#-#/#")
|
||||
else
|
||||
modloader=${{ matrix.modtype }}
|
||||
path=${{ matrix.modtype }}
|
||||
fi
|
||||
|
||||
case "${{ matrix.modtype }}" in
|
||||
"ForgeV1")
|
||||
modloader="Forge"
|
||||
path=`echo "${{ matrix.modtype }}" | sed 's#V#/V#'`
|
||||
;;
|
||||
"ForgeV2" | "ForgeV3")
|
||||
modloader=$(cat <<EOF
|
||||
Forge
|
||||
NeoForge
|
||||
EOF
|
||||
)
|
||||
path=`echo "${{ matrix.modtype }}" | sed 's#V#/V#'`
|
||||
;;
|
||||
"Fabric")
|
||||
modloader=$(cat <<EOF
|
||||
Fabric
|
||||
Quilt
|
||||
EOF
|
||||
path="${{ matrix.modtype }}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported modtype: ${{ matrix.modtype }}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "path=$path" >> $GITHUB_OUTPUT
|
||||
echo "modloader=$modloader" >> $GITHUB_OUTPUT
|
||||
echo "modloader="$modloader"" >> $GITHUB_OUTPUT
|
||||
echo "filename=$(echo "$output"|grep $(echo ${{ matrix.modtype }}|sed "s#-##") )" >> $GITHUB_OUTPUT
|
||||
echo "version=$(grep "version=" build.properties | grep -v "#" | sed "s/version=//")" >> $GITHUB_OUTPUT
|
||||
echo "edition=$(echo ${{ matrix.modtype }} | sed "s/-//")" >> $GITHUB_OUTPUT
|
||||
echo "minecraft_vers<<EOF" >> $GITHUB_OUTPUT
|
||||
grep "minecraft_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/minecraft_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
|
||||
grep "dependencies=" "$path"/build.properties | grep -v "#" | awk -F '|' '{print $2}' | sed 's#\;\\##' | sed "s/,/\n/g" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
echo "java_vers<<EOF" >> $GITHUB_OUTPUT
|
||||
grep "java_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/java_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
|
||||
@@ -134,7 +154,7 @@ jobs:
|
||||
-
|
||||
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
||||
name: "[GitHub Pre-Release] Upload Tag"
|
||||
uses: richardsimko/update-tag@v1.0.7
|
||||
uses: richardsimko/update-tag@v1
|
||||
with:
|
||||
tag_name: CI-Build
|
||||
env:
|
||||
@@ -142,7 +162,7 @@ jobs:
|
||||
-
|
||||
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
||||
name: "[GitHub Pre-Release] Publish"
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: CustomSkinLoader CI-Build
|
||||
|
||||
@@ -76,14 +76,14 @@ public class CustomSkinLoader {
|
||||
// Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713
|
||||
if (username == null) {
|
||||
logger.warning("Could not load profile: username is null.");
|
||||
return function.apply(null);
|
||||
return function.apply(new UserProfile());
|
||||
}
|
||||
String tempName = Thread.currentThread().getName();
|
||||
Thread.currentThread().setName(username); // Change Thread Name
|
||||
if (profileCache.isLoading(credential)) {
|
||||
profileCache.putLoader(credential, function);
|
||||
Thread.currentThread().setName(tempName);
|
||||
return function.apply(null);
|
||||
return function.apply(new UserProfile());
|
||||
}
|
||||
Object result = function.apply(loadProfile(gameProfile));
|
||||
Thread.currentThread().setName(tempName);
|
||||
@@ -113,7 +113,7 @@ public class CustomSkinLoader {
|
||||
profileCache.setLoading(credential, true);
|
||||
profile = loadProfile0(gameProfile, false);
|
||||
}
|
||||
return profile;
|
||||
return profile == null ? new UserProfile() : profile;
|
||||
}
|
||||
|
||||
//Core
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,7 +27,6 @@ public class Config {
|
||||
//Function
|
||||
public boolean enableDynamicSkull = true;
|
||||
public boolean enableTransparentSkin = true;
|
||||
public boolean forceIgnoreHttpsCertificate = false;
|
||||
public boolean forceLoadAllTextures = true;
|
||||
public boolean enableCape = true;
|
||||
public int threadPoolSize = 8;
|
||||
@@ -76,8 +78,6 @@ public class Config {
|
||||
config.updateLoadlist();
|
||||
config.initLocalFolder();
|
||||
config.threadPoolSize = Math.max(config.threadPoolSize, 1);
|
||||
if (config.forceIgnoreHttpsCertificate)
|
||||
HttpUtil0.ignoreHttpsCertificate();
|
||||
if (config.enableCacheAutoClean && !config.enableLocalProfileCache) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.mojang.authlib.minecraft.MinecraftProfileTextures;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.fake.itf.IFakeSkinManagerCacheKey;
|
||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||
import customskinloader.loader.MojangAPILoader;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
@@ -50,6 +50,13 @@ public class FakeSkinManager {
|
||||
return cacheLoader = loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
|
||||
*/
|
||||
public static Property createProperty(Property property) {
|
||||
return property == null ? new Property(null, null) : new Property(TextureUtil.AuthlibField.PROPERTY_NAME.get(property), TextureUtil.AuthlibField.PROPERTY_VALUE.get(property), TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
|
||||
*/
|
||||
@@ -210,21 +217,17 @@ public class FakeSkinManager {
|
||||
|
||||
public static class FakeCacheKey {
|
||||
public static Object wrapCacheKey(Object cacheKey, GameProfile profile) {
|
||||
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
|
||||
if (fakeCacheKey.profile() != null) {
|
||||
return cacheKey; // 23w31a ~ 23w41a
|
||||
} else {
|
||||
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(fakeCacheKey.packedTextures(), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
|
||||
return fakeCacheKey; // 23w42a+
|
||||
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) == null) { // 23w42a+
|
||||
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
|
||||
}
|
||||
return cacheKey;
|
||||
}
|
||||
|
||||
public static GameProfile unwrapCacheKey(Object cacheKey) {
|
||||
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
|
||||
if (fakeCacheKey.profile() != null) {
|
||||
return fakeCacheKey.profile(); // 23w31a ~ 23w41a
|
||||
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) != null) {
|
||||
return FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey); // 23w31a ~ 23w41a
|
||||
} else {
|
||||
return unwrapProperty(fakeCacheKey.packedTextures()); // 23w42a+
|
||||
return unwrapProperty(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey)); // 23w42a+
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package customskinloader.fake.itf;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -21,4 +22,16 @@ public class FakeInterfaceManager {
|
||||
public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
|
||||
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G();
|
||||
}
|
||||
|
||||
public static int NativeImage_getPixel(Object nativeImage, int x, int y) {
|
||||
return ((IFakeNativeImage) nativeImage).getPixel(x, y);
|
||||
}
|
||||
|
||||
public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) {
|
||||
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile();
|
||||
}
|
||||
|
||||
public static Property SkinManagerCacheKey_packedTextures(Object skinManagerCacheKey) {
|
||||
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).packedTextures();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package customskinloader.fake.itf;
|
||||
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
public interface IFakeNativeImage {
|
||||
default int getPixel(int x, int y) {
|
||||
return ((NativeImage) this).func_195709_a(x, y);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package customskinloader.fake.texture;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
public class FakeNativeImage implements FakeImage {
|
||||
@@ -36,7 +37,7 @@ public class FakeNativeImage implements FakeImage {
|
||||
}
|
||||
|
||||
public int getRGBA(int x, int y) {
|
||||
return image.func_195709_a(x, y);
|
||||
return FakeInterfaceManager.NativeImage_getPixel(image, x, y);
|
||||
}
|
||||
|
||||
public void setRGBA(int x, int y, int rgba) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -20,33 +13,6 @@ public class HttpUtil0 {
|
||||
return url != null && !url.startsWith("http://") && !url.startsWith("https://");
|
||||
}
|
||||
|
||||
//From: http://blog.csdn.net/xiyushiyi/article/details/46685387
|
||||
public static void ignoreHttpsCertificate(){
|
||||
HostnameVerifier doNotVerify = new HostnameVerifier() {
|
||||
|
||||
public boolean verify(String hostname, SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return new X509Certificate[] {};
|
||||
}
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType){}
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType){}
|
||||
}};
|
||||
|
||||
try {
|
||||
SSLContext sc = SSLContext.getInstance("TLS");
|
||||
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||
//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryFacade());
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(doNotVerify);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String parseAddress(String address) {
|
||||
if(StringUtils.isEmpty(address))
|
||||
return null;
|
||||
|
||||
@@ -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();
|
||||
@@ -85,7 +85,6 @@ public class MinecraftUtil {
|
||||
}
|
||||
|
||||
public static String getCredential(GameProfile profile) {
|
||||
return (profile == null || profile.hashCode() == 0) ? null :
|
||||
(profile.getId() == null ? profile.getName() : String.format("%s-%s", profile.getName(), profile.getId()));
|
||||
return profile == null ? null : String.format("%s-%s", profile.getName(), profile.getId());
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
"name": "CustomSkinLoader",
|
||||
"version": "${modVersion}",
|
||||
"fullVersion": "${modFullVersion}",
|
||||
"mcVersion": "${mcVersion}",
|
||||
"mcFullVersions": "${mcFullVersions}",
|
||||
"forgeVersion": "${forgeVersion}",
|
||||
"dependencies": {
|
||||
"${dependencies}"
|
||||
},
|
||||
"gitVersion": "${gitVersion}",
|
||||
"buildUrl": "${buildUrl}",
|
||||
"buildTime": "${releaseTime}"
|
||||
|
||||
@@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486
|
||||
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
|
||||
func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478
|
||||
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
|
||||
getPixel (II)I method_61940
|
||||
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
|
||||
profile ()Lcom/mojang/authlib/GameProfile; comp_1631
|
||||
packedTextures ()Lcom/mojang/authlib/properties/Property; comp_2011
|
||||
|
||||
+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,1.21.1,1.21.2,1.21.3;\
|
||||
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,1.21.1,1.21.2,1.21.3
|
||||
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,104 +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 > 763 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+
|
||||
} 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 # 24w18a+
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
"name": "CustomSkinLoader",
|
||||
"description": "Custom Skin Loader for Minecraft",
|
||||
"authors": ["xfl03", "JLChnToZ"],
|
||||
"authors": ["xfl03", "JLChnToZ", "ZekerZhayard"],
|
||||
"contact": {
|
||||
"homepage": "https://github.com/xfl03/MCCustomSkinLoader",
|
||||
"issues": "https://github.com/xfl03/MCCustomSkinLoader/issues",
|
||||
@@ -16,5 +16,6 @@
|
||||
"environment": "client",
|
||||
"mixins": [
|
||||
"mixins.customskinloader.json"
|
||||
]
|
||||
],
|
||||
"accessWidener": "customskinloader.accesswidener"
|
||||
}
|
||||
@@ -1,26 +1,28 @@
|
||||
{
|
||||
"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",
|
||||
"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",
|
||||
"MixinNativeImage",
|
||||
"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.
+3
@@ -33,6 +33,9 @@ public class ForgeTweaker implements ITweaker {
|
||||
|
||||
@Override
|
||||
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
|
||||
if (gameDir == null) {
|
||||
gameDir = new File(".");
|
||||
}
|
||||
LogManager.setLogFile(gameDir.toPath().resolve("CustomSkinLoader/CustomSkinLoader.log"));
|
||||
}
|
||||
|
||||
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.
+1
-1
@@ -10,7 +10,7 @@ description='''
|
||||
Custom Skin Loader for Minecraft
|
||||
'''
|
||||
displayURL="https://github.com/xfl03/MCCustomSkinLoader"
|
||||
authors=["xfl03", "JLChnToZ"]
|
||||
authors=["xfl03", "JLChnToZ", "ZekerZhayard"]
|
||||
[[dependencies.customskinloader]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
File renamed without changes.
@@ -5,6 +5,6 @@
|
||||
"description": "Custom Skin Loader for Minecraft",
|
||||
"version": "${modFullVersion}",
|
||||
"url": "https://github.com/xfl03/MCCustomSkinLoader",
|
||||
"authorList": ["xfl03", "JLChnToZ"]
|
||||
"authorList": ["xfl03", "JLChnToZ", "ZekerZhayard"]
|
||||
}
|
||||
]
|
||||
File renamed without changes.
+12
@@ -184,6 +184,18 @@ function initializeCoreMod() {
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
'NativeImageTransformer': {
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
'name': 'net/minecraft/client/renderer/texture/NativeImage'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
if (!cn.interfaces.contains("customskinloader/fake/itf/IFakeNativeImage")) {
|
||||
cn.interfaces.add("customskinloader/fake/itf/IFakeNativeImage");
|
||||
}
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
|
||||
// For 1.14+
|
||||
'MinecraftTransformer': {
|
||||
@@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_
|
||||
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
|
||||
func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_
|
||||
customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
|
||||
getPixel (II)I getPixel
|
||||
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
|
||||
profile ()Lcom/mojang/authlib/GameProfile; f_290972_
|
||||
packedTextures ()Lcom/mojang/authlib/properties/Property; f_303729_
|
||||
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.
+1
-1
@@ -10,7 +10,7 @@ description='''
|
||||
Custom Skin Loader for Minecraft
|
||||
'''
|
||||
displayURL="https://github.com/xfl03/MCCustomSkinLoader"
|
||||
authors=["xfl03", "JLChnToZ"]
|
||||
authors=["xfl03", "JLChnToZ", "ZekerZhayard"]
|
||||
[[dependencies.customskinloader]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
File renamed without changes.
+38
-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-
|
||||
@@ -125,7 +125,9 @@ function initializeCoreMod() {
|
||||
} else if (checkName(mn.name, "m_293351_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;")) { // 1.20.2+
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
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;")) {
|
||||
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));
|
||||
} 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));
|
||||
}
|
||||
@@ -225,6 +227,39 @@ function initializeCoreMod() {
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
'NativeImageTransformer': {
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
'name': 'com/mojang/blaze3d/platform/NativeImage'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
if (!cn.interfaces.contains("customskinloader/fake/itf/IFakeNativeImage")) {
|
||||
cn.interfaces.add("customskinloader/fake/itf/IFakeNativeImage");
|
||||
}
|
||||
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',
|
||||
@@ -316,23 +351,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,66 @@
|
||||
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/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
|
||||
getPixel (II)I getPixel
|
||||
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,1.21.1,1.21.3;\
|
||||
NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3
|
||||
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 @@
|
||||
public net.minecraft.resources.ResourceLocation <init>(Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
|
||||
@@ -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", "ZekerZhayard"]
|
||||
[[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, ZekerZhayard"
|
||||
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,25 @@
|
||||
{
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixinPriority": 1010,
|
||||
"package": "customskinloader.mixin",
|
||||
"client": [
|
||||
"MixinGuiPlayerTabOverlay",
|
||||
"MixinIResource",
|
||||
"MixinIResourceManager",
|
||||
"MixinLayerCape",
|
||||
"MixinMinecraft",
|
||||
"MixinNativeImage",
|
||||
"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
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader/actions)
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader/stargazers)
|
||||
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader)
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader)
|
||||
|
||||
## What's this?
|
||||
Custom Skin Loader mod for Minecraft.
|
||||
@@ -105,8 +105,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
## Copyright & LICENSE
|
||||
### Major Contributor
|
||||
- 2013-2014 Jeremy Lam([JLChnToZ](https://github.com/JLChnToZ))
|
||||
- 2014-2023 Alexander Xia([xfl03](https://github.com/xfl03))
|
||||
- 2020-2023 [ZekerZhayard](https://github.com/ZekerZhayard)
|
||||
- 2014-2024 Alexander Xia([xfl03](https://github.com/xfl03))
|
||||
- 2020-2024 [ZekerZhayard](https://github.com/ZekerZhayard)
|
||||
|
||||
### Binary File
|
||||
You could not modify binary file.
|
||||
|
||||
@@ -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.
@@ -0,0 +1,10 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import customskinloader.fake.itf.IFakeNativeImage;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(NativeImage.class)
|
||||
public abstract class MixinNativeImage implements IFakeNativeImage {
|
||||
|
||||
}
|
||||
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.
+16
@@ -13,6 +13,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import customskinloader.fake.FakeSkinManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
@@ -229,4 +230,19 @@ public abstract class MixinSkinManager {
|
||||
return FakeSkinManager.loadCache(loadingCache, cacheKey, profile);
|
||||
}
|
||||
}
|
||||
|
||||
// 23w42a+
|
||||
@Mixin(SkinManager.class)
|
||||
public abstract static class V3 {
|
||||
@ModifyArg(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;getOrLoad(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/resources/SkinManager$CacheKey;<init>(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V"
|
||||
)
|
||||
)
|
||||
private Property modifyArg_getOrLoad(Property property) {
|
||||
return FakeSkinManager.createProperty(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
version=14.21.1
|
||||
@@ -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