mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
299c8f53cf | ||
|
|
13fb0a4f92 | ||
|
|
921374f24f | ||
|
|
d2d244c70e | ||
|
|
f201f344a2 | ||
|
|
76d6ed9a41 | ||
|
|
b807aa1fb1 | ||
|
|
d797ed378a | ||
|
|
c3f8f1eb8f | ||
|
|
226d953012 | ||
|
|
d1ab2fbf43 | ||
|
|
00a14010c6 | ||
|
|
a198e40fc7 | ||
|
|
5b820c537d | ||
|
|
6e1be02cf0 | ||
|
|
9abf9eb779 | ||
|
|
fbc95314ad | ||
|
|
d4576249ac | ||
|
|
dfe47f7c64 | ||
|
|
1199e10ca4 | ||
|
|
61287cf64c | ||
|
|
b16058340c | ||
|
|
ac09a51f48 | ||
|
|
3e5bd83b5c | ||
|
|
4ce00d07b5 | ||
|
|
6e9380be49 | ||
|
|
53050a63f5 | ||
|
|
34ac3ac4f2 |
No files matched your search
@@ -41,8 +41,6 @@ body:
|
|||||||
placeholder: "Ex: https://mclo.gs/xxxxxx"
|
placeholder: "Ex: https://mclo.gs/xxxxxx"
|
||||||
- type: input
|
- type: input
|
||||||
id: csl-log
|
id: csl-log
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
attributes:
|
attributes:
|
||||||
label: Link to CustomSkinLoader.log if applicable
|
label: Link to CustomSkinLoader.log if applicable
|
||||||
description: |
|
description: |
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ body:
|
|||||||
placeholder: "示例: https://mclo.gs/xxxxxx"
|
placeholder: "示例: https://mclo.gs/xxxxxx"
|
||||||
- type: input
|
- type: input
|
||||||
id: csl-log
|
id: csl-log
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
attributes:
|
attributes:
|
||||||
label: CustomSkinLoader.log 查看地址
|
label: CustomSkinLoader.log 查看地址
|
||||||
description: |
|
description: |
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Set up JDK
|
name: Set up JDK
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
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@v4
|
uses: actions/upload-artifact@v3
|
||||||
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,10 +53,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
website: [CurseForge_Modrinth]
|
website: [CurseForge_Modrinth]
|
||||||
modtype: [Fabric,ForgeV1,ForgeV2,ForgeV3]
|
modtype: [Fabric,Forge-Active,Forge-Legacy]
|
||||||
include:
|
include:
|
||||||
-
|
-
|
||||||
website: ObjectStorage
|
website: TencentCOS
|
||||||
modtype: All
|
modtype: All
|
||||||
# -
|
# -
|
||||||
# website: GitHub-Release
|
# website: GitHub-Release
|
||||||
@@ -69,9 +69,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout Git Repository
|
name: Checkout Git Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v3
|
||||||
name: Download Artifact Zips
|
name: Download Artifact Zips
|
||||||
with:
|
with:
|
||||||
path: build
|
path: build
|
||||||
@@ -86,41 +86,20 @@ 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
|
||||||
case "${{ matrix.modtype }}" in
|
modloader="Forge"
|
||||||
"ForgeV1")
|
path=$(echo ${{ matrix.modtype }} | sed "s#-#/#")
|
||||||
modloader="Forge"
|
else
|
||||||
path=`echo "${{ matrix.modtype }}" | sed 's#V#/V#'`
|
modloader=${{ matrix.modtype }}
|
||||||
;;
|
path=${{ matrix.modtype }}
|
||||||
"ForgeV2" | "ForgeV3")
|
fi
|
||||||
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 "dependencies=" "$path"/build.properties | grep -v "#" | awk -F '|' '{print $2}' | sed 's#\;\\##' | sed "s/,/\n/g" >> $GITHUB_OUTPUT
|
grep "minecraft_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/minecraft_full_versions=//" | 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
|
||||||
@@ -135,7 +114,7 @@ jobs:
|
|||||||
echo "pathlist="$(find build/libs -type f|grep -v "sources"|grep -v "json")"" >> $GITHUB_OUTPUT
|
echo "pathlist="$(find build/libs -type f|grep -v "sources"|grep -v "json")"" >> $GITHUB_OUTPUT
|
||||||
-
|
-
|
||||||
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
||||||
name: "[GitHub Pre-Release] Delete"
|
name: 【GitHub Pre-Release】 Delete
|
||||||
uses: 8Mi-Tech/delete-release-assets-action@main
|
uses: 8Mi-Tech/delete-release-assets-action@main
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -154,7 +133,7 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
-
|
-
|
||||||
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
|
uses: richardsimko/update-tag@v1
|
||||||
with:
|
with:
|
||||||
tag_name: CI-Build
|
tag_name: CI-Build
|
||||||
@@ -162,8 +141,8 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
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@v2
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
name: CustomSkinLoader CI-Build
|
name: CustomSkinLoader CI-Build
|
||||||
@@ -175,7 +154,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
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
|
||||||
name: "[GitHub Release] Publish"
|
name: 【GitHub Release】 Publish
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
name: CustomSkinLoader ${{ github.ref }}
|
name: CustomSkinLoader ${{ github.ref }}
|
||||||
@@ -183,16 +162,12 @@ jobs:
|
|||||||
#generate_release_notes: true
|
#generate_release_notes: true
|
||||||
files: ${{ steps.cslenv-github.outputs.pathlist }}
|
files: ${{ steps.cslenv-github.outputs.pathlist }}
|
||||||
-
|
-
|
||||||
if: ${{ matrix.website == 'ObjectStorage' }}
|
if: ${{ matrix.website == 'TencentCOS' }}
|
||||||
name: "[ObjectStorage] Publish"
|
name: 【TencentCOS】 Publish
|
||||||
env:
|
env:
|
||||||
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
||||||
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
||||||
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
||||||
R2_BASE_URL: ${{ secrets.R2_BASE_URL }}
|
|
||||||
R2_BUCKET: ${{ secrets.R2_BUCKET }}
|
|
||||||
R2_SECRET_ID: ${{ secrets.R2_SECRET_ID }}
|
|
||||||
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
|
|
||||||
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
|
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
|
||||||
run: |
|
run: |
|
||||||
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
|
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
|
||||||
@@ -201,7 +176,7 @@ jobs:
|
|||||||
|
|
||||||
-
|
-
|
||||||
if: ${{ matrix.website == 'CurseForge_Modrinth' && inputs.type == 'Release' }}
|
if: ${{ matrix.website == 'CurseForge_Modrinth' && inputs.type == 'Release' }}
|
||||||
name: "[CurseForge & Modrinth] Publish"
|
name: 【CurseForge & Modrinth】 Publish
|
||||||
uses: Kir-Antipov/[email protected]
|
uses: Kir-Antipov/[email protected]
|
||||||
with:
|
with:
|
||||||
modrinth-id: idMHQ4n2
|
modrinth-id: idMHQ4n2
|
||||||
|
|||||||
+8
-8
@@ -31,7 +31,7 @@ There are the available versions in different environments below:
|
|||||||
Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version}
|
Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version}
|
||||||
Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${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 `14.15-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_ForgeLegacy-${version}.pom`
|
||||||
```xml
|
```xml
|
||||||
@@ -40,7 +40,7 @@ There are the available versions in different environments below:
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>mods</groupId>
|
<groupId>mods</groupId>
|
||||||
<artifactId>CustomSkinLoader_ForgeLegacy</artifactId>
|
<artifactId>CustomSkinLoader_ForgeLegacy</artifactId>
|
||||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
|
||||||
<version>${version}</version>
|
<version>${version}</version>
|
||||||
</project>
|
</project>
|
||||||
```
|
```
|
||||||
@@ -51,7 +51,7 @@ There are the available versions in different environments below:
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>mods</groupId>
|
<groupId>mods</groupId>
|
||||||
<artifactId>CustomSkinLoader_ForgeActive</artifactId>
|
<artifactId>CustomSkinLoader_ForgeActive</artifactId>
|
||||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
|
||||||
<version>${version}</version>
|
<version>${version}</version>
|
||||||
</project>
|
</project>
|
||||||
```
|
```
|
||||||
@@ -62,7 +62,7 @@ There are the available versions in different environments below:
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>mods</groupId>
|
<groupId>mods</groupId>
|
||||||
<artifactId>CustomSkinLoader_Fabric</artifactId>
|
<artifactId>CustomSkinLoader_Fabric</artifactId>
|
||||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
|
||||||
<version>${version}</version>
|
<version>${version}</version>
|
||||||
</project>
|
</project>
|
||||||
```
|
```
|
||||||
@@ -71,7 +71,7 @@ There are the available versions in different environments below:
|
|||||||
1. Add below contents to `build.gradle`:
|
1. Add below contents to `build.gradle`:
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mods:CustomSkinLoader_ForgeLegacy:15.0-SNAPSHOT-00"
|
deobfCompile "mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00"
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
@@ -85,8 +85,8 @@ There are the available versions in different environments below:
|
|||||||
1. Add below contents to `build.gradle`:
|
1. Add below contents to `build.gradle`:
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:15.0-SNAPSHOT-00") // Only required for MinecraftForge 1.8 ~ 1.16.5
|
implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00") // Only required for MinecraftForge 1.8 ~ 1.16.5
|
||||||
implementation fg.deobf("mods:CustomSkinLoader_ForgeActive:15.0-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest
|
implementation fg.deobf("mods:CustomSkinLoader_ForgeActive:14.15-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
@@ -104,7 +104,7 @@ There are the available versions in different environments below:
|
|||||||
1. Add below contents to `build.gradle`:
|
1. Add below contents to `build.gradle`:
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
modImplementation "mods:CustomSkinLoader_Fabric:15.0-SNAPSHOT-00"
|
modImplementation "mods:CustomSkinLoader_Fabric:14.15-SNAPSHOT-00"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.runClient {
|
tasks.runClient {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
"name": "CustomSkinLoader",
|
"name": "CustomSkinLoader",
|
||||||
"version": "${modVersion}",
|
"version": "${modVersion}",
|
||||||
"fullVersion": "${modFullVersion}",
|
"fullVersion": "${modFullVersion}",
|
||||||
"dependencies": {
|
"mcVersion": "${mcVersion}",
|
||||||
"${dependencies}"
|
"mcFullVersions": "${mcFullVersions}",
|
||||||
},
|
"forgeVersion": "${forgeVersion}",
|
||||||
"gitVersion": "${gitVersion}",
|
"gitVersion": "${gitVersion}",
|
||||||
"buildUrl": "${buildUrl}",
|
"buildUrl": "${buildUrl}",
|
||||||
"buildTime": "${releaseTime}"
|
"buildTime": "${releaseTime}"
|
||||||
File renamed without changes.
+21
-18
@@ -8,7 +8,7 @@ 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.Consumer;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -49,7 +49,8 @@ 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<>());
|
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(
|
||||||
|
config.threadPoolSize, config.threadPoolSize, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>());
|
||||||
|
|
||||||
//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,32 +71,30 @@ public class CustomSkinLoader {
|
|||||||
THREAD_POOL.execute(runnable);
|
THREAD_POOL.execute(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object loadProfileLazily(GameProfile gameProfile, Function<UserProfile, ?> function) {
|
public static void loadProfileLazily(
|
||||||
|
GameProfile gameProfile, Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> consumer) {
|
||||||
String username = gameProfile.getName();
|
String username = gameProfile.getName();
|
||||||
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());
|
consumer.accept(Maps.newHashMap());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
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)) {
|
if (profileCache.isLoading(credential)) {
|
||||||
profileCache.putLoader(credential, function);
|
profileCache.putLoader(credential, consumer);
|
||||||
Thread.currentThread().setName(tempName);
|
Thread.currentThread().setName(tempName);
|
||||||
return function.apply(new UserProfile());
|
return;
|
||||||
}
|
}
|
||||||
Object result = function.apply(loadProfile(gameProfile));
|
consumer.accept(loadProfile(gameProfile));
|
||||||
Thread.currentThread().setName(tempName);
|
Thread.currentThread().setName(tempName);
|
||||||
Function<UserProfile, ?> func = profileCache.getLastLoader(credential);
|
profileCache.getLastLoader(credential).ifPresent(c -> loadProfileLazily(gameProfile, c));
|
||||||
if (func != null) {
|
|
||||||
result = loadProfileLazily(gameProfile, func);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//For User Skin
|
//For User Skin
|
||||||
public static UserProfile loadProfile(GameProfile gameProfile) {
|
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadProfile(GameProfile gameProfile) {
|
||||||
String credential = MinecraftUtil.getCredential(gameProfile);
|
String credential = MinecraftUtil.getCredential(gameProfile);
|
||||||
UserProfile profile;
|
UserProfile profile;
|
||||||
if (profileCache.isReady(credential)) {
|
if (profileCache.isReady(credential)) {
|
||||||
@@ -113,7 +112,7 @@ public class CustomSkinLoader {
|
|||||||
profileCache.setLoading(credential, true);
|
profileCache.setLoading(credential, true);
|
||||||
profile = loadProfile0(gameProfile, false);
|
profile = loadProfile0(gameProfile, false);
|
||||||
}
|
}
|
||||||
return profile == null ? new UserProfile() : profile;
|
return ModelManager0.fromUserProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Core
|
//Core
|
||||||
@@ -195,7 +194,8 @@ public class CustomSkinLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//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 = gameProfile.getName();
|
||||||
String credential = MinecraftUtil.getCredential(gameProfile);
|
String credential = MinecraftUtil.getCredential(gameProfile);
|
||||||
|
|
||||||
@@ -230,9 +230,12 @@ public class CustomSkinLoader {
|
|||||||
Logger logger = LogManager.getLogger("Core");
|
Logger logger = LogManager.getLogger("Core");
|
||||||
logger.info("CustomSkinLoader " + CustomSkinLoader_FULL_VERSION);
|
logger.info("CustomSkinLoader " + CustomSkinLoader_FULL_VERSION);
|
||||||
logger.info("DataDir: " + DATA_DIR.getAbsolutePath());
|
logger.info("DataDir: " + DATA_DIR.getAbsolutePath());
|
||||||
logger.info("Operating System: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"));
|
logger.info("Operating System: " + System.getProperty("os.name") +
|
||||||
logger.info("Java Version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor"));
|
" (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"));
|
||||||
logger.info("Java VM Version: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"));
|
logger.info("Java Version: " + System.getProperty("java.version") +
|
||||||
|
", " + System.getProperty("java.vendor"));
|
||||||
|
logger.info("Java VM Version: " + System.getProperty("java.vm.name") +
|
||||||
|
" (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"));
|
||||||
logger.info("Minecraft: " + MinecraftUtil.getMinecraftMainVersion());
|
logger.info("Minecraft: " + MinecraftUtil.getMinecraftMainVersion());
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package customskinloader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated From 14.16, use <code>customskinloader.log.Logger</code> instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class Logger extends customskinloader.log.Logger {
|
||||||
|
}
|
||||||
+5
-5
@@ -2,11 +2,7 @@ package customskinloader.config;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import customskinloader.CustomSkinLoader;
|
import customskinloader.CustomSkinLoader;
|
||||||
import customskinloader.loader.ProfileLoader;
|
import customskinloader.loader.ProfileLoader;
|
||||||
@@ -14,6 +10,7 @@ import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
|||||||
import customskinloader.plugin.PluginLoader;
|
import customskinloader.plugin.PluginLoader;
|
||||||
import customskinloader.utils.HttpRequestUtil;
|
import customskinloader.utils.HttpRequestUtil;
|
||||||
import customskinloader.utils.HttpTextureUtil;
|
import customskinloader.utils.HttpTextureUtil;
|
||||||
|
import customskinloader.utils.HttpUtil0;
|
||||||
import customskinloader.utils.Version;
|
import customskinloader.utils.Version;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
@@ -27,6 +24,7 @@ public class Config {
|
|||||||
//Function
|
//Function
|
||||||
public boolean enableDynamicSkull = true;
|
public boolean enableDynamicSkull = true;
|
||||||
public boolean enableTransparentSkin = true;
|
public boolean enableTransparentSkin = true;
|
||||||
|
public boolean forceIgnoreHttpsCertificate = false;
|
||||||
public boolean forceLoadAllTextures = true;
|
public boolean forceLoadAllTextures = true;
|
||||||
public boolean enableCape = true;
|
public boolean enableCape = true;
|
||||||
public int threadPoolSize = 8;
|
public int threadPoolSize = 8;
|
||||||
@@ -78,6 +76,8 @@ public class Config {
|
|||||||
config.updateLoadlist();
|
config.updateLoadlist();
|
||||||
config.initLocalFolder();
|
config.initLocalFolder();
|
||||||
config.threadPoolSize = Math.max(config.threadPoolSize, 1);
|
config.threadPoolSize = Math.max(config.threadPoolSize, 1);
|
||||||
|
if (config.forceIgnoreHttpsCertificate)
|
||||||
|
HttpUtil0.ignoreHttpsCertificate();
|
||||||
if (config.enableCacheAutoClean && !config.enableLocalProfileCache) {
|
if (config.enableCacheAutoClean && !config.enableLocalProfileCache) {
|
||||||
try {
|
try {
|
||||||
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
|
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
|
||||||
File renamed without changes.
+21
-1
@@ -7,12 +7,14 @@ import java.util.function.BiPredicate;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
import customskinloader.fake.itf.FakeInterfaceManager;
|
||||||
|
import customskinloader.fake.texture.FakeBufferedImage;
|
||||||
import customskinloader.fake.texture.FakeImage;
|
import customskinloader.fake.texture.FakeImage;
|
||||||
|
import customskinloader.utils.MinecraftUtil;
|
||||||
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 = new ResourceLocation("textures/entity/elytra.png");
|
||||||
private static int loadedGlobal = 0;
|
private static int loadedGlobal = 0;
|
||||||
private static FakeImage elytraImage;
|
private static FakeImage elytraImage;
|
||||||
|
|
||||||
@@ -36,8 +38,13 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
|||||||
private int loaded = 0;
|
private int loaded = 0;
|
||||||
private double ratioX = -1;
|
private double ratioX = -1;
|
||||||
private double ratioY = -1;
|
private double ratioY = -1;
|
||||||
|
private final ResourceLocation location;
|
||||||
private String type = null;
|
private String type = null;
|
||||||
|
|
||||||
|
public FakeCapeBuffer(ResourceLocation location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FakeImage parseUserSkin(FakeImage image) {
|
public FakeImage parseUserSkin(FakeImage image) {
|
||||||
if (image == null) return null;
|
if (image == null) return null;
|
||||||
@@ -67,6 +74,9 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
|||||||
if ("cape".equals(this.type)) {
|
if ("cape".equals(this.type)) {
|
||||||
this.image = resetImageFormat(this.image, 0, 0, 22, 17);
|
this.image = resetImageFormat(this.image, 0, 0, 22, 17);
|
||||||
this.attachElytra(elytraImage);
|
this.attachElytra(elytraImage);
|
||||||
|
if (this.image instanceof FakeBufferedImage) { // before 1.12.2
|
||||||
|
this.refreshTexture((FakeBufferedImage) this.image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.image;
|
return this.image;
|
||||||
@@ -146,6 +156,16 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
|||||||
return defaultReturnValue;
|
return defaultReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TextureID won't be regenerated when changing resource packs before 1.12.2
|
||||||
|
private void refreshTexture(FakeBufferedImage image) {
|
||||||
|
Object textureObj = MinecraftUtil.getTextureManager().getTexture(this.location);
|
||||||
|
if (textureObj != null) {
|
||||||
|
// NOTICE: OptiFine modified the upload process of the texture from ThreadDownloadImageData
|
||||||
|
// Therefore, it may not be correct to simply copy the vanilla behavior
|
||||||
|
FakeInterfaceManager.ThreadDownloadImageData_resetNewBufferedImage(textureObj, image.getImage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Some cape image doesn't support alpha channel, so reset image format to ARGB
|
// Some cape image doesn't support alpha channel, so reset image format to ARGB
|
||||||
private static FakeImage resetImageFormat(FakeImage image, int startX, int startY, int endX, int endY) {
|
private static FakeImage resetImageFormat(FakeImage image, int startX, int startY, int endX, int endY) {
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
File renamed without changes.
@@ -0,0 +1,45 @@
|
|||||||
|
package customskinloader.fake;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
import customskinloader.utils.HttpTextureUtil;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
|
||||||
|
private HttpTextureUtil.HttpTextureInfo info;
|
||||||
|
private ResourceLocation resourceLocation;
|
||||||
|
|
||||||
|
public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) {
|
||||||
|
super(url, metadata);
|
||||||
|
this.info = HttpTextureUtil.toHttpTextureInfo(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceLocation(ResourceLocation resourceLocation) {
|
||||||
|
this.resourceLocation = resourceLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceLocation getResourceLocation() {
|
||||||
|
return this.resourceLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUrl() {
|
||||||
|
return this.info.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRawUrl() {
|
||||||
|
return super.getUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHash() {
|
||||||
|
return this.info.hash == null ? super.getHash() : this.info.hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getCacheFile() {
|
||||||
|
return this.info.cacheFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,179 @@
|
|||||||
|
package customskinloader.fake;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||||
|
import customskinloader.CustomSkinLoader;
|
||||||
|
import customskinloader.utils.HttpTextureUtil;
|
||||||
|
import customskinloader.utils.MinecraftUtil;
|
||||||
|
import net.minecraft.client.renderer.IImageBuffer;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.resources.SkinManager;
|
||||||
|
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class FakeSkinManager {
|
||||||
|
private final TextureManager textureManager;
|
||||||
|
|
||||||
|
private final Map<ResourceLocation, MinecraftProfileTexture> modelCache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public FakeSkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) {
|
||||||
|
this.textureManager = textureManagerInstance;
|
||||||
|
HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
|
||||||
|
*/
|
||||||
|
public static ResourceLocation setResourceLocation(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
|
||||||
|
if (profileTexture instanceof FakeMinecraftProfileTexture) {
|
||||||
|
((FakeMinecraftProfileTexture) profileTexture).setResourceLocation(resourceLocation);
|
||||||
|
}
|
||||||
|
return resourceLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
|
||||||
|
* <p>
|
||||||
|
* {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);} -> {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, this.fakeManager.getModelCache(profileTexture, resourcelocation));}
|
||||||
|
* <p>
|
||||||
|
*/
|
||||||
|
public static MinecraftProfileTexture getModelCache(MinecraftProfileTexture profileTexture, FakeSkinManager fakeManager, ResourceLocation location) {
|
||||||
|
return fakeManager.modelCache.getOrDefault(location, profileTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
|
||||||
|
*/
|
||||||
|
public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, FakeSkinManager fakeManager, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
|
||||||
|
Object[] params = list.toArray();
|
||||||
|
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) {
|
||||||
|
FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
|
||||||
|
ResourceLocation resourcelocation = fakeProfileTexture.getResourceLocation();
|
||||||
|
if (fakeProfileTexture.getResourceLocation() != null) {
|
||||||
|
params[0] = fakeProfileTexture.getCacheFile();
|
||||||
|
if (params[params.length - 2] instanceof Boolean) {
|
||||||
|
params[params.length - 2] = true;
|
||||||
|
}
|
||||||
|
params[params.length - 1] = fakeManager.new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, fakeProfileTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private final static String KEY = "CustomSkinLoaderInfo";
|
||||||
|
/**
|
||||||
|
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinAvailableCallback, boolean)}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public static void loadProfileTextures(Runnable runnable, GameProfile profile) {
|
||||||
|
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, m -> {
|
||||||
|
// This is a hack.
|
||||||
|
((Multimap) profile.getProperties()).put(KEY, m);
|
||||||
|
runnable.run();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked from {@link SkinManager#lambda$loadProfileTextures$1(GameProfile, boolean, SkinAvailableCallback)}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
|
||||||
|
// This is a hack.
|
||||||
|
return (Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>) ((Optional) profile.getProperties().removeAll(KEY).stream().findFirst()).orElse(Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked from {@link SkinManager#lambda$null$0(Map, 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++) {
|
||||||
|
MinecraftProfileTexture.Type type = MinecraftProfileTexture.Type.values()[i];
|
||||||
|
if (map.containsKey(type)) {
|
||||||
|
skinManager.loadSkin(map.get(type), type, skinAvailableCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
|
||||||
|
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = CustomSkinLoader.loadProfileFromCache(profile);
|
||||||
|
for (Iterator<Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||||
|
Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture> entry = it.next();
|
||||||
|
MinecraftProfileTexture texture = entry.getValue();
|
||||||
|
if (shouldJudgeType(texture)) {
|
||||||
|
texture = this.modelCache.get(MinecraftUtil.getSkinManager().loadSkin(texture, entry.getKey()));
|
||||||
|
if (texture == null) { // remove texture if was not loaded before
|
||||||
|
it.remove();
|
||||||
|
} else {
|
||||||
|
map.put(entry.getKey(), texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void makeCallback(SkinManager.SkinAvailableCallback callback, MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture texture) {
|
||||||
|
if (callback != null)
|
||||||
|
callback.skinAvailable(type, location, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean shouldJudgeType(MinecraftProfileTexture texture) {
|
||||||
|
return texture != null && "auto".equals(texture.getMetadata("model"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class BaseBuffer implements IImageBuffer {
|
||||||
|
private IImageBuffer buffer;
|
||||||
|
|
||||||
|
private SkinManager.SkinAvailableCallback callback;
|
||||||
|
private MinecraftProfileTexture.Type type;
|
||||||
|
private ResourceLocation location;
|
||||||
|
private FakeMinecraftProfileTexture texture;
|
||||||
|
|
||||||
|
public BaseBuffer(SkinManager.SkinAvailableCallback callback, MinecraftProfileTexture.Type type, ResourceLocation location, FakeMinecraftProfileTexture texture) {
|
||||||
|
switch (type) {
|
||||||
|
case SKIN: this.buffer = new FakeSkinBuffer(); break;
|
||||||
|
case CAPE: this.buffer = new FakeCapeBuffer(location); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.callback = callback;
|
||||||
|
this.type = type;
|
||||||
|
this.location = location;
|
||||||
|
this.texture = texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public net.minecraft.client.renderer.texture.NativeImage func_195786_a(net.minecraft.client.renderer.texture.NativeImage image) {
|
||||||
|
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).func_195786_a(image) : image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BufferedImage parseUserSkin(BufferedImage image) {
|
||||||
|
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).parseUserSkin(image) : image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skinAvailable() {
|
||||||
|
if (buffer != null) {
|
||||||
|
buffer.skinAvailable();
|
||||||
|
if (shouldJudgeType(texture) && buffer instanceof FakeSkinBuffer) {
|
||||||
|
//Auto judge skin type
|
||||||
|
Map<String, String> metadata = Maps.newHashMap();
|
||||||
|
String type = ((FakeSkinBuffer) buffer).judgeType();
|
||||||
|
metadata.put("model", type);
|
||||||
|
texture = new FakeMinecraftProfileTexture(texture.getRawUrl(), metadata);
|
||||||
|
FakeSkinManager.this.modelCache.put(location, texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FakeSkinManager.makeCallback(callback, type, location, texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-17
@@ -1,11 +1,11 @@
|
|||||||
package customskinloader.fake.itf;
|
package customskinloader.fake.itf;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import net.minecraft.client.Minecraft;
|
||||||
import com.mojang.authlib.properties.Property;
|
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@@ -19,23 +19,11 @@ public class FakeInterfaceManager {
|
|||||||
return ((IFakeIResourceManager) resourceManager).getResource(location);
|
return ((IFakeIResourceManager) resourceManager).getResource(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IResourceManager Minecraft_getResourceManager(Object minecraft) {
|
public static IResourceManager Minecraft_getResourceManager(Minecraft 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) {
|
public static void ThreadDownloadImageData_resetNewBufferedImage(Object threadDownloadImageData, BufferedImage image) {
|
||||||
return ((IFakeNativeImage) nativeImage).getPixel(x, y);
|
((IFakeThreadDownloadImageData) threadDownloadImageData).resetNewBufferedImage(image);
|
||||||
}
|
|
||||||
|
|
||||||
public static void NativeImage_setPixel(Object nativeImage, int x, int y, int color) {
|
|
||||||
((IFakeNativeImage) nativeImage).setPixel(x, y, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) {
|
|
||||||
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Property SkinManagerCacheKey_packedTextures(Object skinManagerCacheKey) {
|
|
||||||
return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).packedTextures();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -4,7 +4,7 @@ import java.io.InputStream;
|
|||||||
|
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
|
|
||||||
/** {@link IResource} is no longer an interface since 22w14a */
|
/** {@link net.minecraft.client.resources.IResource} is no longer an interface since 22w14a */
|
||||||
public interface IFakeIResource {
|
public interface IFakeIResource {
|
||||||
// 1.13.2 ~ 22w13a
|
// 1.13.2 ~ 22w13a
|
||||||
interface V1 {
|
interface V1 {
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,12 @@
|
|||||||
|
package customskinloader.fake.itf;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
// This interface is only available before 1.12.2
|
||||||
|
public interface IFakeThreadDownloadImageData {
|
||||||
|
/**
|
||||||
|
* Reset {@link net.minecraft.client.renderer.ThreadDownloadImageData#bufferedImage} and
|
||||||
|
* {@link net.minecraft.client.renderer.ThreadDownloadImageData#textureUploaded} to false to refresh texture.
|
||||||
|
*/
|
||||||
|
void resetNewBufferedImage(BufferedImage image);
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
+2
-3
@@ -2,7 +2,6 @@ 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 {
|
||||||
@@ -37,11 +36,11 @@ public class FakeNativeImage implements FakeImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getRGBA(int x, int y) {
|
public int getRGBA(int x, int y) {
|
||||||
return FakeInterfaceManager.NativeImage_getPixel(image, x, y);
|
return image.func_195709_a(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRGBA(int x, int y, int rgba) {
|
public void setRGBA(int x, int y, int rgba) {
|
||||||
FakeInterfaceManager.NativeImage_setPixel(image, x, y, rgba);
|
image.func_195700_a(x, y, rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyImageData(FakeImage image) {
|
public void copyImageData(FakeImage image) {
|
||||||
File renamed without changes.
File renamed without changes.
+27
-16
@@ -25,7 +25,6 @@ import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
|||||||
import customskinloader.profile.ModelManager0;
|
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 org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -109,22 +108,27 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
|||||||
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) {
|
||||||
return gameProfileCache.computeIfAbsent(apiRoot + " " + username, ignored -> loadGameProfile(apiRoot, username));
|
return gameProfileCache.computeIfAbsent(apiRoot + " " + username,
|
||||||
|
ignored -> loadGameProfile(apiRoot, username));
|
||||||
}
|
}
|
||||||
|
|
||||||
//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://wiki.vg/Mojang_API#Playernames_-.3E_UUIDs)
|
||||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft").setCacheTime(600).setPayload(GSON.toJson(Collections.singletonList(username))));
|
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||||
|
|
||||||
|
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(
|
||||||
|
new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft")
|
||||||
|
.setCacheTime(600).setPayload(gson.toJson(Collections.singletonList(username)))
|
||||||
|
);
|
||||||
if (StringUtils.isEmpty(responce.content)) {
|
if (StringUtils.isEmpty(responce.content)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameProfile[] profiles = GSON.fromJson(responce.content, GameProfile[].class);
|
GameProfile[] profiles = gson.fromJson(responce.content, GameProfile[].class);
|
||||||
if (profiles.length == 0) {
|
if (profiles.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -149,20 +153,26 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
UUID id = profile.getId();
|
UUID id = profile.getId();
|
||||||
return standard ? id.toString() : TextureUtil.fromUUID(id);
|
return standard ? id.toString() : UUIDTypeAdapter.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 (http://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape)
|
||||||
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/"
|
||||||
|
+ UUIDTypeAdapter.fromUUID(profile.getId())).setCacheTime(90));
|
||||||
if (StringUtils.isEmpty(responce.content)) {
|
if (StringUtils.isEmpty(responce.content)) {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
MinecraftProfilePropertiesResponse propertiesResponce = GSON.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
|
Gson gson = new GsonBuilder()
|
||||||
GameProfile newGameProfile = new GameProfile(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(propertiesResponce), TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME.get(propertiesResponce));
|
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
||||||
newGameProfile.getProperties().putAll(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES.get(propertiesResponce));
|
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer())
|
||||||
|
.create();
|
||||||
|
MinecraftProfilePropertiesResponse propertiesResponce = gson.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
|
||||||
|
GameProfile newGameProfile = new GameProfile(propertiesResponce.getId(), propertiesResponce.getName());
|
||||||
|
newGameProfile.getProperties().putAll(propertiesResponce.getProperties());
|
||||||
|
|
||||||
return newGameProfile;
|
return newGameProfile;
|
||||||
}
|
}
|
||||||
@@ -175,22 +185,23 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
|||||||
if (textureProperty == null) {
|
if (textureProperty == null) {
|
||||||
return Maps.newHashMap();
|
return Maps.newHashMap();
|
||||||
}
|
}
|
||||||
String value = TextureUtil.AuthlibField.PROPERTY_VALUE.get(textureProperty);
|
String value = textureProperty.getValue();
|
||||||
if (StringUtils.isBlank(value)) {
|
if (StringUtils.isBlank(value)) {
|
||||||
return Maps.newHashMap();
|
return Maps.newHashMap();
|
||||||
}
|
}
|
||||||
String json = new String(Base64.decodeBase64(value), StandardCharsets.UTF_8);
|
String json = new String(Base64.decodeBase64(value), StandardCharsets.UTF_8);
|
||||||
MinecraftTexturesPayload result = GSON.fromJson(json, MinecraftTexturesPayload.class);
|
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||||
|
MinecraftTexturesPayload result = gson.fromJson(json, MinecraftTexturesPayload.class);
|
||||||
if (result == null || TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result) == null) {
|
if (result == null || result.getTextures() == null) {
|
||||||
return Maps.newHashMap();
|
return Maps.newHashMap();
|
||||||
}
|
}
|
||||||
return TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
|
return result.getTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
||||||
return (!StringUtils.isNoneEmpty(ssp0.apiRoot) || ssp0.apiRoot.equalsIgnoreCase(ssp1.apiRoot)) || (!StringUtils.isNoneEmpty(ssp0.sessionRoot) || ssp0.sessionRoot.equalsIgnoreCase(ssp1.sessionRoot));
|
return (!StringUtils.isNoneEmpty(ssp0.apiRoot) || ssp0.apiRoot.equalsIgnoreCase(ssp1.apiRoot)) ||
|
||||||
|
(!StringUtils.isNoneEmpty(ssp0.sessionRoot) || ssp0.sessionRoot.equalsIgnoreCase(ssp1.sessionRoot));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+7
-1
@@ -3,6 +3,7 @@ package customskinloader.loader.jsonapi;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import customskinloader.config.SkinSiteProfile;
|
||||||
import customskinloader.loader.JsonAPILoader;
|
import customskinloader.loader.JsonAPILoader;
|
||||||
import customskinloader.loader.MojangAPILoader;
|
import customskinloader.loader.MojangAPILoader;
|
||||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||||
@@ -30,7 +31,7 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRoot() {
|
public String getRoot() {
|
||||||
return "https://api.minecraftcapes.net/profile/";
|
return "https://minecraftcapes.net/profile/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +64,11 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
|||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPayload(SkinSiteProfile ssp) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "MinecraftCapesAPI";
|
return "MinecraftCapesAPI";
|
||||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -29,7 +29,7 @@ public class LogManager {
|
|||||||
}
|
}
|
||||||
//Set new writer
|
//Set new writer
|
||||||
Files.createDirectories(logFile.getParent());
|
Files.createDirectories(logFile.getParent());
|
||||||
logWriter = Files.newBufferedWriter(logFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
logWriter = Files.newBufferedWriter(logFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE);
|
||||||
loggers.forEach((k, v) -> v.setWriter(logWriter));
|
loggers.forEach((k, v) -> v.setWriter(logWriter));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,160 @@
|
|||||||
|
package customskinloader.profile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.apache.commons.codec.Charsets;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
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.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
|
import com.mojang.util.UUIDTypeAdapter;
|
||||||
|
|
||||||
|
import customskinloader.CustomSkinLoader;
|
||||||
|
import customskinloader.utils.HttpRequestUtil;
|
||||||
|
import customskinloader.utils.HttpRequestUtil.HttpRequest;
|
||||||
|
import customskinloader.utils.HttpRequestUtil.HttpResponce;
|
||||||
|
import customskinloader.utils.HttpTextureUtil;
|
||||||
|
import customskinloader.utils.HttpUtil0;
|
||||||
|
|
||||||
|
public class DynamicSkullManager {
|
||||||
|
public static class SkullTexture{
|
||||||
|
public Map<Type,MinecraftProfileTexture> textures;
|
||||||
|
public String index;//Index File
|
||||||
|
public ArrayList<String> skins;
|
||||||
|
public int interval;
|
||||||
|
public boolean fromZero;
|
||||||
|
//For program
|
||||||
|
public long startTime;
|
||||||
|
public int period;
|
||||||
|
}
|
||||||
|
private Map<GameProfile, SkullTexture> dynamicTextures = new ConcurrentHashMap<>();
|
||||||
|
private Map<GameProfile, Map<Type, MinecraftProfileTexture>> staticTextures = new ConcurrentHashMap<>();
|
||||||
|
private List<GameProfile> loadingList=new ArrayList<GameProfile>();
|
||||||
|
|
||||||
|
private void parseGameProfile(GameProfile profile){
|
||||||
|
Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null);
|
||||||
|
if (textureProperty==null){
|
||||||
|
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String value=textureProperty.getValue();
|
||||||
|
if(StringUtils.isBlank(value)){
|
||||||
|
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@SuppressWarnings("deprecation") String json = new String(Base64.decodeBase64(value), Charsets.UTF_8);
|
||||||
|
Gson gson=new GsonBuilder().registerTypeAdapter(UUID.class,new UUIDTypeAdapter()).create();
|
||||||
|
SkullTexture result=gson.fromJson(json,SkullTexture.class);
|
||||||
|
if(result==null){
|
||||||
|
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
staticTextures.put(profile, (result.textures==null || !result.textures.containsKey(Type.SKIN)) ?
|
||||||
|
Maps.<Type, MinecraftProfileTexture>newHashMap() : parseTextures(result.textures));
|
||||||
|
|
||||||
|
if(StringUtils.isNotEmpty(result.index)){
|
||||||
|
File indexFile=new File(CustomSkinLoader.DATA_DIR,result.index);
|
||||||
|
try{
|
||||||
|
String index=FileUtils.readFileToString(indexFile, "UTF-8");
|
||||||
|
if(StringUtils.isNotEmpty(index)){
|
||||||
|
String[] skins = CustomSkinLoader.GSON.fromJson(index, String[].class);
|
||||||
|
if(skins != null && skins.length != 0)
|
||||||
|
result.skins = Lists.newArrayList(skins);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
CustomSkinLoader.logger.warning("Exception occurs while parsing index file: "+e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!CustomSkinLoader.config.enableDynamicSkull||result.skins==null||result.skins.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CustomSkinLoader.logger.info("Try to load Dynamic Skull: "+json);
|
||||||
|
|
||||||
|
for(int i=0;i<result.skins.size();i++){//check and cache skins
|
||||||
|
String skin=result.skins.get(i);
|
||||||
|
if(HttpUtil0.isLocal(skin)){
|
||||||
|
//Local Skin
|
||||||
|
File skinFile=new File(CustomSkinLoader.DATA_DIR,skin);
|
||||||
|
if(skinFile.isFile()&&skinFile.length()>0){
|
||||||
|
//Skin found
|
||||||
|
String fakeUrl=HttpTextureUtil.getLocalFakeUrl(skin);
|
||||||
|
result.skins.set(i, fakeUrl);
|
||||||
|
}else{
|
||||||
|
//Could not find skin
|
||||||
|
result.skins.remove(i--);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//Online Skin
|
||||||
|
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(skin).setCacheFile(HttpTextureUtil.getCacheFile(FilenameUtils.getBaseName(skin))).setCacheTime(0).setLoadContent(false));
|
||||||
|
if(!responce.success){
|
||||||
|
//Could not load skin
|
||||||
|
result.skins.remove(i--);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result.skins.isEmpty()){//Nothing loaded
|
||||||
|
CustomSkinLoader.logger.info("Failed: Nothing loaded.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
result.interval=Math.max(result.interval, 50);
|
||||||
|
if(result.fromZero)
|
||||||
|
result.startTime=System.currentTimeMillis();
|
||||||
|
result.period=result.interval*result.skins.size();
|
||||||
|
CustomSkinLoader.logger.info("Successfully loaded Dynamic Skull: "+new Gson().toJson(result));
|
||||||
|
dynamicTextures.put(profile, result);
|
||||||
|
staticTextures.remove(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Support local skin for skull
|
||||||
|
public Map<Type, MinecraftProfileTexture> parseTextures(Map<Type, MinecraftProfileTexture> textures) {
|
||||||
|
MinecraftProfileTexture skin=textures.get(Type.SKIN);
|
||||||
|
String skinUrl=skin.getUrl();
|
||||||
|
if(!HttpUtil0.isLocal(skinUrl))
|
||||||
|
return textures;
|
||||||
|
File skinFile=new File(CustomSkinLoader.DATA_DIR,skinUrl);
|
||||||
|
if(!skinFile.isFile())
|
||||||
|
return Maps.newHashMap();
|
||||||
|
textures.put(Type.SKIN, ModelManager0.getProfileTexture(HttpTextureUtil.getLocalFakeUrl(skinUrl), null));
|
||||||
|
return textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Type,MinecraftProfileTexture> getTexture(final GameProfile profile){
|
||||||
|
if(staticTextures.get(profile)!=null)
|
||||||
|
return staticTextures.get(profile);
|
||||||
|
if(loadingList.contains(profile))
|
||||||
|
return Maps.newHashMap();
|
||||||
|
if(dynamicTextures.containsKey(profile)){
|
||||||
|
SkullTexture texture=dynamicTextures.get(profile);
|
||||||
|
long time=System.currentTimeMillis()-texture.startTime;
|
||||||
|
int index=(int)Math.floor((time%texture.period)/texture.interval);
|
||||||
|
Map<Type,MinecraftProfileTexture> map=Maps.newHashMap();
|
||||||
|
map.put(Type.SKIN, ModelManager0.getProfileTexture(texture.skins.get(index), null));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadingList.add(profile);
|
||||||
|
Thread loadThread=new Thread(){
|
||||||
|
public void run(){
|
||||||
|
parseGameProfile(profile);//Load in thread
|
||||||
|
loadingList.remove(profile);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
loadThread.setName("Skull "+profile.hashCode());
|
||||||
|
loadThread.start();
|
||||||
|
return Maps.newHashMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
+9
-7
@@ -3,10 +3,12 @@ package customskinloader.profile;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||||
import java.util.function.Function;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import customskinloader.CustomSkinLoader;
|
import customskinloader.CustomSkinLoader;
|
||||||
import customskinloader.utils.TimeUtil;
|
import customskinloader.utils.TimeUtil;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
@@ -16,7 +18,7 @@ public class ProfileCache {
|
|||||||
|
|
||||||
private Map<String, CachedProfile> cachedProfiles = new ConcurrentHashMap<>();
|
private Map<String, CachedProfile> cachedProfiles = new ConcurrentHashMap<>();
|
||||||
private Map<String, UserProfile> localProfiles = new ConcurrentHashMap<>();
|
private Map<String, UserProfile> localProfiles = new ConcurrentHashMap<>();
|
||||||
private Map<String, Deque<Function<UserProfile, ?>>> profileLoaders = new ConcurrentHashMap<>();
|
private Map<String, Deque<Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>>> profileLoaders = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public ProfileCache(){
|
public ProfileCache(){
|
||||||
@@ -51,12 +53,12 @@ public class ProfileCache {
|
|||||||
return localProfiles.get(username.toLowerCase());
|
return localProfiles.get(username.toLowerCase());
|
||||||
return loadLocalProfile(username);
|
return loadLocalProfile(username);
|
||||||
}
|
}
|
||||||
public Function<UserProfile, ?> getLastLoader(String username) {
|
public Optional<Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>> getLastLoader(String username) {
|
||||||
Deque<Function<UserProfile, ?>> deque = this.profileLoaders.get(username);
|
Deque<Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>> deque = this.profileLoaders.get(username);
|
||||||
if (deque != null) {
|
if (deque != null) {
|
||||||
return deque.pollLast();
|
return Optional.ofNullable(deque.pollLast());
|
||||||
}
|
}
|
||||||
return null;
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoading(String username,boolean loading){
|
public void setLoading(String username,boolean loading){
|
||||||
@@ -73,7 +75,7 @@ public class ProfileCache {
|
|||||||
return;
|
return;
|
||||||
saveLocalProfile(username,profile);
|
saveLocalProfile(username,profile);
|
||||||
}
|
}
|
||||||
public void putLoader(String username, Function<UserProfile, ?> loader) {
|
public void putLoader(String username, Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> loader) {
|
||||||
this.profileLoaders.putIfAbsent(username, new ConcurrentLinkedDeque<>());
|
this.profileLoaders.putIfAbsent(username, new ConcurrentLinkedDeque<>());
|
||||||
this.profileLoaders.get(username).offerLast(loader);
|
this.profileLoaders.get(username).offerLast(loader);
|
||||||
}
|
}
|
||||||
-34
@@ -1,11 +1,5 @@
|
|||||||
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;
|
import customskinloader.profile.ModelManager0.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)
|
||||||
File renamed without changes.
File renamed without changes.
+34
@@ -4,7 +4,14 @@ import java.io.IOException;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -13,6 +20,33 @@ public class HttpUtil0 {
|
|||||||
return url != null && !url.startsWith("http://") && !url.startsWith("https://");
|
return url != null && !url.startsWith("http://") && !url.startsWith("https://");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//From: http://blog.csdn.net/xiyushiyi/article/details/46685387
|
||||||
|
public static void ignoreHttpsCertificate(){
|
||||||
|
HostnameVerifier doNotVerify = new HostnameVerifier() {
|
||||||
|
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new X509Certificate[] {};
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType){}
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType){}
|
||||||
|
}};
|
||||||
|
|
||||||
|
try {
|
||||||
|
SSLContext sc = SSLContext.getInstance("TLS");
|
||||||
|
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||||
|
//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||||
|
HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryFacade());
|
||||||
|
HttpsURLConnection.setDefaultHostnameVerifier(doNotVerify);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String parseAddress(String address) {
|
public static String parseAddress(String address) {
|
||||||
if(StringUtils.isEmpty(address))
|
if(StringUtils.isEmpty(address))
|
||||||
return null;
|
return null;
|
||||||
File renamed without changes.
+3
-2
@@ -40,7 +40,7 @@ public class MinecraftUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//version.json can be found in 1.14+
|
//version.json can be found in 1.14+
|
||||||
URL versionFile = ClassLoader.getSystemClassLoader().getResource("version.json");
|
URL versionFile = MinecraftUtil.class.getResource("/version.json");
|
||||||
if (versionFile != null) {
|
if (versionFile != null) {
|
||||||
try (
|
try (
|
||||||
InputStream is = versionFile.openStream();
|
InputStream is = versionFile.openStream();
|
||||||
@@ -85,6 +85,7 @@ public class MinecraftUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getCredential(GameProfile profile) {
|
public static String getCredential(GameProfile profile) {
|
||||||
return profile == null ? null : String.format("%s-%s", profile.getName(), profile.getId());
|
return (profile == null || profile.hashCode() == 0) ? null :
|
||||||
|
(profile.getId() == null ? profile.getName() : String.format("%s-%s", profile.getName(), profile.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package customskinloader.utils;
|
||||||
|
|
||||||
|
import customskinloader.CustomSkinLoader;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class TextureUtil {
|
||||||
|
/**
|
||||||
|
* Save and get fake url of base64 texture
|
||||||
|
*
|
||||||
|
* @param base64 texture in base64 string
|
||||||
|
* @return base64 fake url
|
||||||
|
* @since 14.16
|
||||||
|
*/
|
||||||
|
public static String parseBase64Texture(String base64) {
|
||||||
|
byte[] capeBytes = Base64.decodeBase64(base64);
|
||||||
|
String hash = HttpTextureUtil.getHash(capeBytes);
|
||||||
|
File cacheFile = HttpTextureUtil.getCacheFile(hash);
|
||||||
|
String fakeUrl = HttpTextureUtil.getBase64FakeUrl(hash);
|
||||||
|
|
||||||
|
//Save base64 image to cache file
|
||||||
|
try {
|
||||||
|
FileUtils.writeByteArrayToFile(cacheFile, capeBytes);
|
||||||
|
CustomSkinLoader.logger.info("Saved base64 image to " + cacheFile);
|
||||||
|
return fakeUrl;
|
||||||
|
} catch (Exception e) {
|
||||||
|
CustomSkinLoader.logger.warning("Error parsing base64 image: " + base64);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
+6
-2
@@ -2,13 +2,17 @@ package net.minecraft.client.renderer;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import customskinloader.fake.itf.IFakeIImageBuffer;
|
|
||||||
import net.minecraft.client.renderer.texture.NativeImage;
|
import net.minecraft.client.renderer.texture.NativeImage;
|
||||||
|
|
||||||
public interface IImageBuffer extends IFakeIImageBuffer {
|
public interface IImageBuffer extends Runnable {
|
||||||
BufferedImage parseUserSkin(BufferedImage image);
|
BufferedImage parseUserSkin(BufferedImage image);
|
||||||
|
|
||||||
NativeImage func_195786_a(NativeImage image);
|
NativeImage func_195786_a(NativeImage image);
|
||||||
|
|
||||||
void skinAvailable();
|
void skinAvailable();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void run() {
|
||||||
|
this.skinAvailable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +0,0 @@
|
|||||||
package com.mojang.authlib;
|
|
||||||
|
|
||||||
public enum SignatureState {
|
|
||||||
UNSIGNED,
|
|
||||||
INVALID,
|
|
||||||
SIGNED
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.mojang.authlib.minecraft;
|
|
||||||
|
|
||||||
import com.mojang.authlib.SignatureState;
|
|
||||||
|
|
||||||
public class MinecraftProfileTextures {
|
|
||||||
public MinecraftProfileTextures(MinecraftProfileTexture skin, MinecraftProfileTexture cape, MinecraftProfileTexture elytra, SignatureState signatureState) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package customskinloader.fake;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
import customskinloader.utils.HttpTextureUtil;
|
|
||||||
|
|
||||||
public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
|
|
||||||
private final static Map<String, String> MODEL_CACHE = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
private final HttpTextureUtil.HttpTextureInfo info;
|
|
||||||
private final Map<String, String> metadata;
|
|
||||||
|
|
||||||
public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) {
|
|
||||||
super(url, metadata);
|
|
||||||
this.info = HttpTextureUtil.toHttpTextureInfo(url);
|
|
||||||
this.metadata = metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUrl() {
|
|
||||||
return this.info.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMetadata(final String key) {
|
|
||||||
String value = super.getMetadata(key);
|
|
||||||
if ("model".equals(key) && "auto".equals(value)) {
|
|
||||||
String model = MODEL_CACHE.get(this.getHash());
|
|
||||||
if (model != null) {
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setModel(String model) {
|
|
||||||
if (this.metadata != null) {
|
|
||||||
MODEL_CACHE.put(this.getHash(), model);
|
|
||||||
this.metadata.put("model", model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHash() {
|
|
||||||
return this.info.hash == null ? super.getHash() : this.info.hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getCacheFile() {
|
|
||||||
return this.info.cacheFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,242 +0,0 @@
|
|||||||
package customskinloader.fake;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Map;
|
|
||||||
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.mojang.authlib.GameProfile;
|
|
||||||
import com.mojang.authlib.SignatureState;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTextures;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
|
||||||
import com.mojang.authlib.properties.Property;
|
|
||||||
import customskinloader.CustomSkinLoader;
|
|
||||||
import customskinloader.fake.itf.FakeInterfaceManager;
|
|
||||||
import customskinloader.loader.MojangAPILoader;
|
|
||||||
import customskinloader.profile.ModelManager0;
|
|
||||||
import customskinloader.profile.UserProfile;
|
|
||||||
import customskinloader.utils.HttpTextureUtil;
|
|
||||||
import customskinloader.utils.TextureUtil;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.IImageBuffer;
|
|
||||||
import net.minecraft.client.renderer.texture.NativeImage;
|
|
||||||
import net.minecraft.client.resources.SkinManager;
|
|
||||||
|
|
||||||
public class FakeSkinManager {
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, File, MinecraftSessionService)}
|
|
||||||
*/
|
|
||||||
public static void setSkinCacheDir(File skinCacheDirectory) {
|
|
||||||
HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)}
|
|
||||||
*/
|
|
||||||
public static void setSkinCacheDir(Path skinCacheDirectory) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
|
|
||||||
*/
|
|
||||||
public static Property createProperty(Property property) {
|
|
||||||
return property == null ? new Property(null, null) : new Property(TextureUtil.AuthlibField.PROPERTY_NAME.get(property), TextureUtil.AuthlibField.PROPERTY_VALUE.get(property), TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
|
|
||||||
*/
|
|
||||||
public static Object loadCache(LoadingCache<?, ?> loadingCache, Object cacheKey, GameProfile profile) throws Exception {
|
|
||||||
return cacheLoader.load(FakeCacheKey.wrapCacheKey(cacheKey, profile));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
|
|
||||||
*/
|
|
||||||
public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) {
|
|
||||||
Object[] params = list.toArray();
|
|
||||||
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) {
|
|
||||||
FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
|
|
||||||
params[0] = fakeProfileTexture.getCacheFile();
|
|
||||||
if (params[params.length - 2] instanceof Boolean) {
|
|
||||||
params[params.length - 2] = true;
|
|
||||||
}
|
|
||||||
params[params.length - 1] = new BaseBuffer((Runnable) params[params.length - 1], textureType, fakeProfileTexture);
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private final static String KEY = "CustomSkinLoaderInfo";
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager.SkinAvailableCallback, boolean)}
|
|
||||||
*/
|
|
||||||
public static void loadProfileTextures(Runnable runnable, GameProfile profile) {
|
|
||||||
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, p -> {
|
|
||||||
profile.getProperties().putAll(KEY, p.toProperties());
|
|
||||||
runnable.run();
|
|
||||||
return null;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 23w31a+
|
|
||||||
* Invoked from net.minecraft.client.resources.SkinManager$1#load(net.minecraft.client.resources.SkinManager$CacheKey)
|
|
||||||
*/
|
|
||||||
public static Object[] loadProfileTextures(ImmutableList<Object> list, Object cacheKey) {
|
|
||||||
Object[] params = list.toArray();
|
|
||||||
GameProfile profile = FakeCacheKey.unwrapCacheKey(cacheKey);
|
|
||||||
if (!profile.getProperties().containsKey(SKULL_KEY)) {
|
|
||||||
final Supplier<?> supplier = (Supplier<?>) params[0];
|
|
||||||
params[0] = (Supplier<?>) () -> CustomSkinLoader.loadProfileLazily(profile, 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)}
|
|
||||||
*/
|
|
||||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
|
|
||||||
return ModelManager0.fromUserProfile(UserProfile.fromProperties(profile.getProperties().values()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked from {@link SkinManager#lambda$null$0(Map, 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++) {
|
|
||||||
MinecraftProfileTexture.Type type = MinecraftProfileTexture.Type.values()[i];
|
|
||||||
if (map.containsKey(type)) {
|
|
||||||
skinManager.loadSkin(map.get(type), type, skinAvailableCallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final static String SKULL_KEY = "CSL$IsSkull";
|
|
||||||
/**
|
|
||||||
* 23w31a+
|
|
||||||
* Invoked from {@link SkinManager#getInsecureSkin(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) {
|
|
||||||
return CustomSkinLoader.loadProfileFromCache(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 23w31a ~ 23w41a
|
|
||||||
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(GameProfile)
|
|
||||||
*/
|
|
||||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
|
|
||||||
if (profile.getProperties().containsKey(SKULL_KEY)) {
|
|
||||||
profile.getProperties().removeAll(SKULL_KEY);
|
|
||||||
return CustomSkinLoader.loadProfileFromCache(profile);
|
|
||||||
} else {
|
|
||||||
return getUserProfile(sessionService, profile, requireSecure);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 23w42a+
|
|
||||||
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(SkinManager.CacheKey, MinecraftSessionService)
|
|
||||||
*/
|
|
||||||
public static Object loadSkinFromCache(MinecraftSessionService sessionService, Property property) {
|
|
||||||
return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, FakeCacheKey.unwrapProperty(property), false));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean shouldJudgeType(MinecraftProfileTexture texture) {
|
|
||||||
return texture != null && "auto".equals(texture.getMetadata("model"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class BaseBuffer implements IImageBuffer {
|
|
||||||
private IImageBuffer buffer;
|
|
||||||
|
|
||||||
private final Runnable callback;
|
|
||||||
private final FakeMinecraftProfileTexture texture;
|
|
||||||
|
|
||||||
public BaseBuffer(Runnable callback, MinecraftProfileTexture.Type type, FakeMinecraftProfileTexture texture) {
|
|
||||||
this.callback = callback;
|
|
||||||
this.texture = texture;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case SKIN: this.buffer = new FakeSkinBuffer(); break;
|
|
||||||
case CAPE: this.buffer = new FakeCapeBuffer(); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NativeImage func_195786_a(NativeImage image) {
|
|
||||||
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).func_195786_a(image) : image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedImage parseUserSkin(BufferedImage image) {
|
|
||||||
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).parseUserSkin(image) : image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void skinAvailable() {
|
|
||||||
if (buffer != null) {
|
|
||||||
buffer.skinAvailable();
|
|
||||||
if (shouldJudgeType(texture) && buffer instanceof FakeSkinBuffer) {
|
|
||||||
//Auto judge skin type
|
|
||||||
String type = ((FakeSkinBuffer) buffer).judgeType();
|
|
||||||
texture.setModel(type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.callback != null) {
|
|
||||||
this.callback.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class FakeCacheKey {
|
|
||||||
public static Object wrapCacheKey(Object cacheKey, GameProfile profile) {
|
|
||||||
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) == null) { // 23w42a+
|
|
||||||
TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey), MojangAPILoader.GSON.toJson(profile, GameProfile.class));
|
|
||||||
}
|
|
||||||
return cacheKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameProfile unwrapCacheKey(Object cacheKey) {
|
|
||||||
if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) != null) {
|
|
||||||
return FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey); // 23w31a ~ 23w41a
|
|
||||||
} else {
|
|
||||||
return unwrapProperty(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey)); // 23w42a+
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameProfile unwrapProperty(Property property) {
|
|
||||||
return MojangAPILoader.GSON.fromJson((String) TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property), GameProfile.class); // 23w42a+
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object createMinecraftProfileTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
|
|
||||||
return new MinecraftProfileTextures(textures.get(MinecraftProfileTexture.Type.SKIN), textures.get(MinecraftProfileTexture.Type.CAPE), textures.get(MinecraftProfileTexture.Type.ELYTRA), SignatureState.SIGNED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package customskinloader.fake.itf;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IImageBuffer;
|
|
||||||
|
|
||||||
public interface IFakeIImageBuffer extends Runnable {
|
|
||||||
@Override
|
|
||||||
default void run() {
|
|
||||||
((IImageBuffer) this).skinAvailable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
package customskinloader.profile;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
import com.mojang.authlib.properties.Property;
|
|
||||||
import com.mojang.util.UUIDTypeAdapter;
|
|
||||||
import customskinloader.CustomSkinLoader;
|
|
||||||
import customskinloader.utils.HttpRequestUtil;
|
|
||||||
import customskinloader.utils.HttpTextureUtil;
|
|
||||||
import customskinloader.utils.HttpUtil0;
|
|
||||||
import customskinloader.utils.TextureUtil;
|
|
||||||
import org.apache.commons.codec.Charsets;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.commons.io.FilenameUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
public class DynamicSkullManager {
|
|
||||||
public static class SkullTexture {
|
|
||||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures;
|
|
||||||
public String index;//Index File
|
|
||||||
public ArrayList<String> skins;
|
|
||||||
public int interval;
|
|
||||||
public boolean fromZero;
|
|
||||||
//For program
|
|
||||||
public long startTime;
|
|
||||||
public int period;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<GameProfile, SkullTexture> dynamicTextures = new ConcurrentHashMap<>();
|
|
||||||
private Map<GameProfile, Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> staticTextures = new ConcurrentHashMap<>();
|
|
||||||
private List<GameProfile> loadingList = Lists.newArrayList();
|
|
||||||
|
|
||||||
private void parseGameProfile(GameProfile profile) {
|
|
||||||
Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null);
|
|
||||||
if (textureProperty == null) {
|
|
||||||
staticTextures.put(profile, Maps.newHashMap());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String value = TextureUtil.AuthlibField.PROPERTY_VALUE.get(textureProperty);
|
|
||||||
if (StringUtils.isBlank(value)) {
|
|
||||||
staticTextures.put(profile, Maps.newHashMap());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
@SuppressWarnings("deprecation") String json = new String(Base64.decodeBase64(value), Charsets.UTF_8);
|
|
||||||
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
|
||||||
SkullTexture result = gson.fromJson(json, SkullTexture.class);
|
|
||||||
if (result == null) {
|
|
||||||
staticTextures.put(profile, Maps.newHashMap());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
staticTextures.put(profile, (result.textures == null || !result.textures.containsKey(MinecraftProfileTexture.Type.SKIN)) ? Maps.newHashMap() : parseTextures(result.textures));
|
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(result.index)) {
|
|
||||||
File indexFile = new File(CustomSkinLoader.DATA_DIR, result.index);
|
|
||||||
try {
|
|
||||||
String index = FileUtils.readFileToString(indexFile, "UTF-8");
|
|
||||||
if (StringUtils.isNotEmpty(index)) {
|
|
||||||
String[] skins = CustomSkinLoader.GSON.fromJson(index, String[].class);
|
|
||||||
if (skins != null && skins.length != 0)
|
|
||||||
result.skins = Lists.newArrayList(skins);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
CustomSkinLoader.logger.warning("Exception occurs while parsing index file: " + e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CustomSkinLoader.config.enableDynamicSkull || result.skins == null || result.skins.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
CustomSkinLoader.logger.info("Try to load Dynamic Skull: " + json);
|
|
||||||
|
|
||||||
for (int i = 0; i < result.skins.size(); i++) {//check and cache skins
|
|
||||||
String skin = result.skins.get(i);
|
|
||||||
if (HttpUtil0.isLocal(skin)) {
|
|
||||||
//Local Skin
|
|
||||||
File skinFile = new File(CustomSkinLoader.DATA_DIR, skin);
|
|
||||||
if (skinFile.isFile() && skinFile.length() > 0) {
|
|
||||||
//Skin found
|
|
||||||
String fakeUrl = HttpTextureUtil.getLocalFakeUrl(skin);
|
|
||||||
result.skins.set(i, fakeUrl);
|
|
||||||
} else {
|
|
||||||
//Could not find skin
|
|
||||||
result.skins.remove(i--);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//Online Skin
|
|
||||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(skin).setCacheFile(HttpTextureUtil.getCacheFile(FilenameUtils.getBaseName(skin))).setCacheTime(0).setLoadContent(false));
|
|
||||||
if (!responce.success) {
|
|
||||||
//Could not load skin
|
|
||||||
result.skins.remove(i--);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.skins.isEmpty()) {//Nothing loaded
|
|
||||||
CustomSkinLoader.logger.info("Failed: Nothing loaded.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
result.interval = Math.max(result.interval, 50);
|
|
||||||
if (result.fromZero)
|
|
||||||
result.startTime = System.currentTimeMillis();
|
|
||||||
result.period = result.interval * result.skins.size();
|
|
||||||
CustomSkinLoader.logger.info("Successfully loaded Dynamic Skull: " + new Gson().toJson(result));
|
|
||||||
dynamicTextures.put(profile, result);
|
|
||||||
staticTextures.remove(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Support local skin for skull
|
|
||||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> parseTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
|
|
||||||
MinecraftProfileTexture skin = textures.get(MinecraftProfileTexture.Type.SKIN);
|
|
||||||
String skinUrl = skin.getUrl();
|
|
||||||
if (!HttpUtil0.isLocal(skinUrl))
|
|
||||||
return textures;
|
|
||||||
File skinFile = new File(CustomSkinLoader.DATA_DIR, skinUrl);
|
|
||||||
if (!skinFile.isFile())
|
|
||||||
return Maps.newHashMap();
|
|
||||||
textures.put(MinecraftProfileTexture.Type.SKIN, ModelManager0.getProfileTexture(HttpTextureUtil.getLocalFakeUrl(skinUrl), null));
|
|
||||||
return textures;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTexture(final GameProfile profile) {
|
|
||||||
if (staticTextures.get(profile) != null)
|
|
||||||
return staticTextures.get(profile);
|
|
||||||
if (loadingList.contains(profile))
|
|
||||||
return Maps.newHashMap();
|
|
||||||
if (dynamicTextures.containsKey(profile)) {
|
|
||||||
SkullTexture texture = dynamicTextures.get(profile);
|
|
||||||
long time = System.currentTimeMillis() - texture.startTime;
|
|
||||||
int index = (int) Math.floor((time % texture.period) / texture.interval);
|
|
||||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
|
|
||||||
map.put(MinecraftProfileTexture.Type.SKIN, ModelManager0.getProfileTexture(texture.skins.get(index), null));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadingList.add(profile);
|
|
||||||
Thread loadThread = new Thread(() -> {
|
|
||||||
parseGameProfile(profile);//Load in thread
|
|
||||||
loadingList.remove(profile);
|
|
||||||
});
|
|
||||||
loadThread.setName("Skull " + profile.hashCode());
|
|
||||||
loadThread.start();
|
|
||||||
return Maps.newHashMap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
package customskinloader.utils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.invoke.MethodHandle;
|
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.mojang.authlib.properties.Property;
|
|
||||||
import com.mojang.authlib.properties.PropertyMap;
|
|
||||||
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
|
|
||||||
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
|
||||||
import customskinloader.CustomSkinLoader;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import sun.misc.Unsafe;
|
|
||||||
|
|
||||||
public class TextureUtil {
|
|
||||||
/**
|
|
||||||
* Save and get fake url of base64 texture
|
|
||||||
*
|
|
||||||
* @param base64 texture in base64 string
|
|
||||||
* @return base64 fake url
|
|
||||||
* @since 14.16
|
|
||||||
*/
|
|
||||||
public static String parseBase64Texture(String base64) {
|
|
||||||
byte[] capeBytes = Base64.decodeBase64(base64);
|
|
||||||
String hash = HttpTextureUtil.getHash(capeBytes);
|
|
||||||
File cacheFile = HttpTextureUtil.getCacheFile(hash);
|
|
||||||
String fakeUrl = HttpTextureUtil.getBase64FakeUrl(hash);
|
|
||||||
|
|
||||||
//Save base64 image to cache file
|
|
||||||
try {
|
|
||||||
FileUtils.writeByteArrayToFile(cacheFile, capeBytes);
|
|
||||||
CustomSkinLoader.logger.info("Saved base64 image to " + cacheFile);
|
|
||||||
return fakeUrl;
|
|
||||||
} catch (Exception e) {
|
|
||||||
CustomSkinLoader.logger.warning("Error parsing base64 image: " + base64);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final static MethodHandles.Lookup IMPL_LOOKUP = ((Supplier<MethodHandles.Lookup>) () -> {
|
|
||||||
try {
|
|
||||||
Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
|
|
||||||
theUnsafeField.setAccessible(true);
|
|
||||||
Unsafe theUnsafe = (Unsafe) theUnsafeField.get(null);
|
|
||||||
Field implLookupField = MethodHandles.Lookup.class.getDeclaredField("IMPL_LOOKUP");
|
|
||||||
return (MethodHandles.Lookup) theUnsafe.getObject(theUnsafe.staticFieldBase(implLookupField), theUnsafe.staticFieldOffset(implLookupField));
|
|
||||||
} catch (Throwable t) {
|
|
||||||
throw new RuntimeException(t);
|
|
||||||
}
|
|
||||||
}).get();
|
|
||||||
|
|
||||||
// Some of the classes in Authlib used after Minecraft 23w31a were changed to record classes,
|
|
||||||
// resulting in changes to method names, so reflection is used here to be compatible with these changes.
|
|
||||||
public enum AuthlibField {
|
|
||||||
PROPERTY_NAME(Property.class, "name", String.class),
|
|
||||||
PROPERTY_VALUE(Property.class, "value", String.class),
|
|
||||||
PROPERTY_SIGNATURE(Property.class, "signature", String.class),
|
|
||||||
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id", UUID.class),
|
|
||||||
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name", String.class),
|
|
||||||
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties", PropertyMap.class),
|
|
||||||
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures", Map.class);
|
|
||||||
|
|
||||||
private final MethodHandle getter;
|
|
||||||
private final MethodHandle setter;
|
|
||||||
|
|
||||||
AuthlibField(Class<?> clazz, String name, Class<?> returnType) {
|
|
||||||
try {
|
|
||||||
this.getter = IMPL_LOOKUP.findGetter(clazz, name, returnType);
|
|
||||||
this.setter = IMPL_LOOKUP.findSetter(clazz, name, returnType);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
throw new RuntimeException(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <R> R get(Object o) {
|
|
||||||
try {
|
|
||||||
return (R) this.getter.invokeWithArguments(o);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
throw new RuntimeException(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set(Object o, Object value) {
|
|
||||||
try {
|
|
||||||
this.setter.invokeWithArguments(o, value);
|
|
||||||
} catch (Throwable t) {
|
|
||||||
throw new RuntimeException(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String fromUUID(UUID value) {
|
|
||||||
return value.toString().replace("-", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-9
@@ -7,12 +7,6 @@ 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/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
|
|
||||||
getPixel (II)I method_61940
|
|
||||||
setPixel (III)V method_61941
|
|
||||||
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
|
|
||||||
profile ()Lcom/mojang/authlib/GameProfile; comp_1631
|
|
||||||
packedTextures ()Lcom/mojang/authlib/properties/Property; comp_2011
|
|
||||||
net/minecraft/client/Minecraft net/minecraft/class_310
|
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
|
||||||
@@ -21,6 +15,7 @@ net/minecraft/client/Minecraft net/minecraft/class_310
|
|||||||
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; method_1582
|
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; method_1582
|
||||||
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; method_1531
|
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; method_1531
|
||||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
|
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
|
||||||
|
net/minecraft/client/gui/spectator/PlayerMenuObject net/minecraft/class_530
|
||||||
net/minecraft/client/multiplayer/ServerData net/minecraft/class_642
|
net/minecraft/client/multiplayer/ServerData net/minecraft/class_642
|
||||||
serverIP field_3761
|
serverIP field_3761
|
||||||
net/minecraft/client/renderer/RenderType net/minecraft/class_1921
|
net/minecraft/client/renderer/RenderType net/minecraft/class_1921
|
||||||
@@ -55,11 +50,11 @@ net/minecraft/client/resources/IResourceManager net/minecraft/class_3300
|
|||||||
net/minecraft/client/resources/SkinManager net/minecraft/class_1071
|
net/minecraft/client/resources/SkinManager net/minecraft/class_1071
|
||||||
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/util/ResourceLocation; method_4656
|
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; method_4656
|
||||||
net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1
|
net/minecraft/client/resources/SkinManager$3 net/minecraft/class_1071$3
|
||||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$class_8686
|
field_152801_c field_152801_c
|
||||||
|
field_152802_d field_152802_d
|
||||||
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/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/util/ResourceLocation net/minecraft/class_2960
|
net/minecraft/util/ResourceLocation net/minecraft/class_2960
|
||||||
|
|||||||
+51
-15
@@ -1,9 +1,16 @@
|
|||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
exclude 'customskinloader/tweaker/**'
|
||||||
|
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||||
|
exclude 'net/minecraft/client/renderer/texture/**'
|
||||||
exclude 'net/minecraft/client/resources/**'
|
exclude 'net/minecraft/client/resources/**'
|
||||||
|
exclude 'net/minecraft/resources/**'
|
||||||
|
exclude 'Profile.json'
|
||||||
}
|
}
|
||||||
sourceJar {
|
sourceJar {
|
||||||
|
exclude 'customskinloader/tweaker/**'
|
||||||
exclude 'net/**'
|
exclude 'net/**'
|
||||||
|
exclude 'Profile.json'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -11,10 +18,6 @@ repositories {
|
|||||||
name = "fabric"
|
name = "fabric"
|
||||||
url = "https://maven.fabricmc.net/"
|
url = "https://maven.fabricmc.net/"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
name = "sponge"
|
|
||||||
url = "https://repo.spongepowered.org/repository/maven-public/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -24,17 +27,50 @@ dependencies {
|
|||||||
|
|
||||||
import customskinloader.gradle.util.RemapUtil
|
import customskinloader.gradle.util.RemapUtil
|
||||||
import customskinloader.gradle.util.SourceUtil
|
import customskinloader.gradle.util.SourceUtil
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
apply plugin: 'org.spongepowered.mixin'
|
|
||||||
|
|
||||||
apply from: rootProject.file("buildSrc/patch.gradle")
|
|
||||||
patchMixin()
|
|
||||||
|
|
||||||
mixin {
|
|
||||||
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
|
||||||
reobfSrgFile = "build/mixin.srg"
|
|
||||||
reobfNotchSrgFile = "build/mixin.srg"
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceUtil.addDependencies project, project(":Common"), project(":Vanilla/Common")
|
SourceUtil.addDependencies project, project(":Common"), project(":Vanilla/Common")
|
||||||
RemapUtil.remapSources project
|
RemapUtil.remapSources project
|
||||||
|
|
||||||
|
// Resolve snapshot versions
|
||||||
|
tasks.publishModrinth.doFirst {
|
||||||
|
def snapshot = []
|
||||||
|
gameVersions.groupBy { v -> v.endsWith("-Snapshot") }.with {
|
||||||
|
this.tasks.publishModrinth.gameVersions = it[false]
|
||||||
|
snapshot = it[true]
|
||||||
|
}
|
||||||
|
|
||||||
|
// The CustomSkinLoader Fabric edition should support all Minecraft snapshot edition.
|
||||||
|
def jsonSlurper = new JsonSlurper()
|
||||||
|
def officialVersionList = [] as Set
|
||||||
|
plugins.withId "net.minecraftforge.gradle.forge", { plugin ->
|
||||||
|
def currentRelease = null
|
||||||
|
// Get version manifest json.
|
||||||
|
// https://github.com/MinecraftForge/ForgeGradle/blob/fc67182a61926f0bdb0d12da5fba7f4322f64d86/src/main/java/net/minecraftforge/gradle/common/BasePlugin.java#L229
|
||||||
|
jsonSlurper.parse(plugin.cacheFile("McManifest.json")).versions.each { version ->
|
||||||
|
if (version.type == "snapshot") {
|
||||||
|
// If the first version is a snapshot, since Mojang no longer provides the target version for snapshots,
|
||||||
|
// we assume that new snapshots will not be supported until the next release.
|
||||||
|
if (currentRelease == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else if (version.type == "release") {
|
||||||
|
currentRelease = version.id.with {
|
||||||
|
it.toString().split($/\./$).with { "${it[0]}.${it[1]}" }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// We do not care about other types.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (snapshot.contains("${currentRelease}-Snapshot".toString())) {
|
||||||
|
officialVersionList << version.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonSlurper.parse(new URL("https://meta.fabricmc.net/v2/versions/game")).each { version ->
|
||||||
|
// Exclude experimental editions which is not support in Modrinth.
|
||||||
|
if (!version.stable && officialVersionList.contains(version.version)) {
|
||||||
|
gameVersions << version.version.replace(" ", "-").replace("Pre-Release-", "pre") // Fix the id of the earlier preview versions of 1.14.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
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;\
|
minecraft_version=1.14
|
||||||
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
|
minecraft_full_versions=1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1
|
||||||
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
|
||||||
#forge gradle needs forge version
|
#forge gradle needs forge version
|
||||||
forge_mc_version=1.12.2
|
forge_mc_version=1.12.2
|
||||||
forge_version=14.23.5.2768
|
forge_version=14.23.5.2768
|
||||||
|
|||||||
+13
-13
@@ -2,17 +2,22 @@ com/mojang/blaze3d/matrix/MatrixStack net/minecraft/class_4587
|
|||||||
net/minecraft/client/Minecraft net/minecraft/class_310
|
net/minecraft/client/Minecraft net/minecraft/class_310
|
||||||
isIntegratedServerRunning ()Z method_1542
|
isIntegratedServerRunning ()Z method_1542
|
||||||
net/minecraft/client/entity/AbstractClientPlayer net/minecraft/class_742
|
net/minecraft/client/entity/AbstractClientPlayer net/minecraft/class_742
|
||||||
|
getDownloadImageSkin (Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)Lnet/minecraft/client/renderer/ThreadDownloadImageData; method_3120
|
||||||
|
getLocationSkin (Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; method_3124
|
||||||
net/minecraft/client/gui/Gui net/minecraft/class_332
|
net/minecraft/client/gui/Gui net/minecraft/class_332
|
||||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
|
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
|
||||||
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
|
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
|
||||||
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
|
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
|
||||||
renderPlayerlist (Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
|
renderPlayerlist (Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V method_1919
|
||||||
|
net/minecraft/client/gui/spectator/PlayerMenuObject net/minecraft/class_530
|
||||||
net/minecraft/client/model/ModelRenderer net/minecraft/class_630
|
net/minecraft/client/model/ModelRenderer net/minecraft/class_630
|
||||||
net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760
|
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/ThreadDownloadImageData net/minecraft/class_1046
|
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046
|
||||||
|
bufferedImage field_110560_d
|
||||||
|
textureUploaded field_5215
|
||||||
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
|
||||||
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; method_22798
|
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; method_22798
|
||||||
@@ -24,25 +29,20 @@ 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;FFFFFFF)V method_4177
|
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V method_4177
|
||||||
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/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_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4655
|
||||||
getInsecureSkin (Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin; method_52862
|
|
||||||
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
|
||||||
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; method_4654
|
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; method_4654
|
||||||
net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1
|
net/minecraft/client/resources/SkinManager$3 net/minecraft/class_1071$3
|
||||||
lambda$load$0 (Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo; method_52867
|
run ()V run
|
||||||
lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; method_54647
|
net/minecraft/client/resources/SkinManager$3$1 net/minecraft/class_1071$3$1
|
||||||
load (Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture; method_52868
|
field_152803_a field_152803_a
|
||||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$class_8686
|
field_152804_b field_152804_b
|
||||||
|
run ()V run
|
||||||
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
|
net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072
|
||||||
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071$class_8687
|
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
|
||||||
type field_45641
|
|
||||||
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/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/util/ResourceLocation net/minecraft/class_2960
|
net/minecraft/util/ResourceLocation net/minecraft/class_2960
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
"name": "CustomSkinLoader",
|
"name": "CustomSkinLoader",
|
||||||
"description": "Custom Skin Loader for Minecraft",
|
"description": "Custom Skin Loader for Minecraft",
|
||||||
"authors": ["xfl03", "JLChnToZ", "ZekerZhayard"],
|
"authors": ["xfl03", "JLChnToZ"],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://github.com/xfl03/MCCustomSkinLoader",
|
"homepage": "https://github.com/xfl03/MCCustomSkinLoader",
|
||||||
"issues": "https://github.com/xfl03/MCCustomSkinLoader/issues",
|
"issues": "https://github.com/xfl03/MCCustomSkinLoader/issues",
|
||||||
@@ -16,6 +16,5 @@
|
|||||||
"environment": "client",
|
"environment": "client",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"mixins.customskinloader.json"
|
"mixins.customskinloader.json"
|
||||||
],
|
]
|
||||||
"accessWidener": "customskinloader.accesswidener"
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixinPriority": 1010,
|
||||||
|
"package": "customskinloader.mixin",
|
||||||
|
"client": [
|
||||||
|
"MixinGuiPlayerTabOverlay",
|
||||||
|
"MixinIResource",
|
||||||
|
"MixinIResourceManager",
|
||||||
|
"MixinLayerCape",
|
||||||
|
"MixinMinecraft",
|
||||||
|
"MixinRenderPlayer",
|
||||||
|
"MixinSkinManager",
|
||||||
|
"MixinSkinManager$V1",
|
||||||
|
"MixinSkinManager$V2",
|
||||||
|
"MixinThreadDownloadImageDataV2",
|
||||||
|
"MixinThreadDownloadImageDataV3"
|
||||||
|
],
|
||||||
|
"refmap": "mixins.customskinloader.refmap.json",
|
||||||
|
"plugin": "customskinloader.fabric.MixinConfigPlugin",
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-15
@@ -35,17 +35,10 @@ 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$V1", "customskinloader.fake.itf.IFakeIResource$V2"),
|
Lists.newArrayList("customskinloader.fake.itf.IFakeIResource"),
|
||||||
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
|
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -56,13 +49,6 @@ public class DevEnvRemapper extends SimpleRemapper {
|
|||||||
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
|
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
remappedClasses.put(
|
|
||||||
"net.minecraft.class_1071$class_8686",
|
|
||||||
new AbstractMap.SimpleEntry<>(
|
|
||||||
Lists.newArrayList("customskinloader.fake.itf.IFakeSkinManagerCacheKey"),
|
|
||||||
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
+12
-16
@@ -1,4 +1,4 @@
|
|||||||
package customskinloader.mixin.core;
|
package customskinloader.fabric;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@@ -16,16 +16,16 @@ import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
|||||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||||
|
|
||||||
public class MixinConfigPlugin implements IMixinConfigPlugin {
|
public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||||
public static Logger logger = LogManager.getLogger("Core");
|
public static Logger logger = LogManager.getLogger("Fabric");
|
||||||
private long world_version;
|
private long world_version;
|
||||||
private long protocol_version;
|
private long protocol_version;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad(String mixinPackage) {
|
public void onLoad(String mixinPackage) {
|
||||||
LogManager.setLogFile(Paths.get("./CustomSkinLoader/CustomSkinLoader.log"));
|
LogManager.setLogFile(Paths.get("./CustomSkinLoader/CustomSkinLoader.log"));
|
||||||
URL versionJson = ClassLoader.getSystemClassLoader().getResource("version.json");
|
URL versionJson = this.getClass().getResource("/version.json");
|
||||||
if (versionJson != null) {
|
if (versionJson != null) {
|
||||||
logger.info("\"version.json\": " + versionJson);
|
logger.info("\"version.json\": " + versionJson.toString());
|
||||||
try (
|
try (
|
||||||
InputStream is = versionJson.openStream();
|
InputStream is = versionJson.openStream();
|
||||||
InputStreamReader isr = new InputStreamReader(is)
|
InputStreamReader isr = new InputStreamReader(is)
|
||||||
@@ -42,6 +42,9 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
|||||||
} else {
|
} else {
|
||||||
logger.warning("Can't read \"version.json\"! Ignore this message if the version you start is earlier than 18w47b.");
|
logger.warning("Can't read \"version.json\"! Ignore this message if the version you start is earlier than 18w47b.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This mod will remap extra classes when in the development environment.
|
||||||
|
DevEnvRemapper.initRemapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -52,19 +55,13 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (mixinClassName.endsWith(".MixinIImageBuffer")) {
|
if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV2")) {
|
||||||
result = this.world_version <= 2204 && this.protocol_version <= 553; // 18w43b ~ 19w37a
|
result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1
|
||||||
|
} else if (mixinClassName.endsWith(".MixinSkinManager$V2")) {
|
||||||
|
result = this.world_version >= 2205 && this.protocol_version >= 554; // 19w38a+
|
||||||
} else if (mixinClassName.endsWith(".MixinLayerCape") || mixinClassName.endsWith(".MixinRenderPlayer")) {
|
} else if (mixinClassName.endsWith(".MixinLayerCape") || mixinClassName.endsWith(".MixinRenderPlayer")) {
|
||||||
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
|
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
|
||||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V1")) {
|
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV3")) {
|
||||||
result = this.world_version <= 3465 && (this.protocol_version <= 763 || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x4000008E)); // 18w43b ~ 1.20.1
|
|
||||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V2") || mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$CacheKey") || mixinClassName.endsWith(".MixinSkinManager$TextureCache")) {
|
|
||||||
result = this.world_version >= 3567 && ((this.protocol_version >= 764 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+
|
|
||||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V3")) {
|
|
||||||
result = this.world_version >= 3684 && ((this.protocol_version >= 765 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x4000009D); // 23w42a+
|
|
||||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V1")) {
|
|
||||||
result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1
|
|
||||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V2")) {
|
|
||||||
result = this.world_version >= 2723 && ((this.protocol_version >= 755 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000023); // 1.17-rc2+
|
result = this.world_version >= 2723 && ((this.protocol_version >= 755 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000023); // 1.17-rc2+
|
||||||
}
|
}
|
||||||
logger.info("target: " + targetClassName + ", mixin: " + mixinClassName + ", result: " + result);
|
logger.info("target: " + targetClassName + ", mixin: " + mixinClassName + ", result: " + result);
|
||||||
@@ -101,4 +98,3 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package customskinloader.fabric;
|
|
||||||
|
|
||||||
public class MixinConfigPlugin extends customskinloader.mixin.core.MixinConfigPlugin {
|
|
||||||
@Override
|
|
||||||
public void onLoad(String mixinPackage) {
|
|
||||||
super.onLoad(mixinPackage);
|
|
||||||
|
|
||||||
// This mod will remap extra classes when in the development environment.
|
|
||||||
DevEnvRemapper.initRemapper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
accessWidener v2 intermediary
|
|
||||||
accessible method net/minecraft/class_2960 <init> (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"compatibilityLevel": "JAVA_8",
|
|
||||||
"mixinPriority": 1010,
|
|
||||||
"package": "customskinloader.mixin",
|
|
||||||
"client": [
|
|
||||||
"MixinGuiPlayerTabOverlay",
|
|
||||||
"MixinIImageBuffer",
|
|
||||||
"MixinIResource",
|
|
||||||
"MixinIResourceManager",
|
|
||||||
"MixinLayerCape",
|
|
||||||
"MixinMinecraft",
|
|
||||||
"MixinNativeImage",
|
|
||||||
"MixinRenderPlayer",
|
|
||||||
"MixinSkinManager$1",
|
|
||||||
"MixinSkinManager$CacheKey",
|
|
||||||
"MixinSkinManager$TextureCache",
|
|
||||||
"MixinSkinManager$V1",
|
|
||||||
"MixinSkinManager$V2",
|
|
||||||
"MixinSkinManager$V3",
|
|
||||||
"MixinThreadDownloadImageData$V1",
|
|
||||||
"MixinThreadDownloadImageData$V2"
|
|
||||||
],
|
|
||||||
"refmap": "mixins.customskinloader.refmap.json",
|
|
||||||
"plugin": "customskinloader.fabric.MixinConfigPlugin",
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,6 @@ 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/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage
|
|
||||||
getPixel (II)I getPixel
|
|
||||||
setPixel (III)V setPixel
|
|
||||||
customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey
|
|
||||||
profile ()Lcom/mojang/authlib/GameProfile; f_290972_
|
|
||||||
packedTextures ()Lcom/mojang/authlib/properties/Property; f_303729_
|
|
||||||
net/minecraft/client/Minecraft net/minecraft/client/Minecraft
|
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_
|
||||||
@@ -21,6 +15,7 @@ net/minecraft/client/Minecraft net/minecraft/client/Minecraft
|
|||||||
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; m_91109_
|
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; m_91109_
|
||||||
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; m_91097_
|
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; m_91097_
|
||||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
|
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
|
||||||
|
net/minecraft/client/gui/spectator/PlayerMenuObject net/minecraft/client/gui/spectator/PlayerMenuItem
|
||||||
net/minecraft/client/multiplayer/ServerData net/minecraft/client/multiplayer/ServerData
|
net/minecraft/client/multiplayer/ServerData net/minecraft/client/multiplayer/ServerData
|
||||||
serverIP f_105363_
|
serverIP f_105363_
|
||||||
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
|
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
|
||||||
@@ -55,11 +50,11 @@ net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resou
|
|||||||
net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager
|
net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager
|
||||||
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V m_118817_
|
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V m_118817_
|
||||||
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; m_118825_
|
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; m_118825_
|
||||||
net/minecraft/client/resources/SkinManager$1 net/minecraft/client/resources/SkinManager$1
|
net/minecraft/client/resources/SkinManager$3 net/minecraft/client/resources/SkinManager$3
|
||||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resources/SkinManager$CacheKey
|
field_152801_c field_152801_c
|
||||||
|
field_152802_d field_152802_d
|
||||||
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/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/util/ResourceLocation net/minecraft/resources/ResourceLocation
|
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
|
||||||
@@ -6,7 +6,10 @@ jar {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||||
|
exclude 'net/minecraft/client/renderer/texture/**'
|
||||||
exclude 'net/minecraft/client/resources/**'
|
exclude 'net/minecraft/client/resources/**'
|
||||||
|
exclude 'net/minecraft/resources/**'
|
||||||
}
|
}
|
||||||
sourceJar {
|
sourceJar {
|
||||||
exclude 'com/**'
|
exclude 'com/**'
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
minecraft_version=1.17.1
|
||||||
|
minecraft_full_versions=1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1
|
||||||
|
java_full_versions=16,17,18
|
||||||
|
#forge gradle needs forge version
|
||||||
|
forge_mc_version=1.12.2
|
||||||
|
forge_version=14.23.5.2768
|
||||||
|
mappings_version=stable_39
|
||||||
|
srg_notch_map=Forge.tsrg
|
||||||
File renamed without changes.
+1
-1
@@ -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"]
|
||||||
[[dependencies.customskinloader]]
|
[[dependencies.customskinloader]]
|
||||||
modId="forge"
|
modId="forge"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
File renamed without changes.
+58
-168
@@ -3,6 +3,7 @@ var Handle = getJavaType('org.objectweb.asm.Handle');
|
|||||||
var Opcodes = getJavaType('org.objectweb.asm.Opcodes');
|
var Opcodes = getJavaType('org.objectweb.asm.Opcodes');
|
||||||
var Type = getJavaType('org.objectweb.asm.Type');
|
var Type = getJavaType('org.objectweb.asm.Type');
|
||||||
var FieldInsnNode = getJavaType('org.objectweb.asm.tree.FieldInsnNode');
|
var FieldInsnNode = getJavaType('org.objectweb.asm.tree.FieldInsnNode');
|
||||||
|
var FieldNode = getJavaType('org.objectweb.asm.tree.FieldNode');
|
||||||
var InsnNode = getJavaType('org.objectweb.asm.tree.InsnNode');
|
var InsnNode = getJavaType('org.objectweb.asm.tree.InsnNode');
|
||||||
var IntInsnNode = getJavaType('org.objectweb.asm.tree.IntInsnNode');
|
var IntInsnNode = getJavaType('org.objectweb.asm.tree.IntInsnNode');
|
||||||
var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
|
var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
|
||||||
@@ -34,28 +35,42 @@ function initializeCoreMod() {
|
|||||||
'name': 'net/minecraft/client/resources/SkinManager'
|
'name': 'net/minecraft/client/resources/SkinManager'
|
||||||
},
|
},
|
||||||
'transformer': function (cn) {
|
'transformer': function (cn) {
|
||||||
|
cn.fields.removeIf(function (fn) {
|
||||||
|
return fn.name.equals("fakeManager") && fn.desc.equals("Lcustomskinloader/fake/FakeSkinManager;");
|
||||||
|
});
|
||||||
|
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;", null, null));
|
||||||
|
|
||||||
cn.methods.forEach(function (mn) {
|
cn.methods.forEach(function (mn) {
|
||||||
if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")) { // 1.20.1-
|
if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")) {
|
||||||
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.RETURN) {
|
if (node.getOpcode() === Opcodes.RETURN) {
|
||||||
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.NEW, "customskinloader/fake/FakeSkinManager"));
|
||||||
|
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||||
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkinCacheDir", "(Ljava/io/File;)V", false));
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
|
||||||
|
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESPECIAL, "customskinloader/fake/FakeSkinManager", "<init>", "(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V", false));
|
||||||
|
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/nio/file/Path;Lcom/mojang/authlib/minecraft/MinecraftSessionService;Ljava/util/concurrent/Executor;)V")) { // 1.20.2+
|
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) {
|
||||||
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.RETURN) {
|
if ((node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/resources/ResourceLocation") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/lang/String;)V")) // 1.19-
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
|| (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("net/minecraft/client/resources/SkinManager") && checkName(node.name, "m_242632_") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Ljava/lang/String;)Lnet/minecraft/resources/ResourceLocation;"))) { // 1.19.1+
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkinCacheDir", "(Ljava/nio/file/Path;)V", false));
|
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
|
||||||
} else if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("com/google/common/cache/CacheBuilder") && checkName(node.name, "build") && node.desc.equals("(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/LoadingCache;")) {
|
mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/resources/ResourceLocation;", false));
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setCacheLoader", "(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/CacheLoader;", false));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) { // 1.20.1-
|
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("net/minecraft/client/resources/SkinManager$SkinTextureCallback") && checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
|
||||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
var node = iterator.next();
|
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 5));
|
||||||
|
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcustomskinloader/fake/FakeSkinManager;Lnet/minecraft/resources/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
|
||||||
|
}
|
||||||
|
|
||||||
if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
|
if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
|
||||||
var s = "(";
|
var s = "(";
|
||||||
var args = Type.getType(node.desc).getArgumentTypes();
|
var args = Type.getType(node.desc).getArgumentTypes();
|
||||||
@@ -66,9 +81,12 @@ function initializeCoreMod() {
|
|||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
|
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
|
||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
|
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
|
||||||
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)[Ljava/lang/Object;", false));
|
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
|
||||||
|
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcustomskinloader/fake/FakeSkinManager;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)[Ljava/lang/Object;", false));
|
||||||
for (var i = 0; i < args.length; i++) {
|
for (var i = 0; i < args.length; i++) {
|
||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||||
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
|
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
|
||||||
@@ -84,7 +102,7 @@ function initializeCoreMod() {
|
|||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) { // 1.20.1-
|
} else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) {
|
||||||
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
|
if (node.getOpcode() === Opcodes.INVOKEINTERFACE
|
||||||
@@ -96,7 +114,7 @@ function initializeCoreMod() {
|
|||||||
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;Lcom/mojang/authlib/GameProfile;)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")) {
|
||||||
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, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
|
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
|
||||||
@@ -104,98 +122,27 @@ function initializeCoreMod() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (checkName(mn.name, "m_174849_") && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) { // 1.20.1-
|
} else if (checkName(mn.name, "m_174849_") && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) {
|
||||||
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("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
|
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
|
||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
|
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"));
|
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"))
|
||||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"));
|
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) { // 1.20.1-
|
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) {
|
||||||
var first = mn.instructions.getFirst();
|
var first = mn.instructions.getFirst();
|
||||||
|
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
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.INVOKEVIRTUAL, "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+
|
|
||||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
|
||||||
var node = iterator.next();
|
|
||||||
if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/client/resources/SkinManager$CacheKey") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/util/UUID;Lcom/mojang/authlib/properties/Property;)V")) {
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createProperty", "(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/properties/Property;", false));
|
|
||||||
} else if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/google/common/cache/LoadingCache") && checkName(node.name, "getUnchecked") && node.desc.equals("(Ljava/lang/Object;)Ljava/lang/Object;")) {
|
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
|
||||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadCache", "(Lcom/google/common/cache/LoadingCache;Ljava/lang/Object;Lcom/mojang/authlib/GameProfile;)Ljava/lang/Object;", false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return cn;
|
return cn;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'SkinManager$1Transformer': { // 1.20.2+
|
|
||||||
'target': {
|
|
||||||
'type': 'CLASS',
|
|
||||||
'name': 'net/minecraft/client/resources/SkinManager$1'
|
|
||||||
},
|
|
||||||
'transformer': function (cn) {
|
|
||||||
cn.methods.forEach(function (mn) {
|
|
||||||
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();) {
|
|
||||||
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;")) {
|
|
||||||
var s = "(";
|
|
||||||
var args = Type.getType(node.desc).getArgumentTypes();
|
|
||||||
for (var i = 0; i < args.length; i++) {
|
|
||||||
s = s + "Ljava/lang/Object;";
|
|
||||||
}
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
|
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.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
|
|
||||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
|
||||||
var node = iterator.next();
|
|
||||||
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
|
|
||||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (checkName(mn.name, "m_304063_") && mn.desc.equals("(Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;")) { // 1.20.3+
|
|
||||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
|
||||||
var node = iterator.next();
|
|
||||||
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "unpackTextures") && node.desc.equals("(Lcom/mojang/authlib/properties/Property;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;")) {
|
|
||||||
mn.instructions.insert(node, new TypeInsnNode(Opcodes.CHECKCAST, "com/mojang/authlib/minecraft/MinecraftProfileTextures"));
|
|
||||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/properties/Property;)Ljava/lang/Object;", false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return cn;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'SkinManager$CacheKeyTransformer': { // 1.20.2+
|
|
||||||
'target': {
|
|
||||||
'type': 'CLASS',
|
|
||||||
'name': 'net/minecraft/client/resources/SkinManager$CacheKey'
|
|
||||||
},
|
|
||||||
'transformer': function (cn) {
|
|
||||||
cn.interfaces.add("customskinloader/fake/itf/IFakeSkinManagerCacheKey");
|
|
||||||
return cn;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'IResourceTransformer': {
|
'IResourceTransformer': {
|
||||||
'target': {
|
'target': {
|
||||||
'type': 'CLASS',
|
'type': 'CLASS',
|
||||||
@@ -227,39 +174,6 @@ 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': {
|
|
||||||
'target': {
|
|
||||||
'type': 'CLASS',
|
|
||||||
'name': 'net/minecraft/client/gui/components/PlayerTabOverlay'
|
|
||||||
},
|
|
||||||
'transformer': function (cn) {
|
|
||||||
cn.methods.forEach(function (mn) {
|
|
||||||
if ((checkName(mn.name, "m_94544_") && mn.desc.equals("(Lcom/mojang/blaze3d/vertex/PoseStack;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V")) // 1.19.4-
|
|
||||||
|| (checkName(mn.name, "m_280406_") && mn.desc.equals("(Lnet/minecraft/client/gui/GuiGraphics;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V"))) { // 1.20+
|
|
||||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
|
||||||
var node = iterator.next();
|
|
||||||
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("net/minecraft/client/Minecraft") && checkName(node.name, "m_91090_") && node.desc.equals("()Z")) {
|
|
||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
|
||||||
mn.instructions.set(node, new InsnNode(Opcodes.ICONST_1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return cn;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'RenderPlayer_LayerCapeTransformer': {
|
'RenderPlayer_LayerCapeTransformer': {
|
||||||
'target': {
|
'target': {
|
||||||
'type': 'CLASS',
|
'type': 'CLASS',
|
||||||
@@ -283,48 +197,6 @@ function initializeCoreMod() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'SkinManager$TextureCacheTransformer': { // 1.20.2+
|
|
||||||
'target': {
|
|
||||||
'type': 'METHOD',
|
|
||||||
'class': 'net/minecraft/client/resources/SkinManager$TextureCache',
|
|
||||||
'methodName': 'm_294542_',
|
|
||||||
'methodDesc': '(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;'
|
|
||||||
},
|
|
||||||
'transformer': function (mn) {
|
|
||||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
|
||||||
var node = iterator.next();
|
|
||||||
if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
|
|
||||||
var s = "(";
|
|
||||||
var args = Type.getType(node.desc).getArgumentTypes();
|
|
||||||
for (var i = 0; i < args.length; i++) {
|
|
||||||
s = s + "Ljava/lang/Object;";
|
|
||||||
}
|
|
||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
|
|
||||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
|
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
|
||||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
|
||||||
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$TextureCache", mapName("f_291290_"), "Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"));
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)[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));
|
|
||||||
if (args[i].getInternalName().equals("Z")) {
|
|
||||||
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, "java/lang/Boolean"));
|
|
||||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false));
|
|
||||||
} else {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mn;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'HttpTextureTransformer': {
|
'HttpTextureTransformer': {
|
||||||
'target': {
|
'target': {
|
||||||
'type': 'METHOD',
|
'type': 'METHOD',
|
||||||
@@ -351,5 +223,23 @@ function initializeCoreMod() {
|
|||||||
return mn;
|
return mn;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'PlayerTabOverlayTransformer': {
|
||||||
|
'target': {
|
||||||
|
'type': 'METHOD',
|
||||||
|
'class': 'net/minecraft/client/gui/components/PlayerTabOverlay',
|
||||||
|
'methodName': 'm_94544_',
|
||||||
|
'methodDesc': '(Lcom/mojang/blaze3d/vertex/PoseStack;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V'
|
||||||
|
},
|
||||||
|
'transformer': function (mn) {
|
||||||
|
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||||
|
var node = iterator.next();
|
||||||
|
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("net/minecraft/client/Minecraft") && checkName(node.name, "m_91090_") && node.desc.equals("()Z")) {
|
||||||
|
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||||
|
mn.instructions.set(node, new InsnNode(Opcodes.ICONST_1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mn;
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,15 +0,0 @@
|
|||||||
package cpw.mods.cl;
|
|
||||||
|
|
||||||
import java.lang.module.ModuleFinder;
|
|
||||||
|
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
|
||||||
|
|
||||||
public class JarModuleFinder implements ModuleFinder {
|
|
||||||
public static JarModuleFinder of(SecureJar... jars) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class JarModuleReference {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package cpw.mods.jarhandling;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public interface SecureJar {
|
|
||||||
static SecureJar from(final Path... paths) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package java.lang;
|
|
||||||
|
|
||||||
import java.lang.module.Configuration;
|
|
||||||
|
|
||||||
public class ModuleLayer {
|
|
||||||
public static ModuleLayer boot() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Configuration configuration() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package java.lang.module;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class Configuration {
|
|
||||||
public static Configuration resolve(ModuleFinder before, List<Configuration> parents, ModuleFinder after, Collection<String> roots) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Configuration empty() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Optional<ResolvedModule> findModule(String name) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package java.lang.module;
|
|
||||||
|
|
||||||
public interface ModuleFinder {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package java.lang.module;
|
|
||||||
|
|
||||||
public class ModuleReference {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package java.lang.module;
|
|
||||||
|
|
||||||
public class ResolvedModule {
|
|
||||||
public ModuleReference reference() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package net.neoforged.fml.common;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface Mod {
|
|
||||||
String value();
|
|
||||||
}
|
|
||||||
@@ -6,9 +6,10 @@ jar {
|
|||||||
"TweakOrder": -10
|
"TweakOrder": -10
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
exclude 'net/minecraft/client/renderer/texture/**'
|
||||||
exclude 'net/minecraft/client/resources/SkinManager.class'
|
exclude 'net/minecraft/client/resources/SkinManager.class'
|
||||||
exclude 'net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.class'
|
exclude 'net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.class'
|
||||||
|
exclude 'net/minecraft/resources/**'
|
||||||
}
|
}
|
||||||
sourceJar {
|
sourceJar {
|
||||||
exclude 'net/**'
|
exclude 'net/**'
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
minecraft_version=1.12.2
|
||||||
|
minecraft_full_versions=1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1,1.12.2,1.13.2,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5
|
||||||
|
java_full_versions=8,9,10,11,12,13,14,15,16,17,18
|
||||||
|
#forge gradle needs forge version
|
||||||
|
forge_mc_version=1.12.2
|
||||||
|
forge_version=14.23.5.2768
|
||||||
|
mappings_version=stable_39
|
||||||
File renamed without changes.
Loaded 100 of 201 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user