Compare commits

...
17 Commits
Author SHA1 Message Date
8Mi_Yile bab30e4f0a 修复版本号问题和Quilt标签 (#312)
* [skip ci] fix cannot get minecraft versions

* [skip ci] fix cannot auto add tag `Quilt`
2024-11-08 13:14:45 +08:00
ZekerZhayard 571d61118d Fix #314 (#315) 2024-11-08 08:33:39 +08:00
33 5d3326c333 feat: 14.21 2024-11-06 10:49:15 +08:00
ZekerZhayard b2095998e5 1.21.2 (#311) 2024-10-30 12:31:15 +08:00
ZekerZhayard cdf2fbe644 24w33a (#310) 2024-09-27 20:29:27 +08:00
xand fa0f820143 Bump Fabric and ForgeV3 (Forge & Neoforge) versions to 1.21.1 (#306)
* Bump Fabric and Forge/Neoforge compatibility to 1.21.1

* Bump version to 14.21

* Fix version in build.properties
2024-08-10 21:07:12 +08:00
8Mi_Yile 23f08a3a64 support upload add tag NeoForge (#298)
* Update common.yml

* Update common.yml

* Update common.yml

* Update common.yml

* Update common.yml
2024-08-10 20:50:16 +08:00
ZekerZhayard 3e4b06f5d1 Fix NullPointerException (#299) 2024-08-10 20:49:09 +08:00
33 18d31bed8f feat: 1.21 2024-07-03 00:14:19 +08:00
ZekerZhayard 64490f1d18 Support 1.21. (#297) 2024-07-02 22:43:35 +08:00
33 cd1922844c feat: bump version to 14.19.3 2023-12-21 22:57:00 +08:00
ZekerZhayard 4185e5bb5f Fix #286 (#287) 2023-12-21 22:28:03 +08:00
ZekerZhayard 7fd5ff84ee Fix #284 (#285) 2023-12-18 21:04:28 +08:00
33 d2772697f3 feat: remove forceIgnoreHttpsCertificate for security 2023-12-15 17:39:36 +08:00
ZekerZhayard 0ffa9ef137 23w42a (#281) 2023-12-12 00:04:05 +08:00
33 f4b5954dad feat: version 14.19 2023-12-12 00:03:41 +08:00
8Mi_Yile 009895c018 fix: issues: report-bug: CSL.log is requried (#280)
* Update report_bug.zh_CN.yml

* Update report_bug.en_US.yml
2023-12-06 19:12:30 +08:00
112 changed files with 1175 additions and 739 deletions

No files matched your search

@@ -41,6 +41,8 @@ body:
placeholder: "Ex: https://mclo.gs/xxxxxx"
- type: input
id: csl-log
validations:
required: true
attributes:
label: Link to CustomSkinLoader.log if applicable
description: |
@@ -41,6 +41,8 @@ body:
placeholder: "示例: https://mclo.gs/xxxxxx"
- type: input
id: csl-log
validations:
required: true
attributes:
label: CustomSkinLoader.log 查看地址
description: |
+37 -17
View File
@@ -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
@@ -0,0 +1,7 @@
package com.mojang.authlib;
public enum SignatureState {
UNSIGNED,
INVALID,
SIGNED
}
@@ -0,0 +1,9 @@
package com.mojang.authlib.minecraft;
import com.mojang.authlib.SignatureState;
public class MinecraftProfileTextures {
public MinecraftProfileTextures(MinecraftProfileTexture skin, MinecraftProfileTexture cape, MinecraftProfileTexture elytra, SignatureState signatureState) {
}
}
@@ -70,24 +70,24 @@ public class CustomSkinLoader {
THREAD_POOL.execute(runnable);
}
public static Object loadProfileLazily(GameProfile gameProfile, Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> function) {
public static Object loadProfileLazily(GameProfile gameProfile, Function<UserProfile, ?> function) {
String username = gameProfile.getName();
String credential = MinecraftUtil.getCredential(gameProfile);
// Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713
if (username == null) {
logger.warning("Could not load profile: username is null.");
return function.apply(Maps.newHashMap());
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(Maps.newHashMap());
return function.apply(new UserProfile());
}
Object result = function.apply(loadProfile(gameProfile));
Thread.currentThread().setName(tempName);
Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> func = profileCache.getLastLoader(credential);
Function<UserProfile, ?> func = profileCache.getLastLoader(credential);
if (func != null) {
result = loadProfileLazily(gameProfile, func);
}
@@ -95,7 +95,7 @@ public class CustomSkinLoader {
}
//For User Skin
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadProfile(GameProfile gameProfile) {
public static UserProfile loadProfile(GameProfile gameProfile) {
String credential = MinecraftUtil.getCredential(gameProfile);
UserProfile profile;
if (profileCache.isReady(credential)) {
@@ -113,7 +113,7 @@ public class CustomSkinLoader {
profileCache.setLoading(credential, true);
profile = loadProfile0(gameProfile, false);
}
return ModelManager0.fromUserProfile(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);
@@ -7,14 +7,12 @@ import java.util.function.BiPredicate;
import java.util.function.Predicate;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.fake.texture.FakeBufferedImage;
import customskinloader.fake.texture.FakeImage;
import customskinloader.utils.MinecraftUtil;
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;
@@ -38,13 +36,8 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
private int loaded = 0;
private double ratioX = -1;
private double ratioY = -1;
private final ResourceLocation location;
private String type = null;
public FakeCapeBuffer(ResourceLocation location) {
this.location = location;
}
@Override
public FakeImage parseUserSkin(FakeImage image) {
if (image == null) return null;
@@ -74,9 +67,6 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
if ("cape".equals(this.type)) {
this.image = resetImageFormat(this.image, 0, 0, 22, 17);
this.attachElytra(elytraImage);
if (this.image instanceof FakeBufferedImage) { // before 1.12.2
this.refreshTexture((FakeBufferedImage) this.image);
}
}
}
return this.image;
@@ -156,16 +146,6 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
return defaultReturnValue;
}
// TextureID won't be regenerated when changing resource packs before 1.12.2
private void refreshTexture(FakeBufferedImage image) {
Object textureObj = MinecraftUtil.getTextureManager().getTexture(this.location);
if (textureObj != null) {
// NOTICE: OptiFine modified the upload process of the texture from ThreadDownloadImageData
// Therefore, it may not be correct to simply copy the vanilla behavior
FakeInterfaceManager.ThreadDownloadImageData_resetNewBufferedImage(textureObj, image.getImage());
}
}
// Some cape image doesn't support alpha channel, so reset image format to ARGB
private static FakeImage resetImageFormat(FakeImage image, int startX, int startY, int endX, int endY) {
if (image != null) {
@@ -2,15 +2,16 @@ package customskinloader.fake;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.utils.HttpTextureUtil;
import net.minecraft.util.ResourceLocation;
public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
private final static Map<String, String> MODEL_CACHE = new ConcurrentHashMap<>();
private final HttpTextureUtil.HttpTextureInfo info;
private final Map<String, String> metadata;
private ResourceLocation resourceLocation;
public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) {
super(url, metadata);
@@ -18,22 +19,27 @@ public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
this.metadata = metadata;
}
public void setResourceLocation(ResourceLocation resourceLocation) {
this.resourceLocation = resourceLocation;
}
public ResourceLocation getResourceLocation() {
return this.resourceLocation;
}
@Override
public String getUrl() {
return this.info.url;
}
public void setModule(String module) {
@Override
public String getMetadata(final String key) {
String value = super.getMetadata(key);
if ("model".equals(key) && "auto".equals(value)) {
String model = MODEL_CACHE.get(this.getHash());
if (model != null) {
return model;
}
}
return value;
}
public void setModel(String model) {
if (this.metadata != null) {
this.metadata.put("module", module);
MODEL_CACHE.put(this.getHash(), model);
this.metadata.put("model", model);
}
}
@@ -4,30 +4,30 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.file.Path;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.SignatureState;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
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.FakeInterfaceManager;
import customskinloader.loader.MojangAPILoader;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.TextureUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation;
public class FakeSkinManager {
private final static Map<ResourceLocation, MinecraftProfileTexture> MODEL_CACHE = new ConcurrentHashMap<>();
/**
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, File, MinecraftSessionService)}
*/
@@ -53,28 +53,15 @@ public class FakeSkinManager {
/**
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
*/
public static Object loadCache(LoadingCache<?, ?> loadingCache, Object cacheKey) throws Exception {
return cacheLoader.load(cacheKey);
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#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
*/
public static ResourceLocation setResourceLocation(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
if (profileTexture instanceof FakeMinecraftProfileTexture) {
((FakeMinecraftProfileTexture) profileTexture).setResourceLocation(resourceLocation);
}
return resourceLocation;
}
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
* <p>
* {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);} -> {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, this.fakeManager.getModelCache(profileTexture, resourcelocation));}
* <p>
*/
public static MinecraftProfileTexture getModelCache(MinecraftProfileTexture profileTexture, ResourceLocation location) {
return MODEL_CACHE.getOrDefault(location, profileTexture);
public static Object loadCache(LoadingCache<?, ?> loadingCache, Object cacheKey, GameProfile profile) throws Exception {
return cacheLoader.load(FakeCacheKey.wrapCacheKey(cacheKey, profile));
}
/**
@@ -84,14 +71,11 @@ public class FakeSkinManager {
Object[] params = list.toArray();
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) {
FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
ResourceLocation resourcelocation = fakeProfileTexture.getResourceLocation();
if (fakeProfileTexture.getResourceLocation() != null) {
params[0] = fakeProfileTexture.getCacheFile();
if (params[params.length - 2] instanceof Boolean) {
params[params.length - 2] = true;
}
params[params.length - 1] = new BaseBuffer((Runnable) params[params.length - 1], textureType, resourcelocation, fakeProfileTexture);
params[0] = fakeProfileTexture.getCacheFile();
if (params[params.length - 2] instanceof Boolean) {
params[params.length - 2] = true;
}
params[params.length - 1] = new BaseBuffer((Runnable) params[params.length - 1], textureType, fakeProfileTexture);
}
return params;
}
@@ -101,11 +85,9 @@ public class FakeSkinManager {
/**
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager.SkinAvailableCallback, boolean)}
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void loadProfileTextures(Runnable runnable, GameProfile profile) {
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, m -> {
// This is a hack.
((Multimap) profile.getProperties()).put(KEY, m);
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, p -> {
profile.getProperties().putAll(KEY, p.toProperties());
runnable.run();
return null;
}));
@@ -113,16 +95,16 @@ public class FakeSkinManager {
/**
* 23w31a+
* Invoked from net.minecraft.client.resources.SkinManager$1#load(net.minecraft.client.resources.SkinManager$CacheKey, GameProfile)
* Invoked from net.minecraft.client.resources.SkinManager$1#load(net.minecraft.client.resources.SkinManager$CacheKey)
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Object[] loadProfileTextures(ImmutableList<Object> list, GameProfile profile) {
public static Object[] loadProfileTextures(ImmutableList<Object> list, Object cacheKey) {
Object[] params = list.toArray();
GameProfile profile = FakeCacheKey.unwrapCacheKey(cacheKey);
if (!profile.getProperties().containsKey(SKULL_KEY)) {
final Supplier<?> supplier = (Supplier<?>) params[0];
params[0] = (Supplier<?>) () -> CustomSkinLoader.loadProfileLazily(profile, m -> {
// This is a hack.
((Multimap) profile.getProperties()).put(KEY, m);
params[0] = (Supplier<?>) () -> CustomSkinLoader.loadProfileLazily(profile, p -> {
profile.getProperties().putAll(KEY, p.toProperties());
FakeCacheKey.wrapCacheKey(cacheKey, profile);
return supplier.get();
});
params[1] = CustomSkinLoader.THREAD_POOL;
@@ -135,10 +117,8 @@ public class FakeSkinManager {
/**
* Invoked from {@link SkinManager#lambda$loadProfileTextures$1(GameProfile, boolean, SkinAvailableCallback)}
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
// This is a hack.
return (Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>) ((Optional) profile.getProperties().removeAll(KEY).stream().findFirst()).orElse(Maps.newHashMap());
return ModelManager0.fromUserProfile(UserProfile.fromProperties(profile.getProperties().values()));
}
/**
@@ -163,8 +143,12 @@ public class FakeSkinManager {
profile.getProperties().put(SKULL_KEY, new Property(SKULL_KEY, "true"));
}
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
return CustomSkinLoader.loadProfileFromCache(profile);
}
/**
* 23w31a+
* 23w31a ~ 23w41a
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(GameProfile)
*/
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
@@ -176,8 +160,12 @@ public class FakeSkinManager {
}
}
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
return CustomSkinLoader.loadProfileFromCache(profile);
/**
* 23w42a+
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(SkinManager.CacheKey, MinecraftSessionService)
*/
public static Object loadSkinFromCache(MinecraftSessionService sessionService, Property property) {
return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, FakeCacheKey.unwrapProperty(property), false));
}
private static boolean shouldJudgeType(MinecraftProfileTexture texture) {
@@ -188,18 +176,16 @@ public class FakeSkinManager {
private IImageBuffer buffer;
private final Runnable callback;
private final ResourceLocation location;
private final FakeMinecraftProfileTexture texture;
public BaseBuffer(Runnable callback, MinecraftProfileTexture.Type type, ResourceLocation location, FakeMinecraftProfileTexture texture) {
public BaseBuffer(Runnable callback, MinecraftProfileTexture.Type type, FakeMinecraftProfileTexture texture) {
this.callback = callback;
this.texture = texture;
switch (type) {
case SKIN: this.buffer = new FakeSkinBuffer(); break;
case CAPE: this.buffer = new FakeCapeBuffer(location); break;
case CAPE: this.buffer = new FakeCapeBuffer(); break;
}
this.callback = callback;
this.location = location;
this.texture = texture;
}
@Override
@@ -219,8 +205,7 @@ public class FakeSkinManager {
if (shouldJudgeType(texture) && buffer instanceof FakeSkinBuffer) {
//Auto judge skin type
String type = ((FakeSkinBuffer) buffer).judgeType();
texture.setModule(type);
MODEL_CACHE.put(location, texture);
texture.setModel(type);
}
}
@@ -229,4 +214,29 @@ public class FakeSkinManager {
}
}
}
public static class FakeCacheKey {
public static Object wrapCacheKey(Object cacheKey, GameProfile profile) {
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) {
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) != null) {
return FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey); // 23w31a ~ 23w41a
} else {
return unwrapProperty(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey)); // 23w42a+
}
}
public static GameProfile unwrapProperty(Property property) {
return MojangAPILoader.GSON.fromJson((String) TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property), GameProfile.class); // 23w42a+
}
public static Object createMinecraftProfileTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
return new MinecraftProfileTextures(textures.get(MinecraftProfileTexture.Type.SKIN), textures.get(MinecraftProfileTexture.Type.CAPE), textures.get(MinecraftProfileTexture.Type.ELYTRA), SignatureState.SIGNED);
}
}
}
@@ -1,11 +1,11 @@
package customskinloader.fake.itf;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
import net.minecraft.client.Minecraft;
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;
@@ -19,11 +19,19 @@ public class FakeInterfaceManager {
return ((IFakeIResourceManager) resourceManager).getResource(location);
}
public static IResourceManager Minecraft_getResourceManager(Minecraft minecraft) {
public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G();
}
public static void ThreadDownloadImageData_resetNewBufferedImage(Object threadDownloadImageData, BufferedImage image) {
((IFakeThreadDownloadImageData) threadDownloadImageData).resetNewBufferedImage(image);
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);
}
}
@@ -0,0 +1,12 @@
package customskinloader.fake.itf;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
public interface IFakeSkinManagerCacheKey {
default GameProfile profile() {
return null;
}
Property packedTextures();
}
@@ -1,12 +0,0 @@
package customskinloader.fake.itf;
import java.awt.image.BufferedImage;
// This interface is only available before 1.12.2
public interface IFakeThreadDownloadImageData {
/**
* Reset {@link net.minecraft.client.renderer.ThreadDownloadImageData#bufferedImage} and
* {@link net.minecraft.client.renderer.ThreadDownloadImageData#textureUploaded} to false to refresh texture.
*/
void resetNewBufferedImage(BufferedImage image);
}
@@ -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) {
@@ -109,6 +109,7 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
return null;
}
public static final Gson GSON = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
private static final Map<String, GameProfile> gameProfileCache = new ConcurrentHashMap<>();
public static GameProfile loadGameProfileCached(String apiRoot, String username) {
@@ -118,14 +119,12 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
//Username -> UUID
public static GameProfile loadGameProfile(String apiRoot, String username) {
//Doc (https://wiki.vg/Mojang_API#Playernames_-.3E_UUIDs)
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft").setCacheTime(600).setPayload(gson.toJson(Collections.singletonList(username))));
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft").setCacheTime(600).setPayload(GSON.toJson(Collections.singletonList(username))));
if (StringUtils.isEmpty(responce.content)) {
return null;
}
GameProfile[] profiles = gson.fromJson(responce.content, GameProfile[].class);
GameProfile[] profiles = GSON.fromJson(responce.content, GameProfile[].class);
if (profiles.length == 0) {
return null;
}
@@ -161,8 +160,7 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
return profile;
}
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
MinecraftProfilePropertiesResponse propertiesResponce = gson.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
MinecraftProfilePropertiesResponse propertiesResponce = GSON.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
GameProfile newGameProfile = new GameProfile(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(propertiesResponce), TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME.get(propertiesResponce));
newGameProfile.getProperties().putAll(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES.get(propertiesResponce));
@@ -177,13 +175,12 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
if (textureProperty == null) {
return Maps.newHashMap();
}
String value = TextureUtil.AuthlibField.PROPERTY_VALUE_FIELD.get(textureProperty);
String value = TextureUtil.AuthlibField.PROPERTY_VALUE.get(textureProperty);
if (StringUtils.isBlank(value)) {
return Maps.newHashMap();
}
String json = new String(Base64.decodeBase64(value), StandardCharsets.UTF_8);
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
MinecraftTexturesPayload result = gson.fromJson(json, MinecraftTexturesPayload.class);
MinecraftTexturesPayload result = GSON.fromJson(json, MinecraftTexturesPayload.class);
if (result == null || TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result) == null) {
return Maps.newHashMap();
@@ -29,7 +29,7 @@ public class LogManager {
}
//Set new writer
Files.createDirectories(logFile.getParent());
logWriter = Files.newBufferedWriter(logFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE);
logWriter = Files.newBufferedWriter(logFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
loggers.forEach((k, v) -> v.setWriter(logWriter));
} catch (Exception e) {
e.printStackTrace();
@@ -49,7 +49,7 @@ public class DynamicSkullManager {
staticTextures.put(profile, Maps.newHashMap());
return;
}
String value = TextureUtil.AuthlibField.PROPERTY_VALUE_FIELD.get(textureProperty);
String value = TextureUtil.AuthlibField.PROPERTY_VALUE.get(textureProperty);
if (StringUtils.isBlank(value)) {
staticTextures.put(profile, Maps.newHashMap());
return;
@@ -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;
@@ -17,7 +16,7 @@ public class ProfileCache {
private Map<String, CachedProfile> cachedProfiles = new ConcurrentHashMap<>();
private Map<String, UserProfile> localProfiles = new ConcurrentHashMap<>();
private Map<String, Deque<Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?>>> profileLoaders = new ConcurrentHashMap<>();
private Map<String, Deque<Function<UserProfile, ?>>> profileLoaders = new ConcurrentHashMap<>();
@SuppressWarnings("ResultOfMethodCallIgnored")
public ProfileCache(){
@@ -52,8 +51,8 @@ public class ProfileCache {
return localProfiles.get(username.toLowerCase());
return loadLocalProfile(username);
}
public Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> getLastLoader(String username) {
Deque<Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?>> deque = this.profileLoaders.get(username);
public Function<UserProfile, ?> getLastLoader(String username) {
Deque<Function<UserProfile, ?>> deque = this.profileLoaders.get(username);
if (deque != null) {
return deque.pollLast();
}
@@ -74,7 +73,7 @@ public class ProfileCache {
return;
saveLocalProfile(username,profile);
}
public void putLoader(String username, Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> loader) {
public void putLoader(String username, Function<UserProfile, ?> loader) {
this.profileLoaders.putIfAbsent(username, new ConcurrentLinkedDeque<>());
this.profileLoaders.get(username).offerLast(loader);
}
@@ -1,5 +1,11 @@
package customskinloader.profile;
import java.util.Collection;
import java.util.List;
import com.google.common.collect.Lists;
import com.mojang.authlib.properties.Property;
import customskinloader.utils.TextureUtil;
import org.apache.commons.lang3.StringUtils;
import customskinloader.profile.ModelManager0.Model;
@@ -69,6 +75,34 @@ public class UserProfile {
(StringUtils.isBlank(elytraUrl)?" ":" , ElytraUrl: "+elytraUrl)+
(expiry==0?"":(" , Expiry: "+expiry))+")";
}
public List<Property> toProperties() {
return Lists.newArrayList(
new Property("skinUrl" , nullToValue(this.skinUrl )),
new Property("model" , nullToValue(this.model )),
new Property("capeUrl" , nullToValue(this.capeUrl )),
new Property("elytraUrl", nullToValue(this.elytraUrl))
);
}
public static UserProfile fromProperties(Collection<Property> properties) {
UserProfile profile = new UserProfile();
if (properties != null) {
for (Property property : properties) {
switch ((String) TextureUtil.AuthlibField.PROPERTY_NAME.get(property)) {
case "skinUrl" : profile.skinUrl = nullToValue(TextureUtil.AuthlibField.PROPERTY_VALUE.get(property)); break;
case "model" : profile.model = nullToValue(TextureUtil.AuthlibField.PROPERTY_VALUE.get(property)); break;
case "capeUrl" : profile.capeUrl = nullToValue(TextureUtil.AuthlibField.PROPERTY_VALUE.get(property)); break;
case "elytraUrl": profile.elytraUrl = nullToValue(TextureUtil.AuthlibField.PROPERTY_VALUE.get(property)); break;
}
}
}
return profile;
}
private static String nullToValue(String value) {
return value == null ? "null" : value.equals("null") ? null : value;
}
/**
* Check if the instance is empty.
@@ -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());
}
}
@@ -1,15 +1,21 @@
package customskinloader.utils;
import java.io.File;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.UUID;
import java.util.function.Supplier;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import customskinloader.CustomSkinLoader;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import sun.misc.Unsafe;
public class TextureUtil {
/**
@@ -36,31 +42,53 @@ public class TextureUtil {
}
}
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();
// Some of the classes in Authlib used after Minecraft 23w31a were changed to record classes,
// resulting in changes to method names, so reflection is used here to be compatible with these changes.
public enum AuthlibField {
PROPERTY_VALUE_FIELD(Property.class, "value"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties"),
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures");
PROPERTY_NAME(Property.class, "name", String.class),
PROPERTY_VALUE(Property.class, "value", String.class),
PROPERTY_SIGNATURE(Property.class, "signature", String.class),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id", UUID.class),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name", String.class),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties", PropertyMap.class),
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures", Map.class);
private final Field field;
private final MethodHandle getter;
private final MethodHandle setter;
AuthlibField(Class<?> clazz, String name) {
AuthlibField(Class<?> clazz, String name, Class<?> returnType) {
try {
this.field = clazz.getDeclaredField(name);
this.field.setAccessible(true);
this.getter = IMPL_LOOKUP.findGetter(clazz, name, returnType);
this.setter = IMPL_LOOKUP.findSetter(clazz, name, returnType);
} catch (Throwable t) {
throw new RuntimeException(t);
}
}
@SuppressWarnings("unchecked")
public <T> T get(Object o) {
public <R> R get(Object o) {
try {
return (T) this.field.get(o);
return (R) this.getter.invokeWithArguments(o);
} catch (Throwable t) {
throw new RuntimeException(t);
}
}
public void set(Object o, Object value) {
try {
this.setter.invokeWithArguments(o, value);
} catch (Throwable t) {
throw new RuntimeException(t);
}
+3 -3
View File
@@ -2,9 +2,9 @@
"name": "CustomSkinLoader",
"version": "${modVersion}",
"fullVersion": "${modFullVersion}",
"mcVersion": "${mcVersion}",
"mcFullVersions": "${mcFullVersions}",
"forgeVersion": "${forgeVersion}",
"dependencies": {
"${dependencies}"
},
"gitVersion": "${gitVersion}",
"buildUrl": "${buildUrl}",
"buildTime": "${releaseTime}"
+5 -1
View File
@@ -7,6 +7,11 @@ 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
net/minecraft/client/Minecraft net/minecraft/class_310
gameDir field_1697
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; method_1558
@@ -51,7 +56,6 @@ net/minecraft/client/resources/SkinManager net/minecraft/class_1071
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; method_4656
net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$class_8686
profile ()Lcom/mojang/authlib/GameProfile; comp_1631
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
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/class_1071$class_8687
+1 -45
View File
@@ -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.
}
}
}
+3 -3
View File
@@ -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
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 -1
View File
@@ -35,10 +35,10 @@ net/minecraft/client/resources/SkinManager net/minecraft/class_1071
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; method_4654
net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1
lambda$load$0 (Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo; method_52867
lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; method_54647
load (Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture; method_52868
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$class_8686
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
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/class_1071$class_8687
type field_45641
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; method_52873
@@ -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$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+
+3 -2
View File
@@ -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,25 +1,28 @@
{
"compatibilityLevel": "JAVA_8",
"mixinPriority": 1010,
"package": "customskinloader.mixin",
"client": [
"MixinGuiPlayerTabOverlay",
"MixinIImageBuffer",
"MixinIResource",
"MixinIResourceManager",
"MixinLayerCape",
"MixinMinecraft",
"MixinRenderPlayer",
"MixinSkinManager$1",
"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
}
}
-8
View File
@@ -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
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();
}
-7
View File
@@ -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
@@ -1,55 +0,0 @@
package customskinloader.forge;
import customskinloader.CustomSkinLoader;
import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
import org.apache.commons.lang3.tuple.Pair;
/**
* Forge Mod Container
*/
@Mod(
value = "customskinloader",
modid = "customskinloader",
name = "CustomSkinLoader",
version = "@MOD_FULL_VERSION@",
clientSideOnly = true,
acceptedMinecraftVersions = "[1.8,1.13)",
acceptableRemoteVersions = "*",
certificateFingerprint = "52885f395e68f42e9b3b629ba56ecf606f7d4269"
)//1.13-
public class ForgeMod {
public ForgeMod() {
try {
this.setExtensionPoint();
} catch (Throwable ignored) {
// before forge-1.13.2-25.0.103
}
}
@Mod.EventHandler
public void fingerprintError(FMLFingerprintViolationEvent event) {
if ((boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment") || event.isDirectory()) return;//Development Environment
CustomSkinLoader.logger.warning("!!!Fingerprint ERROR!!!");
CustomSkinLoader.logger.warning("Failed to check fingerprint in file '" + event.getSource().getAbsolutePath() + "'.");
CustomSkinLoader.logger.warning("Excepted Fingerprint: " + event.getExpectedFingerprint());
if (event.getFingerprints().isEmpty()) {
CustomSkinLoader.logger.warning("No Fingerprint Founded.");
} else {
CustomSkinLoader.logger.warning("Founded Fingerprint: ");
for (String s : event.getFingerprints())
CustomSkinLoader.logger.warning(s);
}
throw new RuntimeException("Fingerprint ERROR, please **DO NOT MODIFY** any mod.");
}
// Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible after forge-1.13.2-25.0.107.
private void setExtensionPoint() {
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> "customskinloader", (remote, isServer) -> isServer));
}
}
File renamed without changes.
+6
View File
@@ -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
@@ -0,0 +1,33 @@
package customskinloader.forge;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import org.apache.commons.lang3.tuple.Pair;
/**
* Forge Mod Container
*/
@Mod(
value = "customskinloader",
modid = "customskinloader",
name = "CustomSkinLoader",
version = "@MOD_FULL_VERSION@",
clientSideOnly = true,
acceptedMinecraftVersions = "[1.8,1.13)",
acceptableRemoteVersions = "*"
)//1.13-
public class ForgeMod {
public ForgeMod() {
try {
this.setExtensionPoint();
} catch (Throwable ignored) {
// before forge-1.13.2-25.0.103
}
}
// Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible after forge-1.13.2-25.0.107.
private void setExtensionPoint() {
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> "customskinloader", (remote, isServer) -> isServer));
}
}
@@ -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"));
}
@@ -19,7 +19,6 @@ public class LaunchWrapper implements IClassTransformer {
private static final TransformerManager.IClassTransformer[] CLASS_TRANSFORMERS = {
new FakeInterfacesTransformer.MinecraftTransformer(),
new FakeInterfacesTransformer.IImageBufferTransformer(),
new FakeInterfacesTransformer.ThreadDownloadImageDataTransformer(),
new FakeInterfacesTransformer.ClientIResourceTransformer(),
new FakeInterfacesTransformer.ClientIResourceManagerTransformer(),
new FakeInterfacesTransformer.IResourceTransformer(),
@@ -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 {
@@ -41,28 +37,6 @@ public class FakeInterfacesTransformer {
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.ThreadDownloadImageData"
)
public static class ThreadDownloadImageDataTransformer implements TransformerManager.IClassTransformer {
@Override
public ClassNode transform(ClassNode cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeThreadDownloadImageData");
MethodNode mn = new MethodNode(Opcodes.ACC_PUBLIC, "resetNewBufferedImage", "(Ljava/awt/image/BufferedImage;)V", null, null);
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.add(new InsnNode(Opcodes.ICONST_0));
mn.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, cn.name, TransformerManager.mapFieldName(cn.name, "field_110559_g", "Z"), "Z"));
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, cn.name, TransformerManager.mapFieldName(cn.name, "field_110560_d", "Ljava/awt/image/BufferedImage;"), "Ljava/awt/image/BufferedImage;"));
mn.instructions.add(new InsnNode(Opcodes.RETURN));
cn.methods.add(mn);
return cn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.IResource"
)
@@ -47,26 +47,6 @@ public class SkinManagerTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/util/ResourceLocation") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "<init>") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/String;)V")) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/util/ResourceLocation;", false));
mn.instructions.insert(min, il);
}
}
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/client/resources/SkinManager$SkinAvailableCallback") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "func_180521_a") && TransformerManager.checkMethodDesc(min.desc, "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 4));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
mn.instructions.insertBefore(min, il);
}
}
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/client/renderer/ThreadDownloadImageData") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "<init>") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V")) {
@@ -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
@@ -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"]
}
]
@@ -57,19 +57,6 @@ function initializeCoreMod() {
|| mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;"))) { // 1.14.2+
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/util/ResourceLocation") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/lang/String;)V")) {
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/util/ResourceLocation;", false));
}
if (node.getOpcode() === Opcodes.INVOKEINTERFACE
&& (node.owner.equals("net/minecraft/client/resources/SkinManager$SkinAvailableCallback") // 1.13.2-
|| node.owner.equals("net/minecraft/client/resources/SkinManager$ISkinAvailableCallback")) // 1.14.2+
&& checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 5));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
}
if (node.getOpcode() === Opcodes.INVOKESPECIAL
&& (node.owner.equals("net/minecraft/client/renderer/texture/ThreadDownloadImageData") // 1.13.2-
|| node.owner.equals("net/minecraft/client/renderer/texture/DownloadingTexture")) // 1.14.2+
@@ -197,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,11 @@ 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_
net/minecraft/client/Minecraft net/minecraft/client/Minecraft
gameDir f_91069_
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; m_91089_
@@ -51,7 +56,6 @@ net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinMa
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; m_118825_
net/minecraft/client/resources/SkinManager$1 net/minecraft/client/resources/SkinManager$1
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resources/SkinManager$CacheKey
profile ()Lcom/mojang/authlib/GameProfile; f_290972_
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 m_118856_
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache
File renamed without changes.
+8
View File
@@ -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
@@ -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
@@ -3,7 +3,6 @@ var Handle = getJavaType('org.objectweb.asm.Handle');
var Opcodes = getJavaType('org.objectweb.asm.Opcodes');
var Type = getJavaType('org.objectweb.asm.Type');
var FieldInsnNode = getJavaType('org.objectweb.asm.tree.FieldInsnNode');
var FieldNode = getJavaType('org.objectweb.asm.tree.FieldNode');
var InsnNode = getJavaType('org.objectweb.asm.tree.InsnNode');
var IntInsnNode = getJavaType('org.objectweb.asm.tree.IntInsnNode');
var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
@@ -57,17 +56,6 @@ function initializeCoreMod() {
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) { // 1.20.1-
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if ((node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/resources/ResourceLocation") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/lang/String;)V")) // 1.19-
|| (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("net/minecraft/client/resources/SkinManager") && checkName(node.name, "m_242632_") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Ljava/lang/String;)Lnet/minecraft/resources/ResourceLocation;"))) { // 1.19.1+
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/resources/ResourceLocation;", false));
}
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("net/minecraft/client/resources/SkinManager$SkinTextureCallback") && checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 5));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lnet/minecraft/resources/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
}
if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
var s = "(";
var args = Type.getType(node.desc).getArgumentTypes();
@@ -121,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-
@@ -137,8 +125,11 @@ 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;")) {
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadCache", "(Lcom/google/common/cache/LoadingCache;Ljava/lang/Object;)Ljava/lang/Object;", false));
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));
}
}
}
@@ -164,8 +155,7 @@ function initializeCoreMod() {
}
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/resources/SkinManager$CacheKey", mapName("f_290972_"), "()Lcom/mojang/authlib/GameProfile;", false));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/GameProfile;)[Ljava/lang/Object;", false));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/google/common/collect/ImmutableList;Ljava/lang/Object;)[Ljava/lang/Object;", false));
for (var i = 0; i < args.length; i++) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
@@ -176,18 +166,36 @@ function initializeCoreMod() {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
}
}
} else if (checkName(mn.name, "m_293645_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo;")) {
} else if (checkName(mn.name, "m_293645_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo;")) { // 1.20.2
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
}
}
} else if (checkName(mn.name, "m_304063_") && mn.desc.equals("(Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;")) { // 1.20.3+
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "unpackTextures") && node.desc.equals("(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;")) {
mn.instructions.insert(node, new TypeInsnNode(Opcodes.CHECKCAST, "com/mojang/authlib/minecraft/MinecraftProfileTextures"));
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/properties/Property;)Ljava/lang/Object;", false));
}
}
}
});
return cn;
}
},
'SkinManager$CacheKeyTransformer': { // 1.20.2+
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/resources/SkinManager$CacheKey'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeSkinManagerCacheKey");
return cn;
}
},
'IResourceTransformer': {
'target': {
'type': 'CLASS',
@@ -219,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',
@@ -252,10 +293,7 @@ function initializeCoreMod() {
'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/resources/SkinManager$TextureCache") && checkName(node.name, "m_293729_") && node.desc.equals("(Ljava/lang/String;)Lnet/minecraft/resources/ResourceLocation;")) {
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/resources/ResourceLocation;", false));
} else if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
var s = "(";
var args = Type.getType(node.desc).getArgumentTypes();
for (var i = 0; i < args.length; i++) {
@@ -313,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;
}
},
};
}
+66
View File
@@ -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
+37
View File
@@ -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
+8
View File
@@ -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
+48
View File
@@ -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
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"pack": {
"description": "CustomSkinLoader resources",
"pack_format": 18
}
}
+4 -4
View File
@@ -6,7 +6,7 @@
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/xfl03/MCCustomSkinLoader/beta.yml?style=for-the-badge&label=&logo=Gradle&labelColor=388E3C)](https://github.com/xfl03/MCCustomSkinLoader/actions)
[![Star](https://img.shields.io/github/stars/xfl03/MCCustomSkinLoader?label=&logo=GitHub&labelColor=black&color=FAFAFA&style=for-the-badge)](https://github.com/xfl03/MCCustomSkinLoader/stargazers)
[![Minecraft Version](https://img.shields.io/badge/Minecraft-1.20%20|%201.19%20|%201.18%20|%201.17%20|%201.16%20|%201.15%20|%201.14%20|%201.13%20|%201.12%20|%201.11%20|%201.10%20|%201.9%20|%201.8-green?style=for-the-badge&labelColor=388E3C&color=8BC34A)](https://github.com/xfl03/MCCustomSkinLoader)
[![Minecraft Version](https://img.shields.io/badge/Minecraft-1.21%20|%201.20%20|%201.19%20|%201.18%20|%201.17%20|%201.16%20|%201.15%20|%201.14%20|%201.13%20|%201.12%20|%201.11%20|%201.10%20|%201.9%20|%201.8-green?style=for-the-badge&labelColor=388E3C&color=8BC34A)](https://github.com/xfl03/MCCustomSkinLoader)
## What's this?
Custom Skin Loader mod for Minecraft.
@@ -14,7 +14,7 @@ It's a mod which can load skins and capes from any online source or from your lo
## Download
### Release Build
- [CurseForge](https://minecraft.curseforge.com/projects/customskinloader)
- [CurseForge](https://www.curseforge.com/minecraft/mc-mods/customskinloader)
- [Modrinth](https://modrinth.com/mod/customskinloader)
### Develop Build
@@ -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.
+12
View 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"
}
+5
View File
@@ -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
@@ -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 {
}
@@ -6,11 +6,14 @@ 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.resources.SkinManager;
import net.minecraft.client.resources.SkinManager$1;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@@ -30,9 +33,15 @@ public abstract class MixinSkinManager$1 {
for (int i = 0; i < argsArr.length; i++) {
argsArr[i] = args.get(i);
}
args.setAll(FakeSkinManager.loadProfileTextures(ImmutableList.copyOf(argsArr), cacheKey.profile()));
args.setAll(FakeSkinManager.loadProfileTextures(ImmutableList.copyOf(argsArr), cacheKey));
}
// 23w31a ~ 23w41a
@Group(
name = "lambda$load$0",
min = 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;",
at = @At(
@@ -44,4 +53,23 @@ public abstract class MixinSkinManager$1 {
private static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> redirect_lambda$load$0(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
return FakeSkinManager.loadSkinFromCache(sessionService, profile, requireSecure);
}
// 23w42a+
@Coerce
@Group(
name = "lambda$load$0",
min = 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;",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/authlib/minecraft/MinecraftSessionService;unpackTextures(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;",
remap = false
)
)
private static Object redirect_lambda$load$0(MinecraftSessionService sessionService, Property property) {
return FakeSkinManager.loadSkinFromCache(sessionService, property);
}
}
@@ -0,0 +1,10 @@
package customskinloader.mixin;
import customskinloader.fake.itf.IFakeSkinManagerCacheKey;
import net.minecraft.client.resources.SkinManager;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(SkinManager.CacheKey.class)
public abstract class MixinSkinManager$CacheKey implements IFakeSkinManagerCacheKey {
}
@@ -4,12 +4,10 @@ import com.google.common.collect.ImmutableList;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(SkinManager.TextureCache.class)
@@ -17,18 +15,6 @@ public abstract class MixinSkinManager$TextureCache {
@Shadow
private MinecraftProfileTexture.Type type;
@ModifyVariable(
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
at = @At(
value = "STORE",
ordinal = 0
),
ordinal = 0
)
private ResourceLocation modifyVariable_registerTexture(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
return FakeSkinManager.setResourceLocation(resourceLocation, profileTexture);
}
@ModifyArgs(
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
at = @At(
@@ -13,17 +13,16 @@ 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;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -42,29 +41,6 @@ public abstract class MixinSkinManager {
FakeSkinManager.setSkinCacheDir(skinCacheDirectory);
}
@ModifyVariable(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "STORE",
ordinal = 0
),
ordinal = 0
)
private ResourceLocation modifyVariable_loadSkin(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
return FakeSkinManager.setResourceLocation(resourceLocation, profileTexture);
}
@ModifyArg(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;skinAvailable(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V"
)
)
private MinecraftProfileTexture modifyArg_loadSkin(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
return FakeSkinManager.getModelCache(profileTexture, location);
}
// 18w43b ~ 19w37a
@Group(
name = "modifyArgs_loadSkin",
@@ -250,8 +226,23 @@ public abstract class MixinSkinManager {
remap = false
)
)
private Object redirect_getOrLoad(LoadingCache<?, ?> loadingCache, Object cacheKey) throws Exception {
return FakeSkinManager.loadCache(loadingCache, cacheKey);
private Object redirect_getOrLoad(LoadingCache<?, ?> loadingCache, Object cacheKey, GameProfile profile) throws Exception {
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);
}
}
}
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff. Show more