mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4cc4740d3 | ||
|
|
d0d71b8557 | ||
|
|
1a15951791 | ||
|
|
a195b42bc4 | ||
|
|
5d2f945d45 | ||
|
|
6bf959de49 | ||
|
|
2f26a07dc9 |
No files matched your search
+22
-14
@@ -27,30 +27,42 @@ There are the available versions in different environments below:
|
||||
```
|
||||
1. Create these folders in the new project directory, then copy the built jar and source jar into it:
|
||||
```
|
||||
Forge 1.8 ~ 1.16.5: ./local-repo/mods/CustomSkinLoader_ForgeLegacy/${version}
|
||||
Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version}
|
||||
Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version}
|
||||
Forge 1.8 ~ 1.16.5: ./local-repo/mods/CustomSkinLoader_ForgeV1/${version}
|
||||
Forge 1.17.1 ~ 1.20.4 / NeoForge 1.20.1: ./local-repo/mods/CustomSkinLoader_ForgeV2/${version}
|
||||
Forge 1.20.6 ~ latest / NeoForge 1.20.2 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeV3/${version}
|
||||
Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version}
|
||||
```
|
||||
*`${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually*
|
||||
1. Create a pom file in the same folder:
|
||||
- Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeLegacy-${version}.pom`
|
||||
- Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeV1-${version}.pom`
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mods</groupId>
|
||||
<artifactId>CustomSkinLoader_ForgeLegacy</artifactId>
|
||||
<artifactId>CustomSkinLoader_ForgeV1</artifactId>
|
||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
||||
<version>${version}</version>
|
||||
</project>
|
||||
```
|
||||
- Forge 1.17.1 ~ latest: `CustomSkinLoader_ForgeActive-${version}.pom`
|
||||
- Forge 1.17.1 ~ 1.20.4 / NeoForge 1.20.1: `CustomSkinLoader_ForgeV2-${version}.pom`
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mods</groupId>
|
||||
<artifactId>CustomSkinLoader_ForgeActive</artifactId>
|
||||
<artifactId>CustomSkinLoader_ForgeV2</artifactId>
|
||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
||||
<version>${version}</version>
|
||||
</project>
|
||||
```
|
||||
- Forge 1.20.6 ~ latest / NeoForge 1.20.2 ~ latest: `CustomSkinLoader_ForgeV3-${version}.pom`
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mods</groupId>
|
||||
<artifactId>CustomSkinLoader_ForgeV3</artifactId>
|
||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
||||
<version>${version}</version>
|
||||
</project>
|
||||
@@ -81,7 +93,7 @@ There are the available versions in different environments below:
|
||||
1. Run `./gradlew setupDecompWorkspace` command.
|
||||
1. Then you can debug the mod in IDE or through `./gradlew runClient` command.
|
||||
|
||||
### For ForgeGradle 3.x ~ 5.x ( forge-1.12.2-14.23.5.2851 ~ latest )
|
||||
### For ForgeGradle 3.x ~ latest ( forge-1.12.2-14.23.5.2851 ~ latest )
|
||||
1. Add below contents to `build.gradle`:
|
||||
```gradle
|
||||
dependencies {
|
||||
@@ -107,12 +119,9 @@ There are the available versions in different environments below:
|
||||
modImplementation "mods:CustomSkinLoader_Fabric:15.0-SNAPSHOT-00"
|
||||
}
|
||||
|
||||
tasks.runClient {
|
||||
args += ["--username", "<Your username>"]
|
||||
}
|
||||
loom.runs.client.programArgs "--username", "<Your username>"
|
||||
```
|
||||
1. Add `--username <Your username>` to CLI arguments in `Run/Debug Configurations` dialog.
|
||||
1. Run the game in IDE or through `./gradlew runClient` command..
|
||||
1. Setup the development environment and run the game as usual.
|
||||
|
||||
## Depend on release builds
|
||||
1. Check the latest version in https://littlesk.in/csl-latest .
|
||||
@@ -145,5 +154,4 @@ There are the available versions in different environments below:
|
||||
|
||||
## Developing
|
||||
- CustomSkinLoader is based on forge-1.12.2-14.23.5.2768 currently, including Fabric edition. We use custom reobfuscation mappings such as [Fabric.tsrg](Fabric/Fabric.tsrg) and [mixin.tsrg](Fabric/mixin.tsrg) to generate different editions jar and Mixin reference jsons.
|
||||
- The source codes are all in `${projectDir}/sources` and resource files are in `${projectDir}/resources` instead of `src/main/java` and `src/main/resources`.
|
||||
- Do not add other required mods.
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -180,7 +180,7 @@ public class CustomSkinLoader {
|
||||
|
||||
if (config.enableLocalProfileCache) {
|
||||
UserProfile profile = profileCache.getLocalProfile(credential);
|
||||
if (profile == null) {
|
||||
if (profile == null || profile.equals(UserProfile.NULL)) {
|
||||
logger.info(username + "'s LocalProfile not found.");
|
||||
} else {
|
||||
profileCache.updateCache(credential, profile, false);
|
||||
@@ -194,6 +194,7 @@ public class CustomSkinLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> INCOMPLETED = ImmutableMap.of();
|
||||
//For Skull
|
||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadProfileFromCache(final GameProfile gameProfile) {
|
||||
String username = gameProfile.getName();
|
||||
@@ -222,7 +223,7 @@ public class CustomSkinLoader {
|
||||
threadPool.execute(loadThread);
|
||||
}
|
||||
}
|
||||
return Maps.newHashMap();
|
||||
return INCOMPLETED;
|
||||
}
|
||||
|
||||
private static Logger initLogger() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Supplier;
|
||||
@@ -20,14 +21,17 @@ import com.mojang.authlib.properties.Property;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||
import customskinloader.fake.texture.FakeThreadDownloadImageData;
|
||||
import customskinloader.loader.MojangAPILoader;
|
||||
import customskinloader.loader.GameProfileLoader;
|
||||
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.AbstractTexture;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.ReloadableTexture;
|
||||
import net.minecraft.client.renderer.texture.SkinTextureDownloader;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.PlayerSkin$Model;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
@@ -35,11 +39,12 @@ import net.minecraft.client.resources.SkinManager$1;
|
||||
import net.minecraft.client.resources.SkinManager$CacheKey;
|
||||
import net.minecraft.client.resources.SkinManager$SkinAvailableCallback;
|
||||
import net.minecraft.client.resources.SkinManager$TextureCache;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FakeSkinManager {
|
||||
/**
|
||||
* 1.20.1-
|
||||
* Invoked from {@link SkinManager(TextureManager , File, MinecraftSessionService)}
|
||||
* Invoked from {@link SkinManager(TextureManager, File, MinecraftSessionService)}
|
||||
*/
|
||||
public static void setSkinCacheDir(File skinCacheDirectory) {
|
||||
HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
|
||||
@@ -108,6 +113,29 @@ public class FakeSkinManager {
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 24w46a+
|
||||
* Invoked from {@link SkinManager$TextureCache#registerTexture(MinecraftProfileTexture)}
|
||||
*/
|
||||
public static CompletableFuture<?> clearCachedFuture(CompletableFuture<?> future) {
|
||||
CompletableFuture<Object> completableFuture = new CompletableFuture<>();
|
||||
future.thenAccept(completableFuture::complete);
|
||||
return completableFuture;
|
||||
}
|
||||
|
||||
/**
|
||||
* 24w46a+
|
||||
* Invoked from {@link SkinTextureDownloader#lambda$registerTextureInManager$2(Minecraft, ResourceLocation, NativeImage)}
|
||||
*/
|
||||
public static void registerTextureInManager(TextureManager manager, ResourceLocation location, AbstractTexture texture) {
|
||||
Object texture0 = FakeInterfaceManager.ResourceLocation_getTexture(location);
|
||||
if (texture0 != null) {
|
||||
manager.registerAndLoad(location, (ReloadableTexture) texture0);
|
||||
} else {
|
||||
manager.loadTexture(location, texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final static String KEY = "CustomSkinLoaderInfo";
|
||||
/**
|
||||
@@ -211,6 +239,18 @@ public class FakeSkinManager {
|
||||
return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, FakeCacheKey.unwrapProperty(property), false));
|
||||
}
|
||||
|
||||
private final static CompletableFuture<?> INCOMPLETED = new CompletableFuture<>();
|
||||
/**
|
||||
* 1.21.6-pre1+
|
||||
* Invoked from {@link SkinManager#registerTextures(UUID, MinecraftProfileTextures)}
|
||||
*/
|
||||
public static CompletableFuture<?> checkIncompleted(MinecraftProfileTextures textures, CompletableFuture<?> future) {
|
||||
if (textures == FakeCacheKey.IncompletedContainer.INCOMPLETED) {
|
||||
return INCOMPLETED;
|
||||
}
|
||||
return future;
|
||||
}
|
||||
|
||||
private static boolean shouldJudgeType(MinecraftProfileTexture texture) {
|
||||
return texture != null && "auto".equals(texture.getMetadata("model"));
|
||||
}
|
||||
@@ -261,7 +301,7 @@ 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));
|
||||
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey), GameProfileLoader.GSON.toJson(profile, GameProfile.class));
|
||||
}
|
||||
return cacheKey;
|
||||
}
|
||||
@@ -275,10 +315,17 @@ public class FakeSkinManager {
|
||||
}
|
||||
|
||||
public static GameProfile unwrapProperty(Property property) {
|
||||
return MojangAPILoader.GSON.fromJson((String) TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property), GameProfile.class); // 23w42a+
|
||||
return GameProfileLoader.GSON.fromJson((String) TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property), GameProfile.class); // 23w42a+
|
||||
}
|
||||
|
||||
public static class IncompletedContainer {
|
||||
public final static Object INCOMPLETED = new MinecraftProfileTextures(null, null, null, SignatureState.SIGNED);
|
||||
}
|
||||
|
||||
public static Object createMinecraftProfileTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
|
||||
if (textures == CustomSkinLoader.INCOMPLETED) {
|
||||
return IncompletedContainer.INCOMPLETED;
|
||||
}
|
||||
return new MinecraftProfileTextures(textures.get(MinecraftProfileTexture.Type.SKIN), textures.get(MinecraftProfileTexture.Type.CAPE), textures.get(MinecraftProfileTexture.Type.ELYTRA), SignatureState.SIGNED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package customskinloader.loader;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
import customskinloader.utils.TextureUtil;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class GameProfileLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader {
|
||||
@Override
|
||||
public ProfileLoader.IProfileLoader getProfileLoader() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IDefaultProfile> getDefaultProfiles() {
|
||||
return Lists.newArrayList(new ServerGameProfile(this));
|
||||
}
|
||||
|
||||
public static class ServerGameProfile implements ICustomSkinLoaderPlugin.IDefaultProfile {
|
||||
protected final GameProfileLoader loader;
|
||||
|
||||
public ServerGameProfile(GameProfileLoader loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "GameProfile";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSkinSiteProfile(SkinSiteProfile ssp) {
|
||||
ssp.type = this.loader.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = getTextures(gameProfile);
|
||||
if (!map.isEmpty()) {
|
||||
CustomSkinLoader.logger.info("Default profile will be used.");
|
||||
return ModelManager0.toUserProfile(map);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "GameProfile";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(SkinSiteProfile ssp) {
|
||||
|
||||
}
|
||||
|
||||
public static final Gson GSON = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
|
||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(GameProfile gameProfile) {
|
||||
if (gameProfile == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
Property textureProperty = Iterables.getFirst(gameProfile.getProperties().get("textures"), null);
|
||||
if (textureProperty == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
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);
|
||||
MinecraftTexturesPayload result = GSON.fromJson(json, MinecraftTexturesPayload.class);
|
||||
|
||||
if (result == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures = TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
|
||||
if (textures == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
return textures;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
|
||||
return Lists.newArrayList(new LocalSkin(this),
|
||||
getCapeProfile(this, "OptiFine", "https://optifine.net/capes/{USERNAME}.png", 810),
|
||||
getCapeProfile(this, "CloakPlus", "http://161.35.130.99/capes/{USERNAME}.png", 840),
|
||||
getCapeProfile(this, "LabyMod", "https://dl.labymod.net/capes/{STANDARD_UUID}", 850),
|
||||
//getCapeProfile(this, "LabyMod", "https://dl.labymod.net/capes/{STANDARD_UUID}", 850),
|
||||
getCapeProfile(this, "Cosmetica", "https://api.cosmetica.cc/get/cloak?username={USERNAME}&uuid={STANDARD_UUID}¬hirdparty", 860)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
package customskinloader.loader;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
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 com.mojang.util.UUIDTypeAdapter;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
@@ -26,7 +17,6 @@ import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import customskinloader.utils.TextureUtil;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader {
|
||||
@@ -88,11 +78,6 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
|
||||
@Override
|
||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) {
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = getTextures(gameProfile);
|
||||
if (!map.isEmpty()) {
|
||||
CustomSkinLoader.logger.info("Default profile will be used.");
|
||||
return ModelManager0.toUserProfile(map);
|
||||
}
|
||||
String username = gameProfile.getName();
|
||||
GameProfile newGameProfile = loadGameProfileCached(ssp.apiRoot, username);
|
||||
if (newGameProfile == null) {
|
||||
@@ -100,7 +85,7 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
return null;
|
||||
}
|
||||
newGameProfile = fillGameProfile(ssp.sessionRoot, newGameProfile);
|
||||
map = getTextures(newGameProfile);
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = GameProfileLoader.getTextures(newGameProfile);
|
||||
if (!map.isEmpty()) {
|
||||
gameProfile.getProperties().putAll(newGameProfile.getProperties());
|
||||
return ModelManager0.toUserProfile(map);
|
||||
@@ -109,7 +94,6 @@ 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) {
|
||||
@@ -119,12 +103,12 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
//Username -> UUID
|
||||
public static GameProfile loadGameProfile(String apiRoot, String username) {
|
||||
//Doc (https://minecraft.wiki/w/Mojang_API#Query_player_UUIDs_in_batch)
|
||||
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(GameProfileLoader.GSON.toJson(Collections.singletonList(username))));
|
||||
if (StringUtils.isEmpty(responce.content)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
GameProfile[] profiles = GSON.fromJson(responce.content, GameProfile[].class);
|
||||
GameProfile[] profiles = GameProfileLoader.GSON.fromJson(responce.content, GameProfile[].class);
|
||||
if (profiles.length == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -160,38 +144,13 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
return profile;
|
||||
}
|
||||
|
||||
MinecraftProfilePropertiesResponse propertiesResponce = GSON.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
|
||||
MinecraftProfilePropertiesResponse propertiesResponce = GameProfileLoader.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));
|
||||
|
||||
return newGameProfile;
|
||||
}
|
||||
|
||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(GameProfile gameProfile) {
|
||||
if (gameProfile == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
Property textureProperty = Iterables.getFirst(gameProfile.getProperties().get("textures"), null);
|
||||
if (textureProperty == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
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);
|
||||
MinecraftTexturesPayload result = GSON.fromJson(json, MinecraftTexturesPayload.class);
|
||||
|
||||
if (result == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures = TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
|
||||
if (textures == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
return textures;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
||||
return (!StringUtils.isNoneEmpty(ssp0.apiRoot) || ssp0.apiRoot.equalsIgnoreCase(ssp1.apiRoot)) || (!StringUtils.isNoneEmpty(ssp0.sessionRoot) || ssp0.sessionRoot.equalsIgnoreCase(ssp1.sessionRoot));
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.ServiceLoader;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.loader.GameProfileLoader;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.loader.LegacyLoader;
|
||||
import customskinloader.loader.MojangAPILoader;
|
||||
@@ -17,6 +18,7 @@ import org.apache.commons.io.FileUtils;
|
||||
|
||||
public class PluginLoader {
|
||||
public static final ICustomSkinLoaderPlugin[] DEFAULT_PLUGINS = new ICustomSkinLoaderPlugin[]{
|
||||
new GameProfileLoader(),
|
||||
new MojangAPILoader(),
|
||||
new LegacyLoader(),
|
||||
new JsonAPILoader(new CustomSkinAPI()),
|
||||
|
||||
@@ -136,7 +136,7 @@ public class DynamicSkullManager {
|
||||
if (staticTextures.get(profile) != null)
|
||||
return staticTextures.get(profile);
|
||||
if (loadingList.contains(profile))
|
||||
return Maps.newHashMap();
|
||||
return CustomSkinLoader.INCOMPLETED;
|
||||
if (dynamicTextures.containsKey(profile)) {
|
||||
SkullTexture texture = dynamicTextures.get(profile);
|
||||
long time = System.currentTimeMillis() - texture.startTime;
|
||||
@@ -153,6 +153,6 @@ public class DynamicSkullManager {
|
||||
});
|
||||
loadThread.setName("Skull " + profile.hashCode());
|
||||
loadThread.start();
|
||||
return Maps.newHashMap();
|
||||
return CustomSkinLoader.INCOMPLETED;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.fake.FakeMinecraftProfileTexture;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -98,9 +99,9 @@ public class ModelManager0 {
|
||||
* @since 13.1
|
||||
*/
|
||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) {
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
|
||||
if (profile == null)
|
||||
return map;
|
||||
return CustomSkinLoader.INCOMPLETED;
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
|
||||
if (profile.skinUrl != null) {
|
||||
Map<String, String> metadata = null;
|
||||
if ("slim".equals(profile.model) || "auto".equals(profile.model)) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ProfileCache {
|
||||
private UserProfile loadLocalProfile(String username){
|
||||
File localProfile=new File(PROFILE_CACHE_DIR,username.toLowerCase()+".json");
|
||||
if(!localProfile.exists()){
|
||||
localProfiles.put(username.toLowerCase(), null);
|
||||
localProfiles.put(username.toLowerCase(), UserProfile.NULL);
|
||||
}
|
||||
try{
|
||||
String json = FileUtils.readFileToString(localProfile, "UTF-8");
|
||||
@@ -99,9 +99,9 @@ public class ProfileCache {
|
||||
return profile;
|
||||
}catch(Exception e){
|
||||
CustomSkinLoader.logger.info("Failed to load LocalProfile.("+e.toString()+")");
|
||||
localProfiles.put(username.toLowerCase(), null);
|
||||
localProfiles.put(username.toLowerCase(), UserProfile.NULL);
|
||||
}
|
||||
return null;
|
||||
return UserProfile.NULL;
|
||||
}
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private void saveLocalProfile(String username, UserProfile profile){
|
||||
|
||||
@@ -15,6 +15,8 @@ import customskinloader.profile.ModelManager0.Model;
|
||||
* @since 13.1
|
||||
*/
|
||||
public class UserProfile {
|
||||
|
||||
public final static UserProfile NULL = new UserProfile();
|
||||
|
||||
/**
|
||||
* Direct url for skin.
|
||||
|
||||
@@ -3,10 +3,12 @@ package net.minecraft.client.renderer.texture;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SkinTextureDownloader {
|
||||
public static CompletableFuture<?> downloadAndRegisterSkin(ResourceLocation location, Path path, String string, boolean b) { return null; }
|
||||
public static NativeImage processLegacySkin(NativeImage nativeImage, String url) { return null; }
|
||||
public static NativeImage lambda$downloadAndRegisterSkin$0(Path path, String url, boolean b) { return null; }
|
||||
public static ResourceLocation lambda$registerTextureInManager$2(Minecraft minecraft, ResourceLocation location, NativeImage image) { return null; }
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.client.resources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -13,11 +14,12 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SkinManager {
|
||||
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { }
|
||||
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager$SkinAvailableCallback skinAvailableCallback) { return null; }
|
||||
public void loadProfileTextures(final GameProfile profile, final SkinManager$SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { }
|
||||
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager$SkinAvailableCallback skinAvailableCallback) { return null; }
|
||||
public void loadProfileTextures(GameProfile profile, SkinManager$SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { }
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) { return null; }
|
||||
public CompletableFuture<?> getOrLoad(GameProfile profile) { return null; }
|
||||
public PlayerSkin getInsecureSkin(GameProfile profile) { return null; }
|
||||
public CompletableFuture<?> registerTextures(UUID uuid, MinecraftProfileTextures textures) { return null; }
|
||||
public void /* lambda$loadProfileTextures$1 */ func_210275_a(GameProfile profile, boolean b, SkinManager$SkinAvailableCallback callback) {}
|
||||
public void /* lambda$null$0 */ func_210276_a(Map<?, ?> map, SkinManager$SkinAvailableCallback callback) {}
|
||||
public static PlayerSkin lambda$registerTextures$1(CompletableFuture<?> skin, String url, CompletableFuture<?> cape, CompletableFuture<?> elytra, PlayerSkin$Model model, MinecraftProfileTextures textures, Void _void) { return null; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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,1.21.4;\
|
||||
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,1.21.4
|
||||
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,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8;\
|
||||
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,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8
|
||||
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
|
||||
|
||||
@@ -29,6 +29,7 @@ net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
|
||||
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/class_10538
|
||||
downloadAndRegisterSkin (Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; method_65861
|
||||
lambda$registerTextureInManager$2 (Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation; method_65864
|
||||
lambda$registerTextureInManager$2 (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/util/ResourceLocation; method_65864
|
||||
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
|
||||
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V method_4616
|
||||
net/minecraft/client/resources/PlayerSkin net/minecraft/class_8685
|
||||
@@ -37,11 +38,13 @@ net/minecraft/client/resources/SkinManager net/minecraft/class_1071
|
||||
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4653
|
||||
func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4655
|
||||
getInsecureSkin (Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin; method_52862
|
||||
getInsecureSkin (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/PlayerSkin;)Lnet/minecraft/client/resources/PlayerSkin; method_72180
|
||||
getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; method_52863
|
||||
lambda$registerTextures$1 (Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Lnet/minecraft/client/resources/PlayerSkin$Model;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;Ljava/lang/Void;)Lnet/minecraft/client/resources/PlayerSkin; method_52861
|
||||
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V method_4652
|
||||
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; method_4651
|
||||
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; method_4654
|
||||
registerTextures (Ljava/util/UUID;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;)Ljava/util/concurrent/CompletableFuture; method_52859
|
||||
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
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"MixinSkinManager$V3",
|
||||
"MixinSkinManager$V4",
|
||||
"MixinSkinManager$V5",
|
||||
"MixinSkinManager$V6",
|
||||
"MixinSkinTextureDownloader",
|
||||
"MixinThreadDownloadImageData$V1",
|
||||
"MixinThreadDownloadImageData$V2"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3,1.21.4;\
|
||||
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,1.21.4
|
||||
dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8;\
|
||||
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,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8
|
||||
java_full_versions=17,18,19,20,21,22
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
|
||||
@@ -29,6 +29,7 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
|
||||
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader
|
||||
downloadAndRegisterSkin (Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; downloadAndRegisterSkin
|
||||
lambda$registerTextureInManager$2 (Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation; lambda$registerTextureInManager$2
|
||||
lambda$registerTextureInManager$2 (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/util/ResourceLocation; lambda$registerTextureInManager$2
|
||||
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
|
||||
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V register
|
||||
net/minecraft/client/resources/PlayerSkin net/minecraft/client/resources/PlayerSkin
|
||||
@@ -37,11 +38,13 @@ net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinMa
|
||||
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
|
||||
getInsecureSkin (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/PlayerSkin;)Lnet/minecraft/client/resources/PlayerSkin; getInsecureSkin
|
||||
getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; getOrLoad
|
||||
lambda$registerTextures$1 (Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Lnet/minecraft/client/resources/PlayerSkin$Model;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;Ljava/lang/Void;)Lnet/minecraft/client/resources/PlayerSkin; lambda$registerTextures$1
|
||||
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
|
||||
registerTextures (Ljava/util/UUID;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;)Ljava/util/concurrent/CompletableFuture; registerTextures
|
||||
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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"MixinSkinManager$V3",
|
||||
"MixinSkinManager$V4",
|
||||
"MixinSkinManager$V5",
|
||||
"MixinSkinManager$V6",
|
||||
"MixinSkinTextureDownloader",
|
||||
"MixinThreadDownloadImageData$V2"
|
||||
],
|
||||
|
||||
+13
@@ -1,5 +1,7 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.fake.FakeSkinManager;
|
||||
@@ -7,7 +9,9 @@ import net.minecraft.client.resources.SkinManager$TextureCache;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArgs;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
||||
|
||||
public abstract class MixinSkinManager$TextureCache {
|
||||
@@ -40,6 +44,15 @@ public abstract class MixinSkinManager$TextureCache {
|
||||
@Shadow
|
||||
private MinecraftProfileTexture.Type type;
|
||||
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At("RETURN"),
|
||||
cancellable = true
|
||||
)
|
||||
private void inject_registerTexture(CallbackInfoReturnable<CompletableFuture<?>> cir) {
|
||||
cir.setReturnValue(FakeSkinManager.clearCachedFuture(cir.getReturnValue()));
|
||||
}
|
||||
|
||||
@ModifyArgs(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At(
|
||||
|
||||
@@ -3,6 +3,7 @@ package customskinloader.mixin;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -18,6 +19,7 @@ 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.PlayerSkin;
|
||||
import net.minecraft.client.resources.PlayerSkin$Model;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
import net.minecraft.client.resources.SkinManager$SkinAvailableCallback;
|
||||
@@ -287,4 +289,25 @@ public abstract class MixinSkinManager {
|
||||
return FakeSkinManager.loadSkinModel(model, textures);
|
||||
}
|
||||
}
|
||||
|
||||
// 1.21.6-pre1+
|
||||
@Mixin(SkinManager.class)
|
||||
public abstract static class V6 {
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;getInsecureSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/PlayerSkin;)Lnet/minecraft/client/resources/PlayerSkin;",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void inject_getInsecureSkin(GameProfile profile, PlayerSkin skin, CallbackInfoReturnable<?> callbackInfoReturnable) {
|
||||
FakeSkinManager.setSkullType(profile);
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;registerTextures(Ljava/util/UUID;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At("RETURN"),
|
||||
cancellable = true
|
||||
)
|
||||
private void inject_registerTextures(UUID uuid, MinecraftProfileTextures textures, CallbackInfoReturnable<CompletableFuture<?>> callbackInfoReturnable) {
|
||||
callbackInfoReturnable.setReturnValue(FakeSkinManager.checkIncompleted(textures, callbackInfoReturnable.getReturnValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||
import customskinloader.fake.FakeSkinManager;
|
||||
import net.minecraft.client.renderer.texture.AbstractTexture;
|
||||
import net.minecraft.client.renderer.texture.ReloadableTexture;
|
||||
import net.minecraft.client.renderer.texture.SkinTextureDownloader;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -14,18 +13,16 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@SuppressWarnings("target")
|
||||
public abstract class MixinSkinTextureDownloader {
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$registerTextureInManager$2(Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation;",
|
||||
method = {
|
||||
"Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$registerTextureInManager$2(Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation;", // 23w46a ~ 1.21.5
|
||||
"Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$registerTextureInManager$2(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/util/ResourceLocation;" // 25w15a+
|
||||
},
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/texture/TextureManager;loadTexture(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V"
|
||||
)
|
||||
)
|
||||
private static void redirect_lambda$registerTextureInManager$2(TextureManager manager, ResourceLocation location, AbstractTexture texture) {
|
||||
Object texture0 = FakeInterfaceManager.ResourceLocation_getTexture(location);
|
||||
if (texture0 != null) {
|
||||
manager.registerAndLoad(location, (ReloadableTexture) texture0);
|
||||
} else {
|
||||
manager.loadTexture(location, texture);
|
||||
}
|
||||
FakeSkinManager.registerTextureInManager(manager, location, texture);
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
result = this.world_version >= 3684 && ((this.protocol_version >= 765 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x4000009D); // 23w42a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V5") || mixinClassName.endsWith(".MixinSkinManager$TextureCache$V2") || mixinClassName.endsWith(".MixinSkinTextureDownloader") || mixinClassName.endsWith(".MixinResourceLocation")) {
|
||||
result = this.world_version >= 4178 && ((this.protocol_version >= 769 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x400000DE); // 23w46a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V6")) {
|
||||
result = this.world_version >= 4430 && ((this.protocol_version >= 771 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x400000FC); // 1.21.6-pre1+
|
||||
} 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")) {
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
name=CustomSkinLoader
|
||||
group=customskinloader
|
||||
version=14.22
|
||||
version=14.25
|
||||
Reference in new issue
Block a user