Compare commits

...
25 Commits
Author SHA1 Message Date
ZekerZhayard 59a515ba61 Support 1.21.10. (#348) 2025-10-10 20:54:07 +09:00
ZekerZhayard 1f3d19ac6e Support 1.21.9. (#347) 2025-10-07 08:31:05 +09:00
33 1fbe258365 Update build.properties 2025-08-08 23:41:52 +08:00
33 d4cc4740d3 Update build.properties 2025-08-08 23:25:24 +08:00
ZekerZhayard d0d71b8557 Support 1.21.8. Split GameProfileLoader and MojangAPILoader. (#343) 2025-08-08 23:24:20 +08:00
ZekerZhayard 1a15951791 Support 1.21.6. (#341) 2025-06-21 21:54:07 +08:00
33 a195b42bc4 Update build.properties 2025-06-12 23:30:03 +08:00
ZekerZhayard 5d2f945d45 Support 1.21.5 (#334) 2025-03-26 20:06:21 +08:00
ZekerZhayard 6bf959de49 Fix repeated player skull texture download attempts during RenderTick on downloading failure. (#331) 2025-02-08 15:18:05 +08:00
ZekerZhayard 2f26a07dc9 Fix local profile cache. (#327) 2025-01-24 14:27:55 +08:00
33 5764d81d6d Update build.properties 2025-01-16 18:09:29 +08:00
ZekerZhayard 8080aa7ab5 Fix rendering lag when skull's username is empty. (#324) 2025-01-12 00:10:00 +08:00
8Mi_Yile 4d0ebcc1f7 Update common.yml (#323) 2025-01-12 00:08:29 +08:00
ZekerZhayard 1cb4cf40b0 1.21.4 (#321)
* 1.21.4

* Disable making the source jar.
2024-12-23 21:43:38 +08:00
cewno a9b2484b3e 更新与 Mojang API Wiki 相关的地址 (#320) 2024-12-20 12:13:03 +08:00
ZekerZhayard 8e63429293 Fix IllegalAccessError. (#317) 2024-11-12 21:36:24 +08:00
8Mi_Yile aa68af31e5 [skip ci] 修复缺少括号引起的执行问题 (#316)
手生了 还把括号搞丢了 太草了
2024-11-12 12:33:00 +08:00
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
122 changed files with 1429 additions and 626 deletions

No files matched your search

+47 -18
View File
@@ -21,10 +21,10 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Set up JDK name: Set up JDK
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '8' java-version: '8'
@@ -39,7 +39,7 @@ jobs:
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA) export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
./gradlew clean build --stacktrace ./gradlew clean build --stacktrace
- -
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
name: Publish to Github Artifact name: Publish to Github Artifact
with: with:
name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }} name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }}
@@ -53,7 +53,7 @@ jobs:
strategy: strategy:
matrix: matrix:
website: [CurseForge_Modrinth] website: [CurseForge_Modrinth]
modtype: [Fabric,Forge-Active,Forge-Legacy] modtype: [Fabric,ForgeV1,ForgeV2,ForgeV3]
include: include:
- -
website: ObjectStorage website: ObjectStorage
@@ -69,9 +69,9 @@ jobs:
steps: steps:
- -
name: Checkout Git Repository 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 name: Download Artifact Zips
with: with:
path: build path: build
@@ -86,20 +86,41 @@ jobs:
id: cslenv id: cslenv
run: | run: |
output="$(ls build/libs | grep -v "sources")" output="$(ls build/libs | grep -v "sources")"
if [[ "${{ matrix.modtype }}" == "Forge"* ]]; then
modloader="Forge" case "${{ matrix.modtype }}" in
path=$(echo ${{ matrix.modtype }} | sed "s#-#/#") "ForgeV1")
else modloader="Forge"
modloader=${{ matrix.modtype }} path=`echo "${{ matrix.modtype }}" | sed 's#V#/V#'`
path=${{ matrix.modtype }} ;;
fi "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 "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 "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 "version=$(grep "version=" build.properties | grep -v "#" | sed "s/version=//")" >> $GITHUB_OUTPUT
echo "edition=$(echo ${{ matrix.modtype }} | sed "s/-//")" >> $GITHUB_OUTPUT echo "edition=$(echo ${{ matrix.modtype }} | sed "s/-//")" >> $GITHUB_OUTPUT
echo "minecraft_vers<<EOF" >> $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 "EOF" >> $GITHUB_OUTPUT
echo "java_vers<<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 grep "java_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/java_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
@@ -134,7 +155,7 @@ jobs:
- -
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }} if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: "[GitHub Pre-Release] Upload Tag" name: "[GitHub Pre-Release] Upload Tag"
uses: richardsimko/update-tag@v1.0.7 uses: richardsimko/update-tag@v1
with: with:
tag_name: CI-Build tag_name: CI-Build
env: env:
@@ -142,7 +163,7 @@ jobs:
- -
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }} if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: "[GitHub Pre-Release] Publish" name: "[GitHub Pre-Release] Publish"
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
name: CustomSkinLoader CI-Build name: CustomSkinLoader CI-Build
@@ -150,7 +171,7 @@ jobs:
prerelease: true prerelease: true
body_path: build/ci-build.md body_path: build/ci-build.md
files: build/libs/* files: build/libs/*
#iles: "${{ steps.cslenv-github.outputs.pathlist }}" #files: "${{ steps.cslenv-github.outputs.pathlist }}"
- -
if: ${{ matrix.website == 'GitHub-Release' && inputs.type == 'Release' }} if: ${{ matrix.website == 'GitHub-Release' && inputs.type == 'Release' }}
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@@ -161,6 +182,14 @@ jobs:
tag_name: ${{ github.ref }} tag_name: ${{ github.ref }}
#generate_release_notes: true #generate_release_notes: true
files: ${{ steps.cslenv-github.outputs.pathlist }} files: ${{ steps.cslenv-github.outputs.pathlist }}
-
if: ${{ matrix.website == 'ObjectStorage' }}
name: "[ObjectStorage] Force JDK 8"
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'gradle'
- -
if: ${{ matrix.website == 'ObjectStorage' }} if: ${{ matrix.website == 'ObjectStorage' }}
name: "[ObjectStorage] Publish" name: "[ObjectStorage] Publish"
+22 -14
View File
@@ -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: 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.8 ~ 1.16.5: ./local-repo/mods/CustomSkinLoader_ForgeV1/${version}
Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version} Forge 1.17.1 ~ 1.20.4 / NeoForge 1.20.1: ./local-repo/mods/CustomSkinLoader_ForgeV2/${version}
Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${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* *`${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually*
1. Create a pom file in the same folder: 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
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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> <modelVersion>4.0.0</modelVersion>
<groupId>mods</groupId> <groupId>mods</groupId>
<artifactId>CustomSkinLoader_ForgeLegacy</artifactId> <artifactId>CustomSkinLoader_ForgeV1</artifactId>
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually --> <!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
<version>${version}</version> <version>${version}</version>
</project> </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
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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> <modelVersion>4.0.0</modelVersion>
<groupId>mods</groupId> <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}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
<version>${version}</version> <version>${version}</version>
</project> </project>
@@ -81,7 +93,7 @@ There are the available versions in different environments below:
1. Run `./gradlew setupDecompWorkspace` command. 1. Run `./gradlew setupDecompWorkspace` command.
1. Then you can debug the mod in IDE or through `./gradlew runClient` 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`: 1. Add below contents to `build.gradle`:
```gradle ```gradle
dependencies { dependencies {
@@ -107,12 +119,9 @@ There are the available versions in different environments below:
modImplementation "mods:CustomSkinLoader_Fabric:15.0-SNAPSHOT-00" modImplementation "mods:CustomSkinLoader_Fabric:15.0-SNAPSHOT-00"
} }
tasks.runClient { loom.runs.client.programArgs "--username", "<Your username>"
args += ["--username", "<Your username>"]
}
``` ```
1. Add `--username <Your username>` to CLI arguments in `Run/Debug Configurations` dialog. 1. Setup the development environment and run the game as usual.
1. Run the game in IDE or through `./gradlew runClient` command..
## Depend on release builds ## Depend on release builds
1. Check the latest version in https://littlesk.in/csl-latest . 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 ## 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. - 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. - Do not add other required mods.
+5
View File
@@ -0,0 +1,5 @@
// This subproject is only to provide dependency for other subprojects.
dependencies {
implementation project(':Dummy')
}
@@ -4,13 +4,14 @@ import java.io.File;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; 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.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@@ -24,7 +25,9 @@ import customskinloader.profile.DynamicSkullManager;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
import customskinloader.profile.ProfileCache; import customskinloader.profile.ProfileCache;
import customskinloader.profile.UserProfile; import customskinloader.profile.UserProfile;
import customskinloader.utils.LIFOBlockingQueue;
import customskinloader.utils.MinecraftUtil; import customskinloader.utils.MinecraftUtil;
import customskinloader.utils.TextureUtil;
/** /**
* Custom skin loader mod for Minecraft. * Custom skin loader mod for Minecraft.
@@ -49,7 +52,7 @@ public class CustomSkinLoader {
private static final ProfileCache profileCache = new ProfileCache(); private static final ProfileCache profileCache = new ProfileCache();
private static final DynamicSkullManager dynamicSkullManager = new DynamicSkullManager(); private static final DynamicSkullManager dynamicSkullManager = new DynamicSkullManager();
public static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(config.threadPoolSize, config.threadPoolSize, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>()); public static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(config.threadPoolSize, config.threadPoolSize, 1L, TimeUnit.MINUTES, new LIFOBlockingQueue<>(new LinkedBlockingDeque<>()));
//Correct thread name in thread pool //Correct thread name in thread pool
private static final ThreadFactory defaultFactory = Executors.defaultThreadFactory(); private static final ThreadFactory defaultFactory = Executors.defaultThreadFactory();
@@ -70,33 +73,18 @@ public class CustomSkinLoader {
THREAD_POOL.execute(runnable); THREAD_POOL.execute(runnable);
} }
public static Object loadProfileLazily(GameProfile gameProfile, Function<UserProfile, ?> function) { //For User Skin
String username = gameProfile.getName(); public static UserProfile loadProfile(GameProfile gameProfile) {
String username = TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile);
String credential = MinecraftUtil.getCredential(gameProfile); String credential = MinecraftUtil.getCredential(gameProfile);
// Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713 // Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713
if (username == null) { if (username == null) {
logger.warning("Could not load profile: username is null."); logger.warning("Could not load profile: username is null.");
return function.apply(new UserProfile()); return new UserProfile();
} }
String tempName = Thread.currentThread().getName(); String tempName = Thread.currentThread().getName();
Thread.currentThread().setName(username); // Change Thread Name Thread.currentThread().setName(username); // Change Thread Name
if (profileCache.isLoading(credential)) {
profileCache.putLoader(credential, function);
Thread.currentThread().setName(tempName);
return function.apply(new UserProfile());
}
Object result = function.apply(loadProfile(gameProfile));
Thread.currentThread().setName(tempName);
Function<UserProfile, ?> func = profileCache.getLastLoader(credential);
if (func != null) {
result = loadProfileLazily(gameProfile, func);
}
return result;
}
//For User Skin
public static UserProfile loadProfile(GameProfile gameProfile) {
String credential = MinecraftUtil.getCredential(gameProfile);
UserProfile profile; UserProfile profile;
if (profileCache.isReady(credential)) { if (profileCache.isReady(credential)) {
logger.info("Cached profile will be used."); logger.info("Cached profile will be used.");
@@ -113,12 +101,13 @@ public class CustomSkinLoader {
profileCache.setLoading(credential, true); profileCache.setLoading(credential, true);
profile = loadProfile0(gameProfile, false); profile = loadProfile0(gameProfile, false);
} }
Thread.currentThread().setName(tempName);
return profile == null ? new UserProfile() : profile; return profile == null ? new UserProfile() : profile;
} }
//Core //Core
public static UserProfile loadProfile0(GameProfile gameProfile, boolean isSkull) { public static UserProfile loadProfile0(GameProfile gameProfile, boolean isSkull) {
String username = gameProfile.getName(); String username = TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile);
String credential = MinecraftUtil.getCredential(gameProfile); String credential = MinecraftUtil.getCredential(gameProfile);
profileCache.setLoading(credential, true); profileCache.setLoading(credential, true);
@@ -180,7 +169,7 @@ public class CustomSkinLoader {
if (config.enableLocalProfileCache) { if (config.enableLocalProfileCache) {
UserProfile profile = profileCache.getLocalProfile(credential); UserProfile profile = profileCache.getLocalProfile(credential);
if (profile == null) { if (profile == null || profile.equals(UserProfile.NULL)) {
logger.info(username + "'s LocalProfile not found."); logger.info(username + "'s LocalProfile not found.");
} else { } else {
profileCache.updateCache(credential, profile, false); profileCache.updateCache(credential, profile, false);
@@ -194,9 +183,10 @@ public class CustomSkinLoader {
return null; return null;
} }
public final static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> INCOMPLETED = ImmutableMap.of();
//For Skull //For Skull
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadProfileFromCache(final GameProfile gameProfile) { public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadProfileFromCache(final GameProfile gameProfile) {
String username = gameProfile.getName(); String username = TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile);
String credential = MinecraftUtil.getCredential(gameProfile); String credential = MinecraftUtil.getCredential(gameProfile);
//CustomSkinLoader needs username to load standard skin, if username not exist, only textures in NBT can be used //CustomSkinLoader needs username to load standard skin, if username not exist, only textures in NBT can be used
@@ -222,7 +212,7 @@ public class CustomSkinLoader {
threadPool.execute(loadThread); threadPool.execute(loadThread);
} }
} }
return Maps.newHashMap(); return INCOMPLETED;
} }
private static Logger initLogger() { private static Logger initLogger() {
@@ -2,24 +2,27 @@ package customskinloader.fake;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.function.BiPredicate; import java.util.function.BiPredicate;
import java.util.function.Predicate; import java.util.function.Predicate;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.FakeInterfaceManager; import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.fake.texture.FakeImage; import customskinloader.fake.texture.FakeImage;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class FakeCapeBuffer extends FakeSkinBuffer { public class FakeCapeBuffer extends FakeSkinBuffer {
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("minecraft", "textures/entity/elytra.png"); private static final ResourceLocation TEXTURE_ELYTRA_V1 = new ResourceLocation("minecraft", "textures/entity/elytra.png");
private static final ResourceLocation TEXTURE_ELYTRA_V2 = new ResourceLocation("minecraft", "textures/entity/equipment/wings/elytra.png");
private static int loadedGlobal = 0; private static int loadedGlobal = 0;
private static FakeImage elytraImage; private static FakeImage elytraImage;
private static FakeImage loadElytra(FakeImage originalImage) { private static FakeImage loadElytra(FakeImage originalImage) {
loadedGlobal++; loadedGlobal++;
try { try {
InputStream is = FakeInterfaceManager.IResource_getInputStream(FakeInterfaceManager.IResourceManager_getResource(FakeInterfaceManager.Minecraft_getResourceManager(Minecraft.getMinecraft()), TEXTURE_ELYTRA).get()); Object resourceManager = FakeInterfaceManager.Minecraft_getResourceManager(Minecraft.getMinecraft());
InputStream is = FakeInterfaceManager.IResource_getInputStream(FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V1)
.orElseGet(() -> FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V2).orElse(null)));
if (is != null) { if (is != null) {
FakeImage image = originalImage.createImage(is); FakeImage image = originalImage.createImage(is);
if (image.getWidth() % 64 != 0 || image.getHeight() % 32 != 0) { // wtf? if (image.getWidth() % 64 != 0 || image.getHeight() % 32 != 0) { // wtf?
@@ -28,7 +31,8 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
image = resetImageFormat(image, 22, 0, 46, 22); image = resetImageFormat(image, 22, 0, 46, 22);
return image; return image;
} }
} catch (IOException | NoSuchElementException ignored) { } catch (IOException e) {
CustomSkinLoader.logger.warning(e);
} }
return null; return null;
} }
@@ -7,7 +7,6 @@ import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.utils.MinecraftUtil; import customskinloader.utils.MinecraftUtil;
import net.minecraft.client.renderer.ThreadDownloadImageData; import net.minecraft.client.renderer.ThreadDownloadImageData;
@@ -16,15 +15,15 @@ import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager;
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback; import net.minecraft.client.resources.SkinManager$SkinAvailableCallback;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
public class FakeClientPlayer { public class FakeClientPlayer {
/** /**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)} * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager$SkinAvailableCallback)}
*/ */
public static ThreadDownloadImageData putCache(ThreadDownloadImageData threaddownloadimagedata, SkinManager.SkinAvailableCallback skinAvailableCallback, ResourceLocation resourcelocation) { public static ThreadDownloadImageData putCache(ThreadDownloadImageData threaddownloadimagedata, SkinManager$SkinAvailableCallback skinAvailableCallback, ResourceLocation resourcelocation) {
if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer) {//Cache for client player if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer) {//Cache for client player
textureCache.put(resourcelocation, threaddownloadimagedata); textureCache.put(resourcelocation, threaddownloadimagedata);
} }
@@ -69,7 +68,7 @@ public class FakeClientPlayer {
public static Map<ResourceLocation, ITextureObject> textureCache = Maps.newHashMap(); public static Map<ResourceLocation, ITextureObject> textureCache = Maps.newHashMap();
public static class LegacyBuffer implements SkinAvailableCallback { public static class LegacyBuffer implements SkinManager$SkinAvailableCallback {
ResourceLocation resourceLocationIn; ResourceLocation resourceLocationIn;
boolean loaded = false; boolean loaded = false;
@@ -3,8 +3,11 @@ package customskinloader.fake;
import java.io.File; import java.io.File;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.CustomSkinLoader;
import customskinloader.utils.HttpTextureUtil; import customskinloader.utils.HttpTextureUtil;
public class FakeMinecraftProfileTexture extends MinecraftProfileTexture { public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
@@ -12,6 +15,7 @@ public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
private final HttpTextureUtil.HttpTextureInfo info; private final HttpTextureUtil.HttpTextureInfo info;
private final Map<String, String> metadata; private final Map<String, String> metadata;
private final CountDownLatch latch = new CountDownLatch(1);
public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) { public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) {
super(url, metadata); super(url, metadata);
@@ -25,12 +29,24 @@ public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
} }
@Override @Override
public String getMetadata(final String key) { public String getMetadata(String key) {
return this.getMetadata(key, true);
}
public String getMetadata(String key, boolean lock) {
String value = super.getMetadata(key); String value = super.getMetadata(key);
if ("model".equals(key) && "auto".equals(value)) { if ("model".equals(key) && "auto".equals(value)) {
String model = MODEL_CACHE.get(this.getHash()); String model = MODEL_CACHE.get(this.getHash());
if (model != null) { if (model != null) {
return model; return model;
} else {
try {
if (lock && this.latch.await(60L * CustomSkinLoader.config.loadlist.size(), TimeUnit.SECONDS)) {
return this.getMetadata(key, false);
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} }
} }
return value; return value;
@@ -40,6 +56,7 @@ public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
if (this.metadata != null) { if (this.metadata != null) {
MODEL_CACHE.put(this.getHash(), model); MODEL_CACHE.put(this.getHash(), model);
this.metadata.put("model", model); this.metadata.put("model", model);
this.latch.countDown();
} }
} }
@@ -1,6 +1,8 @@
package customskinloader.fake; package customskinloader.fake;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
@@ -9,18 +11,42 @@ import customskinloader.fake.texture.FakeBufferedImage;
import customskinloader.fake.texture.FakeImage; import customskinloader.fake.texture.FakeImage;
import customskinloader.fake.texture.FakeNativeImage; import customskinloader.fake.texture.FakeNativeImage;
import net.minecraft.client.renderer.IImageBuffer; import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.SkinTextureDownloader;
public class FakeSkinBuffer implements IImageBuffer { public class FakeSkinBuffer implements IImageBuffer {
private int ratio = 1;
FakeImage image = null; FakeImage image = null;
//parseUserSkin for 1.15+ /**
* 24w46a+
* Invoked from {@link SkinTextureDownloader#lambda$downloadAndRegisterSkin$0(Path, String, boolean)}
*/
public static NativeImage processLegacySkin(NativeImage image, String url) {
if (image == null)
return null;
FakeImage img = parseUserSkin0(new FakeNativeImage(image));
if (img instanceof FakeNativeImage) {
return FakeNativeImage.Extended.create((FakeNativeImage) img);
}
CustomSkinLoader.logger.warning("Failed to parseUserSkin(downloadAndRegisterSkin).");
return null;
}
/**
* 19w38a ~ 24w45a
* Invoked from {@link ThreadDownloadImageData#loadTexture(InputStream)}
*/
public static NativeImage processLegacySkin(NativeImage image, Runnable processTask, Function<NativeImage, NativeImage> processLegacySkin) { public static NativeImage processLegacySkin(NativeImage image, Runnable processTask, Function<NativeImage, NativeImage> processLegacySkin) {
if (processTask instanceof IImageBuffer) { if (processTask instanceof IImageBuffer) {
return ((IImageBuffer) processTask).func_195786_a(image); return ((IImageBuffer) processTask).func_195786_a(image);
} else if (processLegacySkin != null) {
return processLegacySkin.apply(image);
} else {
return image;
} }
return processLegacySkin.apply(image);
} }
//parseUserSkin for 1.13+ //parseUserSkin for 1.13+
@@ -50,8 +76,12 @@ public class FakeSkinBuffer implements IImageBuffer {
} }
public FakeImage parseUserSkin(FakeImage image) { public FakeImage parseUserSkin(FakeImage image) {
return this.image = parseUserSkin0(image);
}
public static FakeImage parseUserSkin0(FakeImage image) {
if (image == null) return null; if (image == null) return null;
this.ratio = image.getWidth() / 64; int ratio = image.getWidth() / 64;
if (image.getHeight() != image.getWidth()) {//Single Layer if (image.getHeight() != image.getWidth()) {//Single Layer
//Create a new image and copy origin image data //Create a new image and copy origin image data
@@ -77,27 +107,32 @@ public class FakeSkinBuffer implements IImageBuffer {
image.copyArea(52 * ratio, 20 * ratio, -8 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Back image.copyArea(52 * ratio, 20 * ratio, -8 * ratio, 32 * ratio, 4 * ratio, 12 * ratio, true, false);//Back
} }
this.image = image; setAreaDueToConfig(image, 0 * ratio, 0 * ratio, 32 * ratio, 16 * ratio);//Head - 1
setAreaDueToConfig(0 * ratio, 0 * ratio, 32 * ratio, 16 * ratio);//Head - 1 setAreaTransparent(image, 32 * ratio, 0 * ratio, 64 * ratio, 16 * ratio);//Head - 2
setAreaTransparent(32 * ratio, 0 * ratio, 64 * ratio, 16 * ratio);//Head - 2 setAreaDueToConfig(image, 16 * ratio, 16 * ratio, 40 * ratio, 32 * ratio);//Body - 1
setAreaDueToConfig(16 * ratio, 16 * ratio, 40 * ratio, 32 * ratio);//Body - 1 setAreaTransparent(image, 16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);//Body - 2
setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);//Body - 2
setAreaDueToConfig(40 * ratio, 16 * ratio, 56 * ratio, 32 * ratio);//Right Arm - 1 setAreaDueToConfig(image, 40 * ratio, 16 * ratio, 56 * ratio, 32 * ratio);//Right Arm - 1
setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);//Right Arm - 2 setAreaTransparent(image, 40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);//Right Arm - 2
setAreaDueToConfig(0 * ratio, 16 * ratio, 16 * ratio, 32 * ratio);//Right Leg - 1 setAreaDueToConfig(image, 0 * ratio, 16 * ratio, 16 * ratio, 32 * ratio);//Right Leg - 1
setAreaTransparent(0 * ratio, 32 * ratio, 16 * ratio, 48 * ratio);//Right Leg - 2 setAreaTransparent(image, 0 * ratio, 32 * ratio, 16 * ratio, 48 * ratio);//Right Leg - 2
setAreaDueToConfig(32 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);//Left Arm - 1 setAreaDueToConfig(image, 32 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);//Left Arm - 1
setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);//Left Arm - 2 setAreaTransparent(image, 48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);//Left Arm - 2
setAreaDueToConfig(16 * ratio, 48 * ratio, 32 * ratio, 64 * ratio);//Left Leg - 1 setAreaDueToConfig(image, 16 * ratio, 48 * ratio, 32 * ratio, 64 * ratio);//Left Leg - 1
setAreaTransparent(0 * ratio, 48 * ratio, 16 * ratio, 64 * ratio);//Left Leg - 2 setAreaTransparent(image, 0 * ratio, 48 * ratio, 16 * ratio, 64 * ratio);//Left Leg - 2
image.setRatio(ratio);
return image; return image;
} }
/** Judge if the color is transparent or same with background */ /** Judge if the color is transparent or same with background */
static final Function<Integer, Predicate<Integer>> EQU_BG = bgColor -> getA(bgColor) == 0 ? (c) -> getA(c) == 0 : (c) -> c.equals(bgColor); static final Function<Integer, Predicate<Integer>> EQU_BG = bgColor -> getA(bgColor) == 0 ? (c) -> getA(c) == 0 : (c) -> c.equals(bgColor);
public String judgeType() {
return judgeType0(this.image);
}
/** /**
* Judge the type of skin * Judge the type of skin
* Must be called after parseUserSkin * Must be called after parseUserSkin
@@ -105,9 +140,10 @@ public class FakeSkinBuffer implements IImageBuffer {
* @return type of skin (slim / default) * @return type of skin (slim / default)
* @since 14.9 * @since 14.9
*/ */
public String judgeType() { public static String judgeType0(FakeImage image) {
if (this.image == null) if (image == null)
return "default"; return "default";
int ratio = image.getRatio();
int bgColor = image.getRGBA(63 * ratio, 20 * ratio); int bgColor = image.getRGBA(63 * ratio, 20 * ratio);
/* /*
* If background is transparent, all the pixels in ((54, 20), (55, 31)) areas is transparent, * If background is transparent, all the pixels in ((54, 20), (55, 31)) areas is transparent,
@@ -134,7 +170,7 @@ public class FakeSkinBuffer implements IImageBuffer {
private static final int WHITE = getARGB(255, 255, 255, 255); private static final int WHITE = getARGB(255, 255, 255, 255);
private static final int BLACK = getARGB(255, 0, 0, 0); private static final int BLACK = getARGB(255, 0, 0, 0);
private boolean isFilled(int x0, int y0, int x1, int y1) { private static boolean isFilled(FakeImage image, int x0, int y0, int x1, int y1) {
int data = image.getRGBA(x0, y0); int data = image.getRGBA(x0, y0);
if (data != WHITE && data != BLACK) if (data != WHITE && data != BLACK)
return false; return false;
@@ -145,8 +181,8 @@ public class FakeSkinBuffer implements IImageBuffer {
return true; return true;
} }
private void setAreaTransparent(int x0, int y0, int x1, int y1) { private static void setAreaTransparent(FakeImage image, int x0, int y0, int x1, int y1) {
if (!isFilled(x0, y0, x1, y1)) if (!isFilled(image, x0, y0, x1, y1))
return; return;
for (int x = x0; x < x1; ++x) for (int x = x0; x < x1; ++x)
for (int y = y0; y < y1; ++y) for (int y = y0; y < y1; ++y)
@@ -159,17 +195,17 @@ public class FakeSkinBuffer implements IImageBuffer {
* 11111111 00000000 00000000 00000000 */ * 11111111 00000000 00000000 00000000 */
private static final int B = -16777216; private static final int B = -16777216;
private void setAreaOpaque(int x0, int y0, int x1, int y1) { private static void setAreaOpaque(FakeImage image, int x0, int y0, int x1, int y1) {
for (int x = x0; x < x1; ++x) for (int x = x0; x < x1; ++x)
for (int y = y0; y < y1; ++y) for (int y = y0; y < y1; ++y)
image.setRGBA(x, y, image.getRGBA(x, y) | B); image.setRGBA(x, y, image.getRGBA(x, y) | B);
} }
private void setAreaDueToConfig(int x0, int y0, int x1, int y1) { private static void setAreaDueToConfig(FakeImage image, int x0, int y0, int x1, int y1) {
if (customskinloader.CustomSkinLoader.config.enableTransparentSkin) if (customskinloader.CustomSkinLoader.config.enableTransparentSkin)
setAreaTransparent(x0, y0, x1, y1); setAreaTransparent(image, x0, y0, x1, y1);
else else
setAreaOpaque(x0, y0, x1, y1); setAreaOpaque(image, x0, y0, x1, y1);
} }
public void skinAvailable() { public void skinAvailable() {
@@ -4,10 +4,10 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.function.Supplier; 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.ImmutableList;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.SignatureState; import com.mojang.authlib.SignatureState;
@@ -16,115 +16,115 @@ import com.mojang.authlib.minecraft.MinecraftProfileTextures;
import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.IFakeSkinManagerCacheKey; import customskinloader.fake.texture.FakeResourceLocation;
import customskinloader.loader.MojangAPILoader;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpTextureUtil; import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.TextureUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IImageBuffer; import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager;
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.server.Services;
import net.minecraft.util.ResourceLocation;
public class FakeSkinManager { public class FakeSkinManager {
/** /**
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, File, MinecraftSessionService)} * 1.20.1-
* Invoked from {@link SkinManager(TextureManager, File, MinecraftSessionService)}
*/ */
public static void setSkinCacheDir(File skinCacheDirectory) { public static void setSkinCacheDir(File skinCacheDirectory) {
HttpTextureUtil.defaultCacheDir = skinCacheDirectory; HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
} }
/** /**
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)} * 23w31a ~ 23w45a
* Invoked from {@link SkinManager(TextureManager, Path, MinecraftSessionService, Executor)}
*
* 23w46a ~ 25w33a
* Invoked from {@link SkinManager(Path, MinecraftSessionService, Executor)}
*
* 25w34a+
* Invoked from {@link SkinManager(Path, Services, Executor)}
*/ */
public static void setSkinCacheDir(Path skinCacheDirectory) { public static void setSkinCacheDir(Path skinCacheDirectory) {
HttpTextureUtil.defaultCacheDir = skinCacheDirectory.toFile(); HttpTextureUtil.defaultCacheDir = skinCacheDirectory.toFile();
} }
private static CacheLoader<Object, ?> cacheLoader;
/**
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)}
*/
public static CacheLoader<Object, ?> setCacheLoader(CacheLoader<Object, ?> loader) {
return cacheLoader = loader;
}
/** /**
* 23w42a ~ 25w33a
* Invoked from {@link SkinManager#getOrLoad(GameProfile)} * Invoked from {@link SkinManager#getOrLoad(GameProfile)}
*
* 25w34a+
* Invoked from {@link SkinManager#get(GameProfile)}
*/ */
public static Property createProperty(Property property) { 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)); return property == null ? new Property(null, null) : property;
} }
/** /**
* Invoked from {@link SkinManager#getOrLoad(GameProfile)} * 1.20.1-
*/ * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager$SkinAvailableCallback)}
public static Object loadCache(LoadingCache<?, ?> loadingCache, Object cacheKey, GameProfile profile) throws Exception { *
return cacheLoader.load(FakeCacheKey.wrapCacheKey(cacheKey, profile)); * 23w31a+
} * Invoked from {@link SkinManager$TextureCache#registerTexture(MinecraftProfileTexture)}
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
*/ */
public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) {
Object[] params = list.toArray(); Object[] params = list.toArray();
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) { if (profileTexture instanceof FakeMinecraftProfileTexture) {
FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture; FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
params[0] = fakeProfileTexture.getCacheFile(); File cacheFile = fakeProfileTexture.getCacheFile();
if (params[params.length - 2] instanceof Boolean) { if (params.length == 4) {
params[params.length - 2] = true; if (params[3] instanceof Boolean) { // 24w46a+
if ((Boolean) params[3]) {
params[0] = FakeResourceLocation.create((ResourceLocation) params[0], fakeProfileTexture);
}
params[1] = cacheFile.toPath();
} else { // 19w37a-
params[0] = cacheFile;
params[3] = new BaseBuffer((Runnable) params[3], textureType, fakeProfileTexture);
}
} else if (params.length == 5) { // 19w38a ~ 24w45a
params[0] = cacheFile;
params[3] = true;
params[4] = new BaseBuffer((Runnable) params[4], textureType, fakeProfileTexture);
} }
params[params.length - 1] = new BaseBuffer((Runnable) params[params.length - 1], textureType, fakeProfileTexture);
} }
return params; return params;
} }
private final static String KEY = "CustomSkinLoaderInfo";
/** /**
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager.SkinAvailableCallback, boolean)} * 1.20.1-
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager$SkinAvailableCallback, boolean)}
*/ */
public static void loadProfileTextures(Runnable runnable, GameProfile profile) { public static void loadProfileTextures(Runnable runnable) {
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, p -> { CustomSkinLoader.loadProfileTextures(runnable);
profile.getProperties().putAll(KEY, p.toProperties());
runnable.run();
return null;
}));
} }
/** /**
* 23w31a+ * 23w31a+
* Invoked from net.minecraft.client.resources.SkinManager$1#load(net.minecraft.client.resources.SkinManager$CacheKey) * Invoked from {@link SkinManager$1#load(SkinManager$CacheKey)}
*/ */
public static Object[] loadProfileTextures(ImmutableList<Object> list, Object cacheKey) { public static Executor loadProfileTextures(Executor executor) {
Object[] params = list.toArray(); return CustomSkinLoader.THREAD_POOL;
GameProfile profile = FakeCacheKey.unwrapCacheKey(cacheKey);
if (!profile.getProperties().containsKey(SKULL_KEY)) {
final Supplier<?> supplier = (Supplier<?>) params[0];
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;
} else {
params[1] = Minecraft.getMinecraft();
}
return params;
} }
/** /**
* Invoked from {@link SkinManager#lambda$loadProfileTextures$1(GameProfile, boolean, SkinAvailableCallback)} * 1.20.1-
* Invoked from {@link SkinManager#func_210275_a(GameProfile, boolean, SkinManager$SkinAvailableCallback)}
*/ */
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) { public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
return ModelManager0.fromUserProfile(UserProfile.fromProperties(profile.getProperties().values())); return ModelManager0.fromUserProfile(CustomSkinLoader.loadProfile(profile));
} }
/** /**
* Invoked from {@link SkinManager#lambda$null$0(Map, SkinAvailableCallback)} * 1.20.1-
* Invoked from {@link SkinManager#func_210276_a(Map, SkinManager$SkinAvailableCallback)}
*/ */
public static void loadElytraTexture(SkinManager skinManager, Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map, SkinManager.SkinAvailableCallback skinAvailableCallback) { public static void loadElytraTexture(SkinManager skinManager, Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map, SkinManager$SkinAvailableCallback skinAvailableCallback) {
for (int i = 2; i < MinecraftProfileTexture.Type.values().length; i++) { for (int i = 2; i < MinecraftProfileTexture.Type.values().length; i++) {
MinecraftProfileTexture.Type type = MinecraftProfileTexture.Type.values()[i]; MinecraftProfileTexture.Type type = MinecraftProfileTexture.Type.values()[i];
if (map.containsKey(type)) { if (map.containsKey(type)) {
@@ -133,46 +133,37 @@ public class FakeSkinManager {
} }
} }
private final static String SKULL_KEY = "CSL$IsSkull";
/** /**
* 23w31a+ * 1.20.1-
* Invoked from {@link SkinManager#getInsecureSkin(GameProfile)} * Invoked from {@link SkinManager#loadSkinFromCache(GameProfile)}
*/ */
public static void setSkullType(GameProfile profile) {
profile.getProperties().removeAll(SKULL_KEY);
profile.getProperties().put(SKULL_KEY, new Property(SKULL_KEY, "true"));
}
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) { public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
return CustomSkinLoader.loadProfileFromCache(profile); return CustomSkinLoader.loadProfileFromCache(profile);
} }
/** /**
* 23w31a ~ 23w41a * 23w31a ~ 23w41a
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(GameProfile) * Invoked from {@link SkinManager$1#lambda$load$0(MinecraftSessionService, GameProfile)}
*/ */
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) { public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
if (profile.getProperties().containsKey(SKULL_KEY)) { return getUserProfile(sessionService, profile, requireSecure);
profile.getProperties().removeAll(SKULL_KEY);
return CustomSkinLoader.loadProfileFromCache(profile);
} else {
return getUserProfile(sessionService, profile, requireSecure);
}
} }
/** /**
* 23w42a+ * 23w42a ~ 25w33a
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(SkinManager.CacheKey, MinecraftSessionService) * Invoked from {@link SkinManager$1#lambda$load$0(SkinManager$CacheKey, MinecraftSessionService)}
*
* 25w34a+
* Invoked from {@link SkinManager$1#lambda$load$0(SkinManager$CacheKey, Services)}
*/ */
public static Object loadSkinFromCache(MinecraftSessionService sessionService, Property property) { public static Object loadSkinFromCache(MinecraftSessionService sessionService, Property property, SkinManager$CacheKey cacheKey) {
return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, FakeCacheKey.unwrapProperty(property), false)); if (cacheKey instanceof FakeCacheKey) {
return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, ((FakeCacheKey) cacheKey).profile(), false));
}
return sessionService.unpackTextures(property);
} }
private static boolean shouldJudgeType(MinecraftProfileTexture texture) { public static class BaseBuffer implements IImageBuffer {
return texture != null && "auto".equals(texture.getMetadata("model"));
}
private static class BaseBuffer implements IImageBuffer {
private IImageBuffer buffer; private IImageBuffer buffer;
private final Runnable callback; private final Runnable callback;
@@ -190,22 +181,20 @@ public class FakeSkinManager {
@Override @Override
public NativeImage func_195786_a(NativeImage image) { public NativeImage func_195786_a(NativeImage image) {
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).func_195786_a(image) : image; return this.buffer instanceof FakeSkinBuffer ? this.buffer.func_195786_a(image) : image;
} }
@Override @Override
public BufferedImage parseUserSkin(BufferedImage image) { public BufferedImage parseUserSkin(BufferedImage image) {
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).parseUserSkin(image) : image; return this.buffer instanceof FakeSkinBuffer ? this.buffer.parseUserSkin(image) : image;
} }
@Override @Override
public void skinAvailable() { public void skinAvailable() {
if (buffer != null) { if (this.buffer != null) {
buffer.skinAvailable(); this.buffer.skinAvailable();
if (shouldJudgeType(texture) && buffer instanceof FakeSkinBuffer) { if (this.buffer instanceof FakeSkinBuffer) {
//Auto judge skin type judgeType(this.texture, () -> ((FakeSkinBuffer) this.buffer).judgeType());
String type = ((FakeSkinBuffer) buffer).judgeType();
texture.setModel(type);
} }
} }
@@ -213,30 +202,40 @@ public class FakeSkinManager {
this.callback.run(); this.callback.run();
} }
} }
public static void judgeType(FakeMinecraftProfileTexture texture, Supplier<String> type) {
if (shouldJudgeType(texture)) {
//Auto judge skin type
texture.setModel(type.get());
}
}
private static boolean shouldJudgeType(FakeMinecraftProfileTexture texture) {
return texture != null && "auto".equals(texture.getMetadata("model", false));
}
} }
public static class FakeCacheKey { public static class FakeCacheKey extends SkinManager$CacheKey {
public static Object wrapCacheKey(Object cacheKey, GameProfile profile) { private final GameProfile profile;
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey;
if (fakeCacheKey.profile() != null) { public FakeCacheKey(UUID uuid, Property property, GameProfile profile) {
return cacheKey; // 23w31a ~ 23w41a super(uuid, property);
} else { this.profile = profile;
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(fakeCacheKey.packedTextures(), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
return fakeCacheKey; // 23w42a+
}
} }
public static GameProfile unwrapCacheKey(Object cacheKey) { public GameProfile profile() {
IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey; return this.profile;
if (fakeCacheKey.profile() != null) {
return fakeCacheKey.profile(); // 23w31a ~ 23w41a
} else {
return unwrapProperty(fakeCacheKey.packedTextures()); // 23w42a+
}
} }
public static GameProfile unwrapProperty(Property property) { /**
return MojangAPILoader.GSON.fromJson((String) TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property), GameProfile.class); // 23w42a+ * 23w42a ~ 25w33a
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
*
* 25w34a+
* Invoked from {@link SkinManager#get(GameProfile)}
*/
public static SkinManager$CacheKey createFakeCacheKey(UUID uuid, Property property, GameProfile profile) {
return new FakeCacheKey(uuid, property, profile);
} }
public static Object createMinecraftProfileTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) { public static Object createMinecraftProfileTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
@@ -1,6 +1,5 @@
package customskinloader.fake.itf; package customskinloader.fake.itf;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Optional; import java.util.Optional;
@@ -13,11 +12,19 @@ public class FakeInterfaceManager {
return ((IFakeIResource.V2) resource).open(); return ((IFakeIResource.V2) resource).open();
} }
public static Optional<IResource> IResourceManager_getResource(Object resourceManager, ResourceLocation location) throws IOException { public static Optional<IResource> IResourceManager_getResource(Object resourceManager, ResourceLocation location) {
return ((IFakeIResourceManager) resourceManager).getResource(location); return ((IFakeIResourceManager) resourceManager).getResource(location);
} }
public static IResourceManager Minecraft_getResourceManager(Object minecraft) { public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G(); 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 void NativeImage_setPixel(Object nativeImage, int x, int y, int color) {
((IFakeNativeImage) nativeImage).setPixel(x, y, color);
}
} }
@@ -1,6 +1,5 @@
package customskinloader.fake.itf; package customskinloader.fake.itf;
import java.io.IOException;
import java.util.Optional; import java.util.Optional;
import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManager;
@@ -9,12 +8,12 @@ import net.minecraft.util.ResourceLocation;
public interface IFakeIResourceManager { public interface IFakeIResourceManager {
// 1.13.2 ~ 22w13a // 1.13.2 ~ 22w13a
default IResource func_199002_a(ResourceLocation location) throws IOException { default IResource func_199002_a(ResourceLocation location) {
return (IResource) ((IResourceManager) this).getResource(location); return (IResource) ((IResourceManager) this).getResource(location);
} }
// 22w14a+ // 22w14a+
default Optional getResource(ResourceLocation location) throws IOException { default Optional getResource(ResourceLocation location) {
return Optional.ofNullable(this.func_199002_a(location)); return Optional.ofNullable(this.func_199002_a(location));
} }
} }
@@ -0,0 +1,13 @@
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);
}
default void setPixel(int x, int y, int color) {
((NativeImage) this).func_195700_a(x, y, color);
}
}
@@ -1,12 +0,0 @@
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();
}
@@ -10,6 +10,7 @@ import javax.imageio.ImageIO;
public class FakeBufferedImage implements FakeImage { public class FakeBufferedImage implements FakeImage {
private BufferedImage image; private BufferedImage image;
private Graphics graphics; private Graphics graphics;
private int ratio;
public FakeBufferedImage(int width, int height) { public FakeBufferedImage(int width, int height) {
this(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)); this(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB));
@@ -33,6 +34,16 @@ public class FakeBufferedImage implements FakeImage {
return new FakeBufferedImage(ImageIO.read(is)); return new FakeBufferedImage(ImageIO.read(is));
} }
@Override
public int getRatio() {
return this.ratio;
}
@Override
public void setRatio(int ratio) {
this.ratio = ratio;
}
public int getWidth() { public int getWidth() {
return image.getWidth(); return image.getWidth();
} }
@@ -8,6 +8,10 @@ public interface FakeImage {
FakeImage createImage(InputStream is) throws IOException; FakeImage createImage(InputStream is) throws IOException;
int getRatio();
void setRatio(int ratio);
int getWidth(); int getWidth();
int getHeight(); int getHeight();
@@ -2,10 +2,12 @@ package customskinloader.fake.texture;
import java.io.InputStream; import java.io.InputStream;
import customskinloader.fake.itf.FakeInterfaceManager;
import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.client.renderer.texture.NativeImage;
public class FakeNativeImage implements FakeImage { public class FakeNativeImage implements FakeImage {
private NativeImage image; private NativeImage image;
private int ratio;
public FakeNativeImage(int width, int height) { public FakeNativeImage(int width, int height) {
this(new NativeImage(width, height, true)); this(new NativeImage(width, height, true));
@@ -27,6 +29,16 @@ public class FakeNativeImage implements FakeImage {
return new FakeNativeImage(NativeImage.func_195713_a(is)); return new FakeNativeImage(NativeImage.func_195713_a(is));
} }
@Override
public int getRatio() {
return this.ratio;
}
@Override
public void setRatio(int ratio) {
this.ratio = ratio;
}
public int getWidth() { public int getWidth() {
return image.func_195702_a(); return image.func_195702_a();
} }
@@ -36,11 +48,11 @@ public class FakeNativeImage implements FakeImage {
} }
public int getRGBA(int x, int y) { 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) { public void setRGBA(int x, int y, int rgba) {
image.func_195700_a(x, y, rgba); FakeInterfaceManager.NativeImage_setPixel(image, x, y, rgba);
} }
public void copyImageData(FakeImage image) { public void copyImageData(FakeImage image) {
@@ -57,5 +69,24 @@ public class FakeNativeImage implements FakeImage {
} }
public void close() { public void close() {
image.close();
}
public static class Extended extends NativeImage {
public static NativeImage create(FakeNativeImage fakeImage) {
return new FakeNativeImage.Extended(fakeImage);
}
private final FakeNativeImage fakeImage;
public Extended(FakeNativeImage fakeImage) {
super(fakeImage.getWidth(), fakeImage.getHeight(), true);
this.func_195703_a(fakeImage.getImage());
this.fakeImage = fakeImage;
}
public FakeNativeImage getFakeImage() {
return this.fakeImage;
}
} }
} }
@@ -0,0 +1,22 @@
package customskinloader.fake.texture;
import customskinloader.fake.FakeMinecraftProfileTexture;
import net.minecraft.util.ResourceLocation;
public class FakeResourceLocation extends ResourceLocation {
public static FakeResourceLocation create(ResourceLocation location, FakeMinecraftProfileTexture texture) {
String[] s = location.toString().split(":", 2);
return new FakeResourceLocation(s[0], s[1], texture);
}
private final FakeMinecraftProfileTexture texture;
public FakeResourceLocation(String domain, String path, FakeMinecraftProfileTexture texture) {
super(domain, path);
this.texture = texture;
}
public FakeMinecraftProfileTexture getTexture() {
return this.texture;
}
}
@@ -0,0 +1,46 @@
package customskinloader.fake.texture;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import customskinloader.fake.FakeCapeBuffer;
import customskinloader.fake.FakeSkinBuffer;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureContents;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
// 24w46a+
public class FakeThreadDownloadImageData extends SimpleTexture {
private FakeCapeBuffer buffer;
private FakeNativeImage image;
public static Function<NativeImage, CompletableFuture<?>> createTexture(Function<NativeImage, CompletableFuture<?>> function, ResourceLocation location, boolean bl) {
return bl ? _image -> {
if (location instanceof FakeResourceLocation && _image instanceof FakeNativeImage.Extended) {
FakeSkinManager.BaseBuffer.judgeType(((FakeResourceLocation) location).getTexture(), () -> FakeSkinBuffer.judgeType0(((FakeNativeImage.Extended) _image).getFakeImage()));
}
return function.apply(_image);
} : _image -> function.apply(_image).thenApply(_location -> {
Minecraft.getMinecraft().getTextureManager().registerAndLoad(location, new FakeThreadDownloadImageData(location, _image));
return _location;
});
}
public FakeThreadDownloadImageData(ResourceLocation location, NativeImage image) {
super(location);
this.buffer = new FakeCapeBuffer();
this.image = new FakeNativeImage(image);
}
@Override
public TextureContents loadContents(IResourceManager resourceManager) {
this.image = (FakeNativeImage) this.buffer.parseUserSkin(this.image);
FakeNativeImage local = (FakeNativeImage) this.image.createImage(this.image.getWidth(), this.image.getHeight());
local.copyImageData(this.image);
return new TextureContents(local.getImage(), null);
}
}
@@ -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(TextureUtil.AuthlibField.GAME_PROFILE_PROPERTIES.<PropertyMap>get(gameProfile).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;
}
}
@@ -12,6 +12,7 @@ import customskinloader.plugin.ICustomSkinLoaderPlugin;
import customskinloader.profile.UserProfile; import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpRequestUtil; import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpUtil0; import customskinloader.utils.HttpUtil0;
import customskinloader.utils.TextureUtil;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -86,7 +87,7 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
@Override @Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception { public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
String username = gameProfile.getName(); String username = TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile);
if (StringUtils.isEmpty(ssp.root)) { if (StringUtils.isEmpty(ssp.root)) {
CustomSkinLoader.logger.info("Root not defined."); CustomSkinLoader.logger.info("Root not defined.");
return null; return null;
@@ -14,6 +14,7 @@ import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpRequestUtil; import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.HttpTextureUtil; import customskinloader.utils.HttpTextureUtil;
import customskinloader.utils.HttpUtil0; import customskinloader.utils.HttpUtil0;
import customskinloader.utils.TextureUtil;
public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader { public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader {
@@ -27,7 +28,7 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
return Lists.newArrayList(new LocalSkin(this), return Lists.newArrayList(new LocalSkin(this),
getCapeProfile(this, "OptiFine", "https://optifine.net/capes/{USERNAME}.png", 810), getCapeProfile(this, "OptiFine", "https://optifine.net/capes/{USERNAME}.png", 810),
getCapeProfile(this, "CloakPlus", "http://161.35.130.99/capes/{USERNAME}.png", 840), 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}&nothirdparty", 860) getCapeProfile(this, "Cosmetica", "https://api.cosmetica.cc/get/cloak?username={USERNAME}&uuid={STANDARD_UUID}&nothirdparty", 860)
); );
} }
@@ -160,13 +161,12 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
return profile; return profile;
} }
private void getTextureUrl( private void getTextureUrl(SkinSiteProfile ssp, GameProfile gameProfile, String baseUrl, Consumer<String> onSuccess) {
SkinSiteProfile ssp, GameProfile gameProfile, String baseUrl, Consumer<String> onSuccess) {
//Base URL is empty //Base URL is empty
if (baseUrl == null || baseUrl.isEmpty()) { if (baseUrl == null || baseUrl.isEmpty()) {
return; return;
} }
String url = expandURL(baseUrl, gameProfile.getName()); String url = expandURL(baseUrl, TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile));
//No texture can be loaded //No texture can be loaded
if (url == null) { if (url == null) {
return; return;
@@ -1,24 +1,16 @@
package customskinloader.loader; package customskinloader.loader;
import java.nio.charset.StandardCharsets;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; 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.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap; import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse; import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import com.mojang.util.UUIDTypeAdapter;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile; import customskinloader.config.SkinSiteProfile;
import customskinloader.plugin.ICustomSkinLoaderPlugin; import customskinloader.plugin.ICustomSkinLoaderPlugin;
@@ -26,7 +18,6 @@ import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile; import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpRequestUtil; import customskinloader.utils.HttpRequestUtil;
import customskinloader.utils.TextureUtil; import customskinloader.utils.TextureUtil;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader { public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IProfileLoader {
@@ -88,28 +79,21 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
@Override @Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) { public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = getTextures(gameProfile); String username = TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(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); GameProfile newGameProfile = loadGameProfileCached(ssp.apiRoot, username);
if (newGameProfile == null) { if (newGameProfile == null) {
CustomSkinLoader.logger.info("Profile not found.(" + username + "'s profile not found.)"); CustomSkinLoader.logger.info("Profile not found.(" + username + "'s profile not found.)");
return null; return null;
} }
newGameProfile = fillGameProfile(ssp.sessionRoot, newGameProfile); newGameProfile = fillGameProfile(ssp.sessionRoot, newGameProfile);
map = getTextures(newGameProfile); Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = GameProfileLoader.getTextures(newGameProfile);
if (!map.isEmpty()) { if (!map.isEmpty()) {
gameProfile.getProperties().putAll(newGameProfile.getProperties());
return ModelManager0.toUserProfile(map); return ModelManager0.toUserProfile(map);
} }
CustomSkinLoader.logger.info("Profile not found.(" + username + " doesn't have skin/cape.)"); CustomSkinLoader.logger.info("Profile not found.(" + username + " doesn't have skin/cape.)");
return null; 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<>(); private static final Map<String, GameProfile> gameProfileCache = new ConcurrentHashMap<>();
public static GameProfile loadGameProfileCached(String apiRoot, String username) { public static GameProfile loadGameProfileCached(String apiRoot, String username) {
@@ -118,22 +102,23 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
//Username -> UUID //Username -> UUID
public static GameProfile loadGameProfile(String apiRoot, String username) { public static GameProfile loadGameProfile(String apiRoot, String username) {
//Doc (https://wiki.vg/Mojang_API#Playernames_-.3E_UUIDs) //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)) { if (StringUtils.isEmpty(responce.content)) {
return null; return null;
} }
GameProfile[] profiles = GSON.fromJson(responce.content, GameProfile[].class); MinecraftProfilePropertiesResponse[] profiles = GameProfileLoader.GSON.fromJson(responce.content, MinecraftProfilePropertiesResponse[].class);
if (profiles.length == 0) { if (profiles.length == 0) {
return null; return null;
} }
GameProfile gameProfile = profiles[0]; GameProfile gameProfile = createGameProfile(profiles[0]);
if (gameProfile.getId() == null) { UUID id = TextureUtil.AuthlibField.GAME_PROFILE_ID.get(gameProfile);
if (id == null) {
return null; return null;
} }
return new GameProfile(gameProfile.getId(), gameProfile.getName()); return new GameProfile(id, TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(gameProfile));
} }
/** /**
@@ -148,44 +133,27 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
if (profile == null) { if (profile == null) {
return null; return null;
} }
UUID id = profile.getId(); UUID id = TextureUtil.AuthlibField.GAME_PROFILE_ID.get(profile);
return standard ? id.toString() : TextureUtil.fromUUID(id); return standard ? id.toString() : TextureUtil.fromUUID(id);
} }
//UUID -> Profile //UUID -> Profile
public static GameProfile fillGameProfile(String sessionRoot, GameProfile profile) { public static GameProfile fillGameProfile(String sessionRoot, GameProfile profile) {
//Doc (http://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape) //Doc (https://minecraft.wiki/w/Mojang_API#Query_player's_skin_and_cape)
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(sessionRoot + "session/minecraft/profile/" + TextureUtil.fromUUID(profile.getId())).setCacheTime(90)); HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(sessionRoot + "session/minecraft/profile/" + TextureUtil.fromUUID(TextureUtil.AuthlibField.GAME_PROFILE_ID.get(profile))).setCacheTime(90));
if (StringUtils.isEmpty(responce.content)) { if (StringUtils.isEmpty(responce.content)) {
return profile; return profile;
} }
return createGameProfile(GameProfileLoader.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));
return newGameProfile;
} }
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(GameProfile gameProfile) { public static GameProfile createGameProfile(MinecraftProfilePropertiesResponse response) {
if (gameProfile == null) { GameProfile profile = new GameProfile(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(response), TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME.get(response));
return Maps.newHashMap(); PropertyMap map = TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES.get(response);
if (map != null) {
TextureUtil.AuthlibField.PROPERTY_MAP_PROPERTIES.set(TextureUtil.AuthlibField.GAME_PROFILE_PROPERTIES.get(profile), TextureUtil.AuthlibField.PROPERTY_MAP_PROPERTIES.get(map));
} }
Property textureProperty = Iterables.getFirst(gameProfile.getProperties().get("textures"), null); return profile;
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 || TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result) == null) {
return Maps.newHashMap();
}
return TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
} }
@Override @Override
@@ -9,6 +9,7 @@ import java.util.ServiceLoader;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.loader.GameProfileLoader;
import customskinloader.loader.JsonAPILoader; import customskinloader.loader.JsonAPILoader;
import customskinloader.loader.LegacyLoader; import customskinloader.loader.LegacyLoader;
import customskinloader.loader.MojangAPILoader; import customskinloader.loader.MojangAPILoader;
@@ -17,6 +18,7 @@ import org.apache.commons.io.FileUtils;
public class PluginLoader { public class PluginLoader {
public static final ICustomSkinLoaderPlugin[] DEFAULT_PLUGINS = new ICustomSkinLoaderPlugin[]{ public static final ICustomSkinLoaderPlugin[] DEFAULT_PLUGINS = new ICustomSkinLoaderPlugin[]{
new GameProfileLoader(),
new MojangAPILoader(), new MojangAPILoader(),
new LegacyLoader(), new LegacyLoader(),
new JsonAPILoader(new CustomSkinAPI()), new JsonAPILoader(new CustomSkinAPI()),
@@ -15,6 +15,7 @@ import com.google.gson.GsonBuilder;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.util.UUIDTypeAdapter; import com.mojang.util.UUIDTypeAdapter;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.utils.HttpRequestUtil; import customskinloader.utils.HttpRequestUtil;
@@ -44,7 +45,7 @@ public class DynamicSkullManager {
private List<GameProfile> loadingList = Lists.newArrayList(); private List<GameProfile> loadingList = Lists.newArrayList();
private void parseGameProfile(GameProfile profile) { private void parseGameProfile(GameProfile profile) {
Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null); Property textureProperty = Iterables.getFirst(TextureUtil.AuthlibField.GAME_PROFILE_PROPERTIES.<PropertyMap>get(profile).get("textures"), null);
if (textureProperty == null) { if (textureProperty == null) {
staticTextures.put(profile, Maps.newHashMap()); staticTextures.put(profile, Maps.newHashMap());
return; return;
@@ -123,7 +124,8 @@ public class DynamicSkullManager {
MinecraftProfileTexture skin = textures.get(MinecraftProfileTexture.Type.SKIN); MinecraftProfileTexture skin = textures.get(MinecraftProfileTexture.Type.SKIN);
String skinUrl = skin.getUrl(); String skinUrl = skin.getUrl();
if (!HttpUtil0.isLocal(skinUrl)) if (!HttpUtil0.isLocal(skinUrl))
return textures; // Wrap MinecraftProfileTexture to FakeMinecraftProfileTexture
return ModelManager0.fromUserProfile(ModelManager0.toUserProfile(textures));
File skinFile = new File(CustomSkinLoader.DATA_DIR, skinUrl); File skinFile = new File(CustomSkinLoader.DATA_DIR, skinUrl);
if (!skinFile.isFile()) if (!skinFile.isFile())
return Maps.newHashMap(); return Maps.newHashMap();
@@ -135,7 +137,7 @@ public class DynamicSkullManager {
if (staticTextures.get(profile) != null) if (staticTextures.get(profile) != null)
return staticTextures.get(profile); return staticTextures.get(profile);
if (loadingList.contains(profile)) if (loadingList.contains(profile))
return Maps.newHashMap(); return CustomSkinLoader.INCOMPLETED;
if (dynamicTextures.containsKey(profile)) { if (dynamicTextures.containsKey(profile)) {
SkullTexture texture = dynamicTextures.get(profile); SkullTexture texture = dynamicTextures.get(profile);
long time = System.currentTimeMillis() - texture.startTime; long time = System.currentTimeMillis() - texture.startTime;
@@ -152,6 +154,6 @@ public class DynamicSkullManager {
}); });
loadThread.setName("Skull " + profile.hashCode()); loadThread.setName("Skull " + profile.hashCode());
loadThread.start(); loadThread.start();
return Maps.newHashMap(); return CustomSkinLoader.INCOMPLETED;
} }
} }
@@ -5,6 +5,7 @@ import java.util.Map;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.CustomSkinLoader;
import customskinloader.fake.FakeMinecraftProfileTexture; import customskinloader.fake.FakeMinecraftProfileTexture;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -98,9 +99,9 @@ public class ModelManager0 {
* @since 13.1 * @since 13.1
*/ */
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) { public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
if (profile == null) if (profile == null)
return map; return CustomSkinLoader.INCOMPLETED;
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
if (profile.skinUrl != null) { if (profile.skinUrl != null) {
Map<String, String> metadata = null; Map<String, String> metadata = null;
if ("slim".equals(profile.model) || "auto".equals(profile.model)) { if ("slim".equals(profile.model) || "auto".equals(profile.model)) {
@@ -89,7 +89,7 @@ public class ProfileCache {
private UserProfile loadLocalProfile(String username){ private UserProfile loadLocalProfile(String username){
File localProfile=new File(PROFILE_CACHE_DIR,username.toLowerCase()+".json"); File localProfile=new File(PROFILE_CACHE_DIR,username.toLowerCase()+".json");
if(!localProfile.exists()){ if(!localProfile.exists()){
localProfiles.put(username.toLowerCase(), null); localProfiles.put(username.toLowerCase(), UserProfile.NULL);
} }
try{ try{
String json = FileUtils.readFileToString(localProfile, "UTF-8"); String json = FileUtils.readFileToString(localProfile, "UTF-8");
@@ -99,9 +99,9 @@ public class ProfileCache {
return profile; return profile;
}catch(Exception e){ }catch(Exception e){
CustomSkinLoader.logger.info("Failed to load LocalProfile.("+e.toString()+")"); 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") @SuppressWarnings("ResultOfMethodCallIgnored")
private void saveLocalProfile(String username, UserProfile profile){ private void saveLocalProfile(String username, UserProfile profile){
@@ -1,21 +1,15 @@
package customskinloader.profile; 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 org.apache.commons.lang3.StringUtils;
import customskinloader.profile.ModelManager0.Model;
/**The instance to storage user's profile in memory temporarily. /**The instance to storage user's profile in memory temporarily.
* In this manner, it could be easier to pass profile in program. * In this manner, it could be easier to pass profile in program.
* @since 13.1 * @since 13.1
*/ */
public class UserProfile { public class UserProfile {
public final static UserProfile NULL = new UserProfile();
/** /**
* Direct url for skin. * Direct url for skin.
* @since 13.1 * @since 13.1
@@ -41,7 +35,7 @@ public class UserProfile {
*/ */
public String elytraUrl=null; public String elytraUrl=null;
public void put(Model model,String url){ public void put(ModelManager0.Model model,String url){
if(model==null||StringUtils.isEmpty(url)) if(model==null||StringUtils.isEmpty(url))
return; return;
switch(model){ switch(model){
@@ -76,34 +70,6 @@ public class UserProfile {
(expiry==0?"":(" , Expiry: "+expiry))+")"; (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. * Check if the instance is empty.
* @return status (true - empty) * @return status (true - empty)
@@ -0,0 +1,50 @@
package customskinloader.utils;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import com.google.common.util.concurrent.ForwardingBlockingQueue;
public class LIFOBlockingQueue<E> extends ForwardingBlockingQueue<E> {
private final BlockingDeque<E> deque;
public LIFOBlockingQueue(BlockingDeque<E> deque) {
this.deque = deque;
}
@Override
protected BlockingQueue<E> delegate() {
return deque;
}
@Override
public boolean offer(E e) {
return deque.offerFirst(e);
}
@Override
public void put(E e) throws InterruptedException {
deque.putFirst(e);
}
@Override
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
return deque.offerFirst(e, timeout, unit);
}
@Override
public E take() throws InterruptedException {
return deque.takeFirst();
}
@Override
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
return deque.pollFirst(timeout, unit);
}
@Override
public E peek() {
return deque.peekFirst();
}
}
@@ -85,7 +85,6 @@ public class MinecraftUtil {
} }
public static String getCredential(GameProfile profile) { public static String getCredential(GameProfile profile) {
return (profile == null || profile.hashCode() == 0) ? null : return profile == null ? null : String.format("%s-%s", TextureUtil.AuthlibField.GAME_PROFILE_NAME.get(profile), TextureUtil.AuthlibField.GAME_PROFILE_ID.get(profile));
(profile.getId() == null ? profile.getName() : String.format("%s-%s", profile.getName(), profile.getId()));
} }
} }
@@ -1,13 +1,10 @@
package customskinloader.utils; package customskinloader.utils;
import java.io.File; import java.io.File;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.function.Supplier;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap; import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse; import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
@@ -15,7 +12,6 @@ import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import sun.misc.Unsafe;
public class TextureUtil { public class TextureUtil {
/** /**
@@ -42,36 +38,25 @@ 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, // 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. // resulting in changes to method names, so reflection is used here to be compatible with these changes.
public enum AuthlibField { public enum AuthlibField {
PROPERTY_NAME(Property.class, "name", String.class), GAME_PROFILE_ID(GameProfile.class, "id"),
PROPERTY_VALUE(Property.class, "value", String.class), GAME_PROFILE_NAME(GameProfile.class, "name"),
PROPERTY_SIGNATURE(Property.class, "signature", String.class), GAME_PROFILE_PROPERTIES(GameProfile.class, "properties"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id", UUID.class), PROPERTY_VALUE(Property.class, "value"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name", String.class), PROPERTY_MAP_PROPERTIES(PropertyMap.class, "properties"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties", PropertyMap.class), MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id"),
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures", Map.class); MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name"),
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties"),
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures");
private final MethodHandle getter; private final Field field;
private final MethodHandle setter;
AuthlibField(Class<?> clazz, String name, Class<?> returnType) { AuthlibField(Class<?> clazz, String name) {
try { try {
this.getter = IMPL_LOOKUP.findGetter(clazz, name, returnType); this.field = clazz.getDeclaredField(name);
this.setter = IMPL_LOOKUP.findSetter(clazz, name, returnType); this.field.setAccessible(true);
} catch (Throwable t) { } catch (Throwable t) {
throw new RuntimeException(t); throw new RuntimeException(t);
} }
@@ -80,7 +65,7 @@ public class TextureUtil {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <R> R get(Object o) { public <R> R get(Object o) {
try { try {
return (R) this.getter.invokeWithArguments(o); return (R) this.field.get(o);
} catch (Throwable t) { } catch (Throwable t) {
throw new RuntimeException(t); throw new RuntimeException(t);
} }
@@ -88,7 +73,7 @@ public class TextureUtil {
public void set(Object o, Object value) { public void set(Object o, Object value) {
try { try {
this.setter.invokeWithArguments(o, value); this.field.set(o, value);
} catch (Throwable t) { } catch (Throwable t) {
throw new RuntimeException(t); throw new RuntimeException(t);
} }
View File
Whitespace-only changes.
+7
View File
@@ -0,0 +1,7 @@
// This subproject is only to provide dependency for other subprojects.
reobf {
jar {
mappings = file("Dummy.srg")
}
}
+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,5 @@
package com.google.errorprone.annotations;
public @interface CanIgnoreReturnValue {
}
@@ -1,7 +1,5 @@
package com.mojang.authlib; package com.mojang.authlib;
public enum SignatureState { public enum SignatureState {
UNSIGNED,
INVALID,
SIGNED SIGNED
} }
@@ -3,7 +3,6 @@ package com.mojang.authlib.minecraft;
import com.mojang.authlib.SignatureState; import com.mojang.authlib.SignatureState;
public class MinecraftProfileTextures { public class MinecraftProfileTextures {
public MinecraftProfileTextures(MinecraftProfileTexture skin, MinecraftProfileTexture cape, MinecraftProfileTexture elytra, SignatureState signatureState) { public MinecraftProfileTextures(MinecraftProfileTexture skin, MinecraftProfileTexture cape, MinecraftProfileTexture elytra, SignatureState signatureState) {}
public MinecraftProfileTexture skin() { return null; }
}
} }
@@ -0,0 +1,7 @@
package com.mojang.authlib.minecraft;
import com.mojang.authlib.properties.Property;
public interface MinecraftSessionService {
MinecraftProfileTextures unpackTextures(Property packedTextures);
}
@@ -0,0 +1,17 @@
package net.minecraft.client;
import java.io.File;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.SkinManager;
public class Minecraft {
public File gameDir;
public static Minecraft getMinecraft() { return null; }
public ServerData getCurrentServerData() { return null; }
public IResourceManager getResourceManager() { return null; }
public SkinManager getSkinManager() { return null; }
public TextureManager getTextureManager() { return null; }
}
@@ -0,0 +1,5 @@
package net.minecraft.client.gui;
public class GuiPlayerTabOverlay {
}
@@ -0,0 +1,5 @@
package net.minecraft.client.multiplayer;
public class ServerData {
public String serverIP;
}
@@ -0,0 +1,10 @@
package net.minecraft.client.renderer;
import java.io.InputStream;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.NativeImage;
public class ThreadDownloadImageData implements ITextureObject {
public NativeImage loadTexture(InputStream stream) { return null; }
}
@@ -0,0 +1,5 @@
package net.minecraft.client.renderer.entity;
public class RenderPlayer {
}
@@ -0,0 +1,5 @@
package net.minecraft.client.renderer.entity.layers;
public class LayerCape {
}
@@ -0,0 +1,5 @@
package net.minecraft.client.renderer.texture;
public abstract class AbstractTexture {
}
@@ -0,0 +1,5 @@
package net.minecraft.client.renderer.texture;
public interface ITextureObject {
}
@@ -0,0 +1,5 @@
package net.minecraft.client.renderer.texture;
public abstract class ReloadableTexture extends AbstractTexture {
}
@@ -0,0 +1,9 @@
package net.minecraft.client.renderer.texture;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
public class SimpleTexture extends ReloadableTexture implements ITextureObject {
public SimpleTexture(ResourceLocation location) {}
public TextureContents loadContents(IResourceManager resourceManager) { return null; }
}
@@ -0,0 +1,12 @@
package net.minecraft.client.renderer.texture;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
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; }
}
@@ -0,0 +1,7 @@
package net.minecraft.client.renderer.texture;
import net.minecraft.client.resources.data.TextureMetadataSection;
public class TextureContents {
public TextureContents(NativeImage image, TextureMetadataSection metadata) {}
}
@@ -0,0 +1,10 @@
package net.minecraft.client.renderer.texture;
import net.minecraft.util.ResourceLocation;
public class TextureManager {
public ITextureObject getTexture(ResourceLocation location) { return null; }
public void loadTexture(ResourceLocation location, AbstractTexture texture) {}
public boolean loadTexture(ResourceLocation location, ITextureObject texture) { return false; }
public void registerAndLoad(ResourceLocation resourceLocation, ReloadableTexture reloadableTexture) {}
}
@@ -0,0 +1,9 @@
package net.minecraft.client.resources;
import java.util.UUID;
import net.minecraft.util.ResourceLocation;
public class DefaultPlayerSkin {
public static ResourceLocation getDefaultSkin(UUID uuid) { return null; }
}
@@ -0,0 +1,7 @@
package net.minecraft.client.resources;
import java.io.InputStream;
public interface IResource {
InputStream getInputStream();
}
@@ -0,0 +1,7 @@
package net.minecraft.client.resources;
import net.minecraft.util.ResourceLocation;
public interface IResourceManager {
IResource getResource(ResourceLocation location);
}
@@ -0,0 +1,15 @@
package net.minecraft.client.resources;
import java.util.concurrent.CompletableFuture;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTextures;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import net.minecraft.server.Services;
public class SkinManager$1 {
public CompletableFuture<?> load(SkinManager$CacheKey cacheKey) { return null; }
public static SkinManager$TextureInfo lambda$load$0(MinecraftSessionService sessionService, GameProfile profile) { return null; }
public static MinecraftProfileTextures lambda$load$0(SkinManager$CacheKey cacheKey, MinecraftSessionService sessionService) { return null; }
public static MinecraftProfileTextures lambda$load$0(SkinManager$CacheKey cacheKey, Services services) { return null; }
}
@@ -0,0 +1,9 @@
package net.minecraft.client.resources;
import java.util.UUID;
import com.mojang.authlib.properties.Property;
public class SkinManager$CacheKey {
public SkinManager$CacheKey(UUID uuid, Property property) { }
}
@@ -0,0 +1,8 @@
package net.minecraft.client.resources;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import net.minecraft.util.ResourceLocation;
public interface SkinManager$ISkinAvailableCallback {
void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
}
@@ -0,0 +1,15 @@
package net.minecraft.client.resources;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import net.minecraft.util.ResourceLocation;
// put into mod jar to prevent https://github.com/cpw/modlauncher/issues/39
public interface SkinManager$SkinAvailableCallback {
default void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
this.onSkinTextureAvailable(typeIn, location, profileTexture);
}
default void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
((SkinManager$ISkinAvailableCallback) this).onSkinTextureAvailable(typeIn, location, profileTexture);
}
}
@@ -0,0 +1,10 @@
package net.minecraft.client.resources;
import java.util.concurrent.CompletableFuture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
public class SkinManager$TextureCache {
private MinecraftProfileTexture.Type type;
public CompletableFuture<?> registerTexture(MinecraftProfileTexture texture) { return null; }
}
@@ -1,4 +1,5 @@
package net.minecraft.client.resources; package net.minecraft.client.resources;
public class SkinManager$1 { public class SkinManager$TextureInfo {
} }
@@ -0,0 +1,22 @@
package net.minecraft.client.resources;
import java.io.File;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
public class SkinManager {
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { }
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<?> get(GameProfile profile) { return null; }
public CompletableFuture<?> getOrLoad(GameProfile profile) { 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) {}
}
@@ -0,0 +1,5 @@
package net.minecraft.client.resources.data;
public class TextureMetadataSection {
}
@@ -0,0 +1,5 @@
package net.minecraft.server;
public class Services {
}
@@ -0,0 +1,6 @@
package net.minecraft.util;
public class ResourceLocation {
public ResourceLocation(String path) {}
public ResourceLocation(String domain, String path) {}
}
@@ -0,0 +1,5 @@
package net.minecraft.util;
public class StringUtils {
public static String stripControlCodes(String string) { return null; }
}
+12 -3
View File
@@ -7,9 +7,9 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486 getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478 func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
profile ()Lcom/mojang/authlib/GameProfile; comp_1631 getPixel (II)I method_61940
packedTextures ()Lcom/mojang/authlib/properties/Property; comp_2011 setPixel (III)V method_61941
net/minecraft/client/Minecraft net/minecraft/class_310 net/minecraft/client/Minecraft net/minecraft/class_310
gameDir field_1697 gameDir field_1697
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; method_1558 getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; method_1558
@@ -29,6 +29,7 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046 net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007 net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972 net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/class_1044
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062 net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011 net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
func_195699_a (IIIIIIZZ)V method_4304 func_195699_a (IIIIIIZZ)V method_4304
@@ -39,10 +40,16 @@ net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; method_4309 func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; method_4309
func_195714_b ()I method_4323 func_195714_b ()I method_4323
func_195715_a (IIIII)V method_4326 func_195715_a (IIIII)V method_4326
net/minecraft/client/renderer/texture/ReloadableTexture net/minecraft/class_10537
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/class_10538
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049 net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049
loadContents (Lnet/minecraft/client/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/TextureContents; method_65809
net/minecraft/client/renderer/texture/TextureContents net/minecraft/class_10539
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060 net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619 getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V method_4616
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616 loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V method_65876
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068 net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648 getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648
net/minecraft/client/resources/IResource net/minecraft/class_3298 net/minecraft/client/resources/IResource net/minecraft/class_3298
@@ -57,8 +64,10 @@ net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$cla
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072 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 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 net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071$class_8687
net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/class_1084
net/minecraft/resources/IResource net/minecraft/class_3298 net/minecraft/resources/IResource net/minecraft/class_3298
net/minecraft/resources/IResourceManager net/minecraft/class_3300 net/minecraft/resources/IResourceManager net/minecraft/class_3300
net/minecraft/server/Services net/minecraft/class_7497
net/minecraft/util/ResourceLocation net/minecraft/class_2960 net/minecraft/util/ResourceLocation net/minecraft/class_2960
net/minecraft/util/StringUtils net/minecraft/class_3544 net/minecraft/util/StringUtils net/minecraft/class_3544
stripControlCodes (Ljava/lang/String;)Ljava/lang/String; method_15440 stripControlCodes (Ljava/lang/String;)Ljava/lang/String; method_15440
+1
View File
@@ -18,6 +18,7 @@ repositories {
} }
dependencies { dependencies {
implementation project(':Dummy')
// This is the minimum version number that the mod should dependent in the development environment. // This is the minimum version number that the mod should dependent in the development environment.
implementation "net.fabricmc:fabric-loader:0.12.0" implementation "net.fabricmc:fabric-loader:0.12.0"
} }
+2 -2
View File
@@ -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;\ 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,1.21.9,1.21.10;\
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 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,1.21.9,1.21.10
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
#forge gradle needs forge version #forge gradle needs forge version
forge_mc_version=1.12.2 forge_mc_version=1.12.2
+14 -2
View File
@@ -12,6 +12,7 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/class_4597 net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/class_4597
net/minecraft/client/renderer/RenderType net/minecraft/class_1921 net/minecraft/client/renderer/RenderType net/minecraft/class_1921
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; method_23572 getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; method_23572
net/minecraft/client/renderer/SubmitNodeCollector net/minecraft/class_11659
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046 net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046
processTask field_20843 processTask field_20843
loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; method_22795 loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; method_22795
@@ -22,13 +23,21 @@ net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972 net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V method_4177 doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V method_4177
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V method_4177 doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V method_4177
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V method_4177
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V method_4177
net/minecraft/client/renderer/entity/state/AvatarRenderState net/minecraft/class_10055
net/minecraft/client/renderer/entity/state/PlayerRenderState net/minecraft/class_10055
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011 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$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; method_65866
lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Lnet/minecraft/core/ClientAsset$DownloadedTexture;Z)Lnet/minecraft/client/renderer/texture/NativeImage; method_65866
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage; method_65863
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060 net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
net/minecraft/client/resources/PlayerSkin net/minecraft/class_8685
net/minecraft/client/resources/SkinManager net/minecraft/class_1071 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_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 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 get (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; method_52863_
getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; method_52863 getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; method_52863
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V method_4652 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 loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; method_4651
@@ -36,6 +45,7 @@ net/minecraft/client/resources/SkinManager net/minecraft/class_1071
net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1 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 (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 lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; method_54647
lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lnet/minecraft/server/Services;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; method_54647
load (Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture; method_52868 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$CacheKey net/minecraft/class_1071$class_8686
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072 net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
@@ -43,6 +53,8 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071
type field_45641 type field_45641
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; method_52873 registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; method_52873
net/minecraft/client/resources/SkinManager$TextureInfo net/minecraft/class_1071$class_8688 net/minecraft/client/resources/SkinManager$TextureInfo net/minecraft/class_1071$class_8688
net/minecraft/core/ClientAsset$DownloadedTexture net/minecraft/class_12079$class_12080
net/minecraft/scoreboard/ScoreObjective net/minecraft/class_266 net/minecraft/scoreboard/ScoreObjective net/minecraft/class_266
net/minecraft/scoreboard/Scoreboard net/minecraft/class_269 net/minecraft/scoreboard/Scoreboard net/minecraft/class_269
net/minecraft/server/Services net/minecraft/class_7497
net/minecraft/util/ResourceLocation net/minecraft/class_2960 net/minecraft/util/ResourceLocation net/minecraft/class_2960
@@ -35,10 +35,17 @@ public class DevEnvRemapper extends SimpleRemapper {
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager") Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
) )
); );
remappedClasses.put(
"net.minecraft.class_1011",
new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeNativeImage"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
remappedClasses.put( remappedClasses.put(
"net.minecraft.class_3298", "net.minecraft.class_3298",
new AbstractMap.SimpleEntry<>( new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeIResource"), Lists.newArrayList("customskinloader.fake.itf.IFakeIResource$V1", "customskinloader.fake.itf.IFakeIResource$V2"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager") Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
) )
); );
@@ -1,2 +1,6 @@
accessWidener v2 intermediary accessWidener v2 intermediary
accessible method net/minecraft/class_2960 <init> (Ljava/lang/String;Ljava/lang/String;)V extendable class net/minecraft/class_1011 # 24w46a+
extendable class net/minecraft/class_1071$class_8686 # 23w31a+
extendable class net/minecraft/class_2960 # 24w46a+
accessible method net/minecraft/class_1071$class_8686 <init> (Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V # 23w42a+
accessible method net/minecraft/class_2960 <init> (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
@@ -9,13 +9,14 @@
"MixinIResourceManager", "MixinIResourceManager",
"MixinLayerCape", "MixinLayerCape",
"MixinMinecraft", "MixinMinecraft",
"MixinNativeImage",
"MixinRenderPlayer", "MixinRenderPlayer",
"MixinSkinManager$1", "MixinSkinManager$1",
"MixinSkinManager$CacheKey",
"MixinSkinManager$TextureCache", "MixinSkinManager$TextureCache",
"MixinSkinManager$V1", "MixinSkinManager$V1",
"MixinSkinManager$V2", "MixinSkinManager$V2",
"MixinSkinManager$V3", "MixinSkinManager$V3",
"MixinSkinTextureDownloader",
"MixinThreadDownloadImageData$V1", "MixinThreadDownloadImageData$V1",
"MixinThreadDownloadImageData$V2" "MixinThreadDownloadImageData$V2"
], ],
+5
View File
@@ -0,0 +1,5 @@
// This subproject is only to provide dependency for other subprojects.
dependencies {
implementation project(':Dummy')
}
@@ -0,0 +1,7 @@
package net.minecraftforge.fml.common.asm.transformers.deobf;
import org.objectweb.asm.commons.Remapper;
public class FMLDeobfuscatingRemapper extends Remapper {
public static FMLDeobfuscatingRemapper INSTANCE;
}
@@ -0,0 +1,7 @@
package net.minecraftforge.fml.relauncher;
import java.util.List;
public class CoreModManager {
public static List<String> getIgnoredMods() { return null; }
}
@@ -0,0 +1,5 @@
package net.minecraftforge.fml.relauncher;
public class FMLLaunchHandler {
public static Side side() { return null; }
}
@@ -0,0 +1,19 @@
package net.minecraftforge.fml.relauncher;
import java.util.Map;
public interface IFMLLoadingPlugin {
String[] getASMTransformerClass();
String getModContainerClass();
String getSetupClass();
void injectData(Map<String, Object> data);
String getAccessTransformerClass();
@interface Name {
String value();
}
@interface SortingIndex {
int value();
}
}
@@ -0,0 +1,5 @@
package net.minecraftforge.fml.relauncher;
public enum Side {
}
+1 -3
View File
@@ -6,9 +6,6 @@ jar {
"TweakOrder": -10 "TweakOrder": -10
]) ])
} }
exclude 'net/minecraft/client/resources/SkinManager.class'
exclude 'net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.class'
} }
sourceJar { sourceJar {
exclude 'net/**' exclude 'net/**'
@@ -20,6 +17,7 @@ tasks.signJar {
} }
dependencies { dependencies {
implementation project(':Dummy')
implementation project(":Forge/Common") implementation project(":Forge/Common")
} }
@@ -33,6 +33,9 @@ public class ForgeTweaker implements ITweaker {
@Override @Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) { 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")); LogManager.setLogFile(gameDir.toPath().resolve("CustomSkinLoader/CustomSkinLoader.log"));
} }
@@ -99,8 +99,7 @@ public class SkinManagerTransformer {
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) { if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain; MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "java/util/concurrent/ExecutorService") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "submit") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) { if (TransformerManager.checkClassName(min.owner, "java/util/concurrent/ExecutorService") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "submit") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) {
mn.instructions.insertBefore(min, new VarInsnNode(Opcodes.ALOAD, 1)); mn.instructions.set(min, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;)V", false));
mn.instructions.set(min, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
} }
} }
} }
@@ -1,10 +1,8 @@
package net.minecraft.client.resources; package net.minecraft.client.resources;
import java.io.IOException;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
// this class shouldn't be created by ASM because of modlauncher issue. // this class shouldn't be created by ASM because of modlauncher issue.
public interface IResourceManager { public interface IResourceManager {
IResource getResource(ResourceLocation location) throws IOException; IResource getResource(ResourceLocation location);
} }
@@ -0,0 +1,15 @@
package net.minecraft.client.resources;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import net.minecraft.util.ResourceLocation;
// put into mod jar to prevent https://github.com/cpw/modlauncher/issues/39
public interface SkinManager$SkinAvailableCallback {
default void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
this.onSkinTextureAvailable(typeIn, location, profileTexture);
}
default void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
((SkinManager$ISkinAvailableCallback) this).onSkinTextureAvailable(typeIn, location, profileTexture);
}
}
@@ -1,35 +0,0 @@
package net.minecraft.client.resources;
import java.io.File;
import java.util.Map;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
// exclude
public class SkinManager {
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { }
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { return null; }
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) { return null; }
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { }
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) { return null; }
// put into mod jar to prevent https://github.com/cpw/modlauncher/issues/39
public interface SkinAvailableCallback {
default void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
this.onSkinTextureAvailable(typeIn, location, profileTexture);
}
default void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
((SkinManager.ISkinAvailableCallback) this).onSkinTextureAvailable(typeIn, location, profileTexture);
}
}
// exclude
public interface ISkinAvailableCallback {
void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
}
}
@@ -10,7 +10,7 @@ description='''
Custom Skin Loader for Minecraft Custom Skin Loader for Minecraft
''' '''
displayURL="https://github.com/xfl03/MCCustomSkinLoader" displayURL="https://github.com/xfl03/MCCustomSkinLoader"
authors=["xfl03", "JLChnToZ", "ZekerZhayard"] authors="xfl03, JLChnToZ, ZekerZhayard"
[[dependencies.customskinloader]] [[dependencies.customskinloader]]
modId="forge" modId="forge"
mandatory=true mandatory=true
+13 -2
View File
@@ -100,11 +100,10 @@ function initializeCoreMod() {
if (node.getOpcode() === Opcodes.INVOKEINTERFACE if (node.getOpcode() === Opcodes.INVOKEINTERFACE
&& ((node.owner.equals("java/util/concurrent/ExecutorService") && checkName(node.name, "submit") && node.desc.equals("(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) // 1.14.4- && ((node.owner.equals("java/util/concurrent/ExecutorService") && checkName(node.name, "submit") && node.desc.equals("(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) // 1.14.4-
|| (node.owner.equals("java/util/concurrent/Executor") && checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")))) { // 1.15+ || (node.owner.equals("java/util/concurrent/Executor") && checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")))) { // 1.15+
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
if (node.desc.endsWith("V")) { if (node.desc.endsWith("V")) {
mn.instructions.insert(node, new InsnNode(Opcodes.POP)); mn.instructions.insert(node, new InsnNode(Opcodes.POP));
} }
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false)); mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;)V", false));
} }
} }
} else if (((checkName(mn.name, "func_210275_a") || checkName(mn.name, "lambda$loadProfileTextures$1")) // 1.14.4- } else if (((checkName(mn.name, "func_210275_a") || checkName(mn.name, "lambda$loadProfileTextures$1")) // 1.14.4-
@@ -184,6 +183,18 @@ function initializeCoreMod() {
return cn; 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+ // For 1.14+
'MinecraftTransformer': { 'MinecraftTransformer': {
+12 -3
View File
@@ -7,9 +7,9 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_ getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_ func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
profile ()Lcom/mojang/authlib/GameProfile; f_290972_ getPixel (II)I getPixel
packedTextures ()Lcom/mojang/authlib/properties/Property; f_303729_ setPixel (III)V setPixel
net/minecraft/client/Minecraft net/minecraft/client/Minecraft net/minecraft/client/Minecraft net/minecraft/client/Minecraft
gameDir f_91069_ gameDir f_91069_
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; m_91089_ getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; m_91089_
@@ -29,6 +29,7 @@ net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffe
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture 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/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/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer
net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V m_85025_ func_195699_a (IIIIIIZZ)V m_85025_
@@ -39,10 +40,16 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; m_85058_ func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; m_85058_
func_195714_b ()I m_85084_ func_195714_b ()I m_85084_
func_195715_a (IIIII)V m_84997_ func_195715_a (IIIII)V m_84997_
net/minecraft/client/renderer/texture/ReloadableTexture net/minecraft/client/renderer/texture/ReloadableTexture
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture
loadContents (Lnet/minecraft/client/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/TextureContents; loadContents
net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureContents
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V m_118495_
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_ getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_
net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource
@@ -57,8 +64,10 @@ net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resourc
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback 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_ 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 net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache
net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/client/resources/metadata/texture/TextureMetadataSection
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
net/minecraft/server/Services net/minecraft/server/Services
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
net/minecraft/util/StringUtils net/minecraft/util/StringUtil net/minecraft/util/StringUtils net/minecraft/util/StringUtil
stripControlCodes (Ljava/lang/String;)Ljava/lang/String; m_14406_ stripControlCodes (Ljava/lang/String;)Ljava/lang/String; m_14406_
+1
View File
@@ -14,6 +14,7 @@ sourceJar {
} }
dependencies { dependencies {
implementation project(':Dummy')
implementation project(":Forge/Common") implementation project(":Forge/Common")
} }
@@ -0,0 +1,2 @@
public-f net.minecraft.client.resources.SkinManager$CacheKey # 23w31a+
public net.minecraft.client.resources.SkinManager$CacheKey <init>(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V # 23w42a+
@@ -10,7 +10,7 @@ description='''
Custom Skin Loader for Minecraft Custom Skin Loader for Minecraft
''' '''
displayURL="https://github.com/xfl03/MCCustomSkinLoader" displayURL="https://github.com/xfl03/MCCustomSkinLoader"
authors=["xfl03", "JLChnToZ", "ZekerZhayard"] authors="xfl03, JLChnToZ, ZekerZhayard"
[[dependencies.customskinloader]] [[dependencies.customskinloader]]
modId="forge" modId="forge"
mandatory=true mandatory=true
+24 -35
View File
@@ -91,9 +91,8 @@ function initializeCoreMod() {
&& (node.owner.equals("java/util/concurrent/Executor") // 1.17.1 && (node.owner.equals("java/util/concurrent/Executor") // 1.17.1
|| node.owner.equals("java/util/concurrent/ExecutorService")) // 1.18+ || node.owner.equals("java/util/concurrent/ExecutorService")) // 1.18+
&& checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")) { && checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, new InsnNode(Opcodes.POP)); mn.instructions.insert(node, new InsnNode(Opcodes.POP));
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false)); mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;)V", false));
} }
} }
} else if (checkName(mn.name, "m_118821_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) { // 1.20.1- } else if (checkName(mn.name, "m_118821_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) { // 1.20.1-
@@ -118,10 +117,6 @@ function initializeCoreMod() {
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1)); mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false)); mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN)); mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN));
} else if (checkName(mn.name, "m_293307_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin;")) { // 1.20.2+
var first = mn.instructions.getFirst();
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkullType", "(Lcom/mojang/authlib/GameProfile;)V", false));
} else if (checkName(mn.name, "m_293351_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;")) { // 1.20.2+ } 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();) { for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next(); var node = iterator.next();
@@ -129,7 +124,7 @@ function initializeCoreMod() {
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createProperty", "(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/properties/Property;", false)); mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createProperty", "(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/properties/Property;", false));
} else if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/google/common/cache/LoadingCache") && checkName(node.name, "getUnchecked") && node.desc.equals("(Ljava/lang/Object;)Ljava/lang/Object;")) { } 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.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)); mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadCache", "(Ljava/lang/Object;Lcom/mojang/authlib/GameProfile;)Ljava/lang/Object;", false));
} }
} }
} }
@@ -147,23 +142,14 @@ function initializeCoreMod() {
if (checkName(mn.name, "load") && mn.desc.equals("(Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture;")) { if (checkName(mn.name, "load") && mn.desc.equals("(Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture;")) {
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) { for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next(); var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("java/util/concurrent/CompletableFuture") && checkName(node.name, "supplyAsync") && node.desc.equals("(Ljava/util/function/Supplier;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;")) { if ((node.getOpcode() === Opcodes.INVOKESTATIC
var s = "("; || node.getOpcode() === Opcodes.INVOKEVIRTUAL)
var args = Type.getType(node.desc).getArgumentTypes(); && node.owner.equals("java/util/concurrent/CompletableFuture")
for (var i = 0; i < args.length; i++) { && (checkName(node.name, "supplyAsync")
s = s + "Ljava/lang/Object;"; || checkName(node.name, "thenComposeAsync"))
} && (node.desc.equals("(Ljava/util/function/Supplier;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;")
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false)); || node.desc.equals("(Ljava/util/function/Function;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"))) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1)); mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/util/concurrent/Executor;)Ljava/util/concurrent/Executor;", 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));
mn.instructions.insertBefore(node, new InsnNode(Opcodes.AALOAD));
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
}
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;")) { // 1.20.2 } 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
@@ -177,8 +163,9 @@ function initializeCoreMod() {
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) { for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next(); 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;")) { 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.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insert(node, new TypeInsnNode(Opcodes.CHECKCAST, "com/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)); mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/properties/Property;Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/lang/Object;", false));
} }
} }
} }
@@ -186,16 +173,6 @@ function initializeCoreMod() {
return cn; 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': { 'IResourceTransformer': {
'target': { 'target': {
'type': 'CLASS', 'type': 'CLASS',
@@ -227,6 +204,18 @@ function initializeCoreMod() {
return cn; 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': { 'PlayerTabOverlayTransformer': {
'target': { 'target': {
'type': 'CLASS', 'type': 'CLASS',
+12 -3
View File
@@ -7,9 +7,9 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; getResourceManager func_195551_G ()Lnet/minecraft/resources/IResourceManager; getResourceManager
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
profile ()Lcom/mojang/authlib/GameProfile; profile getPixel (II)I getPixel
packedTextures ()Lcom/mojang/authlib/properties/Property; packedTextures setPixel (III)V setPixel
net/minecraft/client/Minecraft net/minecraft/client/Minecraft net/minecraft/client/Minecraft net/minecraft/client/Minecraft
gameDir gameDirectory gameDir gameDirectory
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; getCurrentServer getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; getCurrentServer
@@ -29,6 +29,7 @@ net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffe
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture 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/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/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer
net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V copyRect func_195699_a (IIIIIIZZ)V copyRect
@@ -39,10 +40,16 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; read func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; read
func_195714_b ()I getHeight func_195714_b ()I getHeight
func_195715_a (IIIII)V fillRect func_195715_a (IIIII)V fillRect
net/minecraft/client/renderer/texture/ReloadableTexture net/minecraft/client/renderer/texture/ReloadableTexture
net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture
loadContents (Lnet/minecraft/client/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/TextureContents; loadContents
net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureContents
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; getTexture getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; getTexture
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V register
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z register loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z register
registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; getDefaultSkin getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; getDefaultSkin
net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource
@@ -57,8 +64,10 @@ net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resourc
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback 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 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/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache
net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/client/resources/metadata/texture/TextureMetadataSection
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
net/minecraft/server/Services net/minecraft/server/Services
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
net/minecraft/util/StringUtils net/minecraft/util/StringUtil net/minecraft/util/StringUtils net/minecraft/util/StringUtil
stripControlCodes (Ljava/lang/String;)Ljava/lang/String; stripColor stripControlCodes (Ljava/lang/String;)Ljava/lang/String; stripColor
+1
View File
@@ -15,6 +15,7 @@ sourceJar {
} }
dependencies { dependencies {
implementation project(':Dummy')
implementation project(":Forge/Common") implementation project(":Forge/Common")
} }
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies=Forge|1.20.6,1.21;\ 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,1.21.9,1.21.10;\
NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21 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,1.21.9,1.21.10
java_full_versions=17,18,19,20,21,22 java_full_versions=17,18,19,20,21,22
#forge gradle needs forge version #forge gradle needs forge version
forge_mc_version=1.12.2 forge_mc_version=1.12.2
+14 -2
View File
@@ -12,6 +12,7 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/HttpTex
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/MultiBufferSource net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/MultiBufferSource
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; entitySolid getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; entitySolid
net/minecraft/client/renderer/SubmitNodeCollector net/minecraft/client/renderer/SubmitNodeCollector
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
processTask onDownloaded processTask onDownloaded
loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; load loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; load
@@ -22,13 +23,21 @@ net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer 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;FFFFFF)V render
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V render doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V render
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V render
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V submit
net/minecraft/client/renderer/entity/state/AvatarRenderState net/minecraft/client/renderer/entity/state/AvatarRenderState
net/minecraft/client/renderer/entity/state/PlayerRenderState net/minecraft/client/renderer/entity/state/PlayerRenderState
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
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$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; lambda$downloadAndRegisterSkin$0
lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Lnet/minecraft/core/ClientAsset$DownloadedTexture;Z)Lnet/minecraft/client/renderer/texture/NativeImage; lambda$downloadAndRegisterSkin$0
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage; processLegacySkin
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager 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 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_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 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 get (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; get
getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; getOrLoad getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; getOrLoad
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V registerSkins 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 loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; registerTexture
@@ -36,6 +45,7 @@ net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinMa
net/minecraft/client/resources/SkinManager$1 net/minecraft/client/resources/SkinManager$1 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 (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 lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; lambda$load$0
lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lnet/minecraft/server/Services;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; lambda$load$0
load (Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture; load 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$CacheKey net/minecraft/client/resources/SkinManager$CacheKey
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback
@@ -43,6 +53,8 @@ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/res
type type type type
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; registerTexture 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/client/resources/SkinManager$TextureInfo net/minecraft/client/resources/SkinManager$TextureInfo
net/minecraft/core/ClientAsset$DownloadedTexture net/minecraft/core/ClientAsset$DownloadedTexture
net/minecraft/scoreboard/ScoreObjective net/minecraft/world/scores/Objective net/minecraft/scoreboard/ScoreObjective net/minecraft/world/scores/Objective
net/minecraft/scoreboard/Scoreboard net/minecraft/world/scores/Scoreboard net/minecraft/scoreboard/Scoreboard net/minecraft/world/scores/Scoreboard
net/minecraft/server/Services net/minecraft/server/Services
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more