mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-22 11:59:45 +00:00
1.21.2 (#311)
This commit is contained in:
1 parent
cdf2fbe644
commit
b2095998e5
14 files changed
+54
-18
No files matched your search
@@ -16,7 +16,7 @@ import com.mojang.authlib.minecraft.MinecraftProfileTextures;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.fake.itf.IFakeSkinManagerCacheKey;
|
||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||
import customskinloader.loader.MojangAPILoader;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
@@ -217,21 +217,17 @@ public class FakeSkinManager {
|
||||
|
||||
public static class FakeCacheKey {
|
||||
public static Object wrapCacheKey(Object cacheKey, GameProfile profile) {
|
||||
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
|
||||
if (fakeCacheKey.profile() != null) {
|
||||
return cacheKey; // 23w31a ~ 23w41a
|
||||
} else {
|
||||
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(fakeCacheKey.packedTextures(), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
|
||||
return fakeCacheKey; // 23w42a+
|
||||
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) == null) { // 23w42a+
|
||||
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
|
||||
}
|
||||
return cacheKey;
|
||||
}
|
||||
|
||||
public static GameProfile unwrapCacheKey(Object cacheKey) {
|
||||
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
|
||||
if (fakeCacheKey.profile() != null) {
|
||||
return fakeCacheKey.profile(); // 23w31a ~ 23w41a
|
||||
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) != null) {
|
||||
return FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey); // 23w31a ~ 23w41a
|
||||
} else {
|
||||
return unwrapProperty(fakeCacheKey.packedTextures()); // 23w42a+
|
||||
return unwrapProperty(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey)); // 23w42a+
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -20,4 +22,16 @@ public class FakeInterfaceManager {
|
||||
public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
|
||||
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G();
|
||||
}
|
||||
|
||||
public static int NativeImage_getPixel(Object nativeImage, int x, int y) {
|
||||
return ((IFakeNativeImage) nativeImage).getPixel(x, y);
|
||||
}
|
||||
|
||||
public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) {
|
||||
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile();
|
||||
}
|
||||
|
||||
public static Property SkinManagerCacheKey_packedTextures(Object skinManagerCacheKey) {
|
||||
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).packedTextures();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package customskinloader.fake.itf;
|
||||
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
public interface IFakeNativeImage {
|
||||
default int getPixel(int x, int y) {
|
||||
return ((NativeImage) this).func_195709_a(x, y);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package customskinloader.fake.texture;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
public class FakeNativeImage implements FakeImage {
|
||||
@@ -36,7 +37,7 @@ public class FakeNativeImage implements FakeImage {
|
||||
}
|
||||
|
||||
public int getRGBA(int x, int y) {
|
||||
return image.func_195709_a(x, y);
|
||||
return FakeInterfaceManager.NativeImage_getPixel(image, x, y);
|
||||
}
|
||||
|
||||
public void setRGBA(int x, int y, int rgba) {
|
||||
|
||||
Reference in new issue
Block a user