Compare commits

..
75 Commits
Author SHA1 Message Date
33 299c8f53cf feat: update Java version in action 2023-07-14 01:10:18 +08:00
33 13fb0a4f92 feat: update README.md 2023-07-14 00:56:30 +08:00
33 921374f24f feat: remove illegal EOF 2023-07-14 00:30:14 +08:00
33 d2d244c70e feat: tweak into multi line output 2023-07-14 00:23:16 +08:00
33 f201f344a2 feat: use multiple version in action 2023-07-14 00:16:10 +08:00
33 76d6ed9a41 feat: add multiple version in release 2023-07-13 23:56:55 +08:00
33 b807aa1fb1 feat: remove snapshot Minecraft version in release 2023-07-13 23:35:35 +08:00
33 d797ed378a feat: remove development version 2023-07-13 21:54:36 +08:00
33 c3f8f1eb8f fix: mod version in action 2023-07-13 21:18:24 +08:00
33 226d953012 fix: GitHub pre-release in action 2023-07-13 21:05:47 +08:00
33 d1ab2fbf43 fix: CurseForge and Modrinth upload 2023-07-13 20:47:41 +08:00
33 00a14010c6 fix: CurseForge and Modrinth upload 2023-07-13 19:49:35 +08:00
33 a198e40fc7 fix: CurseForge upload 2023-07-13 19:39:06 +08:00
33 5b820c537d feat: remove GitHub release action 2023-07-13 18:39:23 +08:00
8Mi_Yile 6e1be02cf0 Update common.yml (#258) 2023-07-13 18:37:42 +08:00
33 9abf9eb779 fix: curseforge and modrinth release 2023-06-28 13:56:03 +08:00
33 fbc95314ad fix: use correct environment in upload task 2023-06-27 14:45:30 +08:00
33 d4576249ac fix: pull request won't run upload 2023-06-27 14:31:22 +08:00
33 dfe47f7c64 fix: publish snapshot and canary to Tencent COS 2023-06-27 14:25:42 +08:00
33 1199e10ca4 feat: bump 14.17 2023-06-27 14:19:40 +08:00
8Mi_Yileandgithub-actions[bot] 61287cf64c Add: common.yaml: CI Build Sync to Github Pre-Release (#256)
* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-27 14:05:57 +08:00
8Mi_Yileandgithub-actions[bot] b16058340c add: common.yml: use matrix to multi-process upload file (#252)
* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-27 14:05:55 +08:00
33 ac09a51f48 Fix: GitHub Action Release 2023-06-27 14:05:46 +08:00
8Mi_Yileandgithub-actions[bot] 3e5bd83b5c issues-template: add option / common.yml: add support github release (#251)
* Auto Sync From

* Auto Sync From8MiYile/15-develop.zip

* Auto Sync From 8MiYile / 15-develop

* Auto Sync From 8MiYile / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

* Auto Sync From 8MiYile / MCCustomSkinLoader / 15-develop

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-27 14:05:42 +08:00
ZekerZhayard 4ce00d07b5 Fix crash when the URL of skull profiles is not valid. (#255)
* Fix crash when the URL of skull profiles is not valid.

* Fix crash when the URL of skull profiles is not valid.
2023-06-27 14:02:45 +08:00
ZekerZhayard 6e9380be49 Support Fabric 23w16a. (#253) 2023-06-27 14:01:14 +08:00
33 53050a63f5 feat: Minecraft 1.20 2023-06-27 13:45:25 +08:00
33 34ac3ac4f2 Bump: 14.16 2023-04-08 22:01:55 +08:00
ZekerZhayard f5b1989453 Fix: Skull textures not loading when using local skins. 2023-03-18 11:07:34 +08:00
ZekerZhayard 85923855d8 Support 1.19.4. Remove Vanilla 1.19.3. 2023-03-15 23:34:05 +08:00
8Mi_Yile c8e96c11cd Add Github Issue Template's options in Report Bug (#242)
* Update report_bug.en_US.yml

* Update report_bug.zh_CN.yml

* Update report_bug.zh_CN.yml

* Update report_bug.en_US.yml

* Update report_bug.zh_CN.yml

* Update report_bug.en_US.yml

* Update report_bug.en_US.yml

* Update report_bug.zh_CN.yml

* Update report_bug.zh_CN.yml

* Update report_bug.zh_CN.yml

* Update report_bug.en_US.yml

* Update report_bug.zh_CN.yml
2023-01-28 12:42:38 +08:00
33 32e3e2e5a2 Add: GameProfile cache for Mojang API 2023-01-26 19:34:58 +08:00
33 b7b5e9d6c8 Add: LogManager 2023-01-26 18:51:38 +08:00
ZekerZhayard dfa7db1731 Fix: Modrinth release for Fabric edition 2023-01-26 16:26:08 +08:00
33 b645fd1665 Fix: Modrinth release 2023-01-26 15:39:37 +08:00
33 28fc81cb9a Fix: release build 2023-01-26 15:21:26 +08:00
33 bb0a47de4b Release: 14.15.2 2023-01-26 14:46:52 +08:00
33 d09b1d9807 Tweak: log file format 2023-01-24 18:43:17 +08:00
33 c207bdfc0e Fix: build action 2023-01-13 15:43:38 +08:00
33 69d35a69b7 Tweak: release build action 2023-01-13 15:22:29 +08:00
8Mi_Yile d767f40d32 添加 Issue Template (#238) 2023-01-13 15:12:40 +08:00
ZekerZhayard 5329a27d1a Fix: #199 2023-01-12 22:12:40 +08:00
33 ddefe00ac0 Add: more cape 2023-01-12 00:09:57 +08:00
33 dd4b706827 Add: support WynntilsAPI cape 2023-01-11 22:06:58 +08:00
33 84072c62f3 Add: support OptiFine cape 2023-01-11 18:51:44 +08:00
33 2d00e12f0a Update: README.md 2023-01-07 04:33:22 +08:00
33 b2b56f5be5 Add: GitHub Action for Pull Request 2023-01-07 01:24:12 +08:00
33 43c8ceb21e Add: show Quilt loader in CurseForge and Modrinth 2023-01-07 01:09:08 +08:00
33 a0ad239770 Release: 14.15.1 2023-01-07 00:26:22 +08:00
ZekerZhayard c8f0f7e283 Fix: loadSkin not being remapped 2023-01-07 00:20:17 +08:00
33 bfbd6ee31a Update: README.md 2023-01-05 15:28:27 +08:00
33 f8f3caad39 Fix: trigger release action by tag 2023-01-04 17:15:40 +08:00
33 bd409ae169 Tweak: trigger release action by tag 2023-01-04 17:11:43 +08:00
33 82f0aad9ff Release: 14.15 2023-01-04 16:37:33 +08:00
33 f2fce38137 Fix: pass secrets to reuse workflow 2023-01-04 16:27:28 +08:00
33 7d19f3114c Add: GitHub Action Test 2023-01-04 16:15:47 +08:00
33 d7a1e0f31f Update: certificate 2023-01-04 15:56:11 +08:00
33 201210f567 Fix: GitHub Action 2023-01-04 15:40:53 +08:00
33 26ed002689 Fix: GitHub Action 2023-01-04 15:39:55 +08:00
33 7d7e5c9060 Update: reuse GitHub Action workflow 2023-01-04 15:37:43 +08:00
33 81bf422250 Add: environment in GitHub Action 2023-01-04 15:12:17 +08:00
33 776e31e158 Fix: cos beta build upload 2023-01-04 14:50:30 +08:00
33 4a92223158 Fix: GitHub Action 2023-01-04 14:38:43 +08:00
33 264aacc8c0 Add: upload beta to cos 2023-01-04 14:34:46 +08:00
33 0b000731b5 Remove: Circle CI 2023-01-04 13:57:39 +08:00
33 f0012b58df Tweak: GitHub Action 2023-01-04 13:50:38 +08:00
33 013c22ae95 Add: GitHub Action 2023-01-04 13:43:08 +08:00
33 01d02a27b0 Update: circle ci version 2.1 2023-01-04 12:01:48 +08:00
33 077551e161 Tweak: only build release branch in circle ci 2023-01-04 12:01:48 +08:00
ZekerZhayard bd642d0106 Don't use ClassWriter.COMPUTE_FRAME anymore. (#234) 2023-01-02 14:21:51 +08:00
ZekerZhayard fbec7ce6bb Support 1.19.3. Remove Vanilla 1.19.2. (#231) 2022-12-12 02:26:22 +08:00
33 ea1b25a38f Tweak: add debug argument to Gradle 2022-12-07 21:24:51 +08:00
33 62018a3e8b Tweak: use Gradle Wrapper 2022-12-07 19:52:11 +08:00
ZekerZhayard f38a8ddcef Refactor SkinManager (#230) 2022-12-07 19:38:24 +08:00
33 63251c9f5e Add: a switch for printing to standard output 2022-11-24 21:42:45 +08:00
101 changed files with 2681 additions and 1107 deletions

No files matched your search

-46
View File
@@ -1,46 +0,0 @@
# Java Gradle CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: circleci/openjdk@sha256:7be33522f6f0ca65c2e78b22b1ef3e6739038494c1de1b8fb6d96da400dccf53
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- restore_cache:
keys:
- gradle-cache
# Gradle Wrapper
# - run: sudo chmod +x gradlew
# - run: ./gradlew --version
# - run: ./gradlew clean build
# Gradle
- run: gradle --version
- run:
name: Build
command: |
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $CIRCLE_SHA1)
gradle clean build
- run:
name: Publish
command: |
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $CIRCLE_SHA1)
gradle upload --info
# - run: gradle publishGprPublicationToGitHubPackagesRepository
- store_artifacts:
path: ./build/libs
- save_cache:
paths:
- ~/.gradle
key: gradle-cache
+8
View File
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Telegram
url: https://t.me/customskinloader
about: Gugugu
- name: QQ
url: https://jq.qq.com/?_wv=1027&k=vF16R5tg
about: Gugugu
+124
View File
@@ -0,0 +1,124 @@
name: Report Bug
description: Report a bug and help us improve CustomSkinLoader
labels: [ bug ]
title: "[Bug] "
body:
- type: markdown
attributes:
value: |
Here is the Report Bug issue for CustomSkinLoader
With a red asterisk for the mandatory items
Please keep the work order content neat and tidy, do not paste the contents of the log file directly onto the work order, it will look very messy and unattractive work orders
- type: textarea
id: description
attributes:
label: Describe the bug
description: |
A clear and concise description of what the issue is.
Provide as much information as possible, videos, crash reports, etc.
DO NOT PASTE A CRASH REPORT HERE!!!
validations:
required: true
- type: textarea
id: reproducing
attributes:
label: Steps to reproduce
description: How do you trigger this bug?
render: bash
value: |
1.
2.
3.
validations:
required: true
- type: input
id: crash-report
attributes:
label: Link to crash-report if applicable
description: |
The files are in the folder `<minecraft-directory>/crash-reports`
[Generate URL](https://mclo.gs)
placeholder: "Ex: https://mclo.gs/xxxxxx"
- type: input
id: csl-log
attributes:
label: Link to CustomSkinLoader.log if applicable
description: |
The path to the file is `<minecraft-directory>/CustomSkinLoader/CustomSkinLoader.log`.
[Generate URL](https://mclo.gs)
placeholder: "Ex: https://mclo.gs/xxxxxx"
- type: input
id: latest-log
attributes:
label: Link to latest.log if applicable
description: |
The path to the file is `<minecraft-directory>/logs/latest.log`.
[Generate URL](https://mclo.gs)
placeholder: "Ex: https://mclo.gs/xxxxxx"
- type: input
id: forge-log
attributes:
label: "[Only Forge User] Link to Forge Log if applicable"
description: |
The path to the file is `<minecraft-directory>/logs/debug.log` or `<minecraft-directory>/logs/fml-client-latest.log`.
if your mod loader isn't `Forge`, URL can set empty
[Generate URL](https://mclo.gs)
placeholder: "Ex: https://mclo.gs/xxxxxx"
- type: input
id: mod-version
attributes:
label: Mod Version
placeholder: "Ex: 14.16"
validations:
required: true
- type: input
id: mc-version
attributes:
label: Minecraft Version
placeholder: "Ex: 1.19.4"
validations:
required: true
- type: input
id: mc-launcher-version
attributes:
label: Minecraft Launcher Name and Version
placeholder: "Ex: HMCL v3.5.4.232"
description: |
If you don't know the version of the game, you can just fill in the name of the game launcher
- type: dropdown
id: loader-type
attributes:
label: Mod Loader
options:
- Quilt
- Fabric
- Forge
- <without mod loader>
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Operating System
options:
- Windows
- Linux
- macOS
- Other
validations:
required: true
- type: checkboxes
id: prerequisites
attributes:
label: Before submitting a bug report
options:
- label: |
This bug wasn't already reported (I have searched bug reports on GitHub).
required: true
- label: |
This is a valid bug (I am able to reproduce this on the latest dev build).
required: true
- label: |
This problem is triggered in the latest version of the mod (if not the latest please upgrade the mod first)
required: true
+125
View File
@@ -0,0 +1,125 @@
name: 提交问题
description: 报告问题以帮助我们改进CustomSkinLoader
labels: [ bug ]
title: "[Bug] "
body:
- type: markdown
attributes:
value: |
你好,这里是 `CustomSkinLoader`
标注红色星号的为必填项
以及,保持工单干净整洁,不要直接将日志内容粘贴到工单上,比如粘贴到描述内是不行的
- type: textarea
id: description
attributes:
label: 描述问题
description: |
简单的描述问题, 并提供类似图片、视频,以更好的报告错误(如果可以)
!注意:请不要在这里放日志文件或崩溃报告文件的内容
validations:
required: true
- type: textarea
id: reproducing
attributes:
label: 复现步骤
description: 请问你是如何触发这个问题的
render: bash
value: |
1.
2.
3.
validations:
required: true
- type: input
id: crash-report
attributes:
label: 崩溃报告查看地址
description: |
在游戏目录下的 `crash-reports` 文件夹下,里面找最近的报告生成时间
客户端若无崩溃则直接填写 `客户端无崩溃`
[生成连接](https://mclo.gs)
placeholder: "示例: https://mclo.gs/xxxxxx"
- type: input
id: csl-log
attributes:
label: CustomSkinLoader.log 查看地址
description: |
文件路径:`<游戏路径>/CustomSkinLoader/CustomSkinLoader.log`.
[生成连接](https://mclo.gs)
placeholder: "示例: https://mclo.gs/xxxxxx"
- type: input
id: latest-log
attributes:
label: latest.log 查看地址
description: |
文件路径:`<游戏路径>/logs/latest.log`.
[生成连接](https://mclo.gs)
placeholder: "示例: https://mclo.gs/xxxxxx"
- type: input
id: forge-log
attributes:
label: "[仅Forge用户] Forge Log 查看地址"
description: |
文件路径:`<游戏路径>/logs/debug.log` 或者 `<游戏路径>/logs/fml-client-latest.log`.
若没有使用 `Forge` 加载器的,可以不填写
[生成连接](https://mclo.gs)
placeholder: "示例: https://mclo.gs/xxxxxx"
- type: input
id: mod-version
attributes:
label: 模组版本
placeholder: "示例: 14.16"
validations:
required: true
- type: input
id: mc-version
attributes:
label: Minecraft游戏版本
placeholder: "示例: 1.19.4"
validations:
required: true
- type: input
id: mc-launcher-version
attributes:
label: Minecraft启动器 名称 及 版本
placeholder: "示例: HMCL v3.5.4.232"
description: |
若不知道游戏版本 可以只填写游戏启动器的名称
validations:
required: true
- type: dropdown
id: loader-type
attributes:
label: 模组加载器
options:
- Quilt
- Fabric
- Forge
- 不使用加载器
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: 操作系统
options:
- Windows
- Linux
- macOS
- 其他操作系统
validations:
required: true
- type: checkboxes
id: prerequisites
attributes:
label: 在提交错误报告之前,有没有做到...
options:
- label: |
先尝试搜索issues里面, 查看并确认打开或关闭的工单, 是否搜索不到
required: true
- label: |
确认你的模组版本是最新的开发版本,且文件下载正确,没有出现类似forge下载了fabric版的这类基础问题
required: true
- label: |
这个问题是在最新的mod版本触发(若不是最新的请先升级mod)
required: true
@@ -0,0 +1,22 @@
name: Suggestion
description: Suggest a new feature or change for CustomSkinLoader.
labels: [ enhancement ]
body:
- type: textarea
id: description
attributes:
label: Describe the feature
description: A clear and concise description of what the feature/change is.
validations:
required: true
- type: checkboxes
id: prerequisites
attributes:
label: Before submitting a suggestion
options:
- label: |
This feature doesn't already exist in the client. (I have checked every module and their settings on the **latest dev build**)
required: true
- label: |
This wasn't already suggested. (I have searched suggestions on GitHub and read the FAQ)
required: true
@@ -0,0 +1,22 @@
name: 反馈或建议
description: 给CustomSkinLoader这个模组提个建议
labels: [ enhancement ]
body:
- type: textarea
id: description
attributes:
label: 描述一下
description: 简单描述一下该功能/变化是什么。
validations:
required: true
- type: checkboxes
id: prerequisites
attributes:
label: 在提交反馈或建议之前,请先确认...
options:
- label: |
你要提交的反馈或者建议不存在于本模组的最新开发版下.
required: true
- label: |
以及在issues或者Wiki内搜索过, 并且无结果
required: true
+14
View File
@@ -0,0 +1,14 @@
name: Beta
on:
push:
branches:
- '14-develop'
jobs:
build-beta:
name: Build Beta
uses: ./.github/workflows/common.yml
with:
type: Beta
publish-task: uploadBeta
secrets: inherit
+14
View File
@@ -0,0 +1,14 @@
name: Canary
on:
push:
branches:
- '15-develop'
jobs:
build-canary:
name: Build Canary
uses: ./.github/workflows/common.yml
with:
type: Canary
publish-task: uploadCanary
secrets: inherit
+205
View File
@@ -0,0 +1,205 @@
name: Common
on:
workflow_call:
inputs:
type:
required: true
type: string
publish-task:
required: false
type: string
is-snapshot:
required: false
type: boolean
default: true
jobs:
build-common:
name: Build
runs-on: ubuntu-latest
environment: Build
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
cache: 'gradle'
-
name: Build
env:
KEY_PASS: ${{ secrets.KEY_PASS }}
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
run: |
echo Snapshot: $IS_SNAPSHOT
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
./gradlew clean build --stacktrace
-
uses: actions/upload-artifact@v3
name: Publish to Github Artifact
with:
name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }}
path: build/libs
Upload:
if: inputs.publish-task
needs: build-common
continue-on-error: true
environment: Build
strategy:
matrix:
website: [CurseForge_Modrinth]
modtype: [Fabric,Forge-Active,Forge-Legacy]
include:
-
website: TencentCOS
modtype: All
# -
# website: GitHub-Release
# modtype: All
-
website: GitHub-PreRelease
modtype: All
name: ${{ matrix.website }} (${{ matrix.modtype}})
runs-on: ubuntu-latest
steps:
-
name: Checkout Git Repository
uses: actions/checkout@v3
-
uses: actions/download-artifact@v3
name: Download Artifact Zips
with:
path: build
-
name: Preparation Folder
run: |
rsync -avz "build/$(ls build|grep "CustomSkinLoader")/" build/libs/
ls -lh build
-
if: ${{ matrix.modtype != 'All' }}
name: Checking and setting the environment
id: cslenv
run: |
output="$(ls build/libs | grep -v "sources")"
if [[ "${{ matrix.modtype }}" == "Forge"* ]]; then
modloader="Forge"
path=$(echo ${{ matrix.modtype }} | sed "s#-#/#")
else
modloader=${{ matrix.modtype }}
path=${{ matrix.modtype }}
fi
echo "path=$path" >> $GITHUB_OUTPUT
echo "modloader=$modloader" >> $GITHUB_OUTPUT
echo "filename=$(echo "$output"|grep $(echo ${{ matrix.modtype }}|sed "s#-##") )" >> $GITHUB_OUTPUT
echo "version=$(grep "version=" build.properties | grep -v "#" | sed "s/version=//")" >> $GITHUB_OUTPUT
echo "edition=$(echo ${{ matrix.modtype }} | sed "s/-//")" >> $GITHUB_OUTPUT
echo "minecraft_vers<<EOF" >> $GITHUB_OUTPUT
grep "minecraft_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/minecraft_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "java_vers<<EOF" >> $GITHUB_OUTPUT
grep "java_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/java_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
-
if: startsWith(matrix.website, 'GitHub-')
name: Settings more strings to Environment
id: cslenv-github
run: |
#展开
echo "buildtime=$(TZ=Asia/Shanghai date "+%Y.%m.%d %H:%M")" >> $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') }}
name: 【GitHub Pre-Release】 Delete
uses: 8Mi-Tech/delete-release-assets-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: CI-Build
deleteOnlyFromDrafts: false
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: 【GitHub Pre-Release】 Set CI-Build Text
run: |
cat > build/ci-build.md << 'EOF'
Build Time / 构建时间 : ${{ steps.cslenv-github.outputs.buildtime }}
自动同步分支 ${{ github.ref_name }} 的代码,以保持最新
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
<br>
[如何使用 / How to uses?](https://github.com/xfl03/MCCustomSkinLoader/wiki/How-to-Use)
EOF
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: 【GitHub Pre-Release】 Upload Tag
uses: richardsimko/update-tag@v1
with:
tag_name: CI-Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: 【GitHub Pre-Release】 Publish
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: CustomSkinLoader CI-Build
tag_name: CI-Build
prerelease: true
body_path: build/ci-build.md
files: build/libs/*
#iles: "${{ steps.cslenv-github.outputs.pathlist }}"
-
if: ${{ matrix.website == 'GitHub-Release' && inputs.type == 'Release' }}
uses: softprops/action-gh-release@v1
name: 【GitHub Release】 Publish
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: CustomSkinLoader ${{ github.ref }}
tag_name: ${{ github.ref }}
#generate_release_notes: true
files: ${{ steps.cslenv-github.outputs.pathlist }}
-
if: ${{ matrix.website == 'TencentCOS' }}
name: 【TencentCOS】 Publish
env:
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
run: |
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
./gradlew ${{ inputs.publish-task }} --info --stacktrace
# ./gradlew publishGprPublicationToGitHubPackagesRepository
-
if: ${{ matrix.website == 'CurseForge_Modrinth' && inputs.type == 'Release' }}
name: 【CurseForge & Modrinth】 Publish
uses: Kir-Antipov/[email protected]
with:
modrinth-id: idMHQ4n2
modrinth-featured: true
modrinth-unfeature-mode: subset
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 286924
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
name: CustomSkinLoader_${{ steps.cslenv.outputs.edition }}_${{ steps.cslenv.outputs.version }}
version: ${{ steps.cslenv.outputs.version }}-${{ steps.cslenv.outputs.edition }}
version-type: release
loaders: ${{ steps.cslenv.outputs.modloader }}
game-versions: |
${{ steps.cslenv.outputs.minecraft_vers }}
game-version-filter: releases
java: |
${{ steps.cslenv.outputs.java_vers }}
retry-attempts: 2
retry-delay: 10000
fail-mode: fail
files: |
build/libs/${{ steps.cslenv.outputs.filename }}
+17
View File
@@ -0,0 +1,17 @@
name: Pull Request
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- '14-develop'
- '15-develop'
jobs:
build-pull-request:
name: Build Pull Request
uses: ./.github/workflows/common.yml
with:
type: PullRequest
+14
View File
@@ -0,0 +1,14 @@
name: Release
on:
release:
types: [released]
jobs:
build-release:
name: Build Release
uses: ./.github/workflows/common.yml
with:
type: Release
publish-task: upload
is-snapshot: false
secrets: inherit
+10 -13
View File
@@ -13,7 +13,7 @@ There are the available versions in different environments below:
| | Forge | Fabric | | | Forge | Fabric |
|:-----------------------:|:-----------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------:| |:-----------------------:|:-----------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------:|
| Runtime Environment | forge-1.8-11.14.0.1237 ~ 1.13.2-25.0.22<br/> forge-1.13.2-25.0.42 ~ latest | fabric-loader-0.4.3+build.134 ~ latest<br/> Minecraft 18w43b ~ latest<br/> *fabric-api is not required* | | Runtime Environment | forge-1.8-11.14.0.1237 ~ 1.13.2-25.0.22<br/> forge-1.13.2-25.0.42 ~ latest | fabric-loader-0.4.3+build.134 ~ latest<br/> Minecraft 18w43b ~ latest<br/> *fabric-api is not required* |
| Development Environment | ForgeGradle-2.1-SNAPSHOT ~ latest<br/> forge-1.8-11.14.3.1503 ~ 1.12.2-14.23.5.2855<br/> forge-1.13.2-25.0.198 ~ latest | fabric-loom-(?) ~ latest<br/> fabric-loader-0.12.0 ~ latest<br/> Minecraft 18w49a ~ latest<br/> *fabric-api is not required* | | Development Environment | ForgeGradle-2.1-SNAPSHOT ~ latest<br/> forge-1.8-11.14.3.1503 ~ 1.12.2-14.23.5.2860<br/> forge-1.13.2-25.0.198 ~ latest | fabric-loom-(?) ~ latest<br/> fabric-loader-0.12.0 ~ latest<br/> Minecraft 18w49a ~ latest<br/> *fabric-api is not required* |
### Preliminary steps for testing local builds ### Preliminary steps for testing local builds
1. Create a new empty minecraft development environment. 1. Create a new empty minecraft development environment.
@@ -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 `14.14-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 `14.14-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 `14.14-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 `14.14-SNAPSHOT-00` manually --> <!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
<version>${version}</version> <version>${version}</version>
</project> </project>
``` ```
@@ -71,25 +71,22 @@ 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:14.14-SNAPSHOT-00" deobfCompile "mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00"
} }
minecraft { minecraft {
clientRunArgs += ["--tweakClass", "customskinloader.forge.ForgeDevTweaker", "--username", "<Your username>"] clientRunArgs += ["--tweakClass", "customskinloader.forge.ForgeDevTweaker", "--username", "<Your username>"]
} }
``` ```
1. Run `./gradlew setupDecompWorkspace eclipse` command. 1. Run `./gradlew setupDecompWorkspace` command.
1. Due to the run configurations which generated by ForgeGradle 2 has not been compatible with IntelliJ IDEA 2020 and above, we recommend to install [Eclipser](https://plugins.jetbrains.com/plugin/7153-eclipser) plugin. It can convert Eclipse run configurations to IDEA. (Right click to `*.launch` file in project folder, then select `Convert with Eclipser`, then a new IDEA run configuration will be created.)
1. For IDEA, open `Run/Debug Configurations` dialog, change classpath of module to the name contains `.main`.
1. Add `--tweakClass customskinloader.forge.ForgeDevTweaker --username <Your username>` to CLI arguments in `Run/Debug Configurations` dialog.
1. Then you can debug the mod in IDE or through `./gradlew runClient` command. 1. Then you can debug the mod in IDE or through `./gradlew runClient` command.
### For ForgeGradle 3.x ~ 5.x ( forge-1.12.2-14.23.5.2851 ~ latest ) ### For ForgeGradle 3.x ~ 5.x ( forge-1.12.2-14.23.5.2851 ~ latest )
1. Add below contents to `build.gradle`: 1. Add below contents to `build.gradle`:
```gradle ```gradle
dependencies { dependencies {
implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:14.14-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:14.14-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 {
@@ -107,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:14.14-SNAPSHOT-00" modImplementation "mods:CustomSkinLoader_Fabric:14.15-SNAPSHOT-00"
} }
tasks.runClient { tasks.runClient {
@@ -18,6 +18,8 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.config.Config; import customskinloader.config.Config;
import customskinloader.config.SkinSiteProfile; import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.ProfileLoader; import customskinloader.loader.ProfileLoader;
import customskinloader.log.LogManager;
import customskinloader.log.Logger;
import customskinloader.profile.DynamicSkullManager; import customskinloader.profile.DynamicSkullManager;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
import customskinloader.profile.ProfileCache; import customskinloader.profile.ProfileCache;
@@ -27,7 +29,7 @@ import customskinloader.utils.MinecraftUtil;
/** /**
* Custom skin loader mod for Minecraft. * Custom skin loader mod for Minecraft.
* *
* @author (C) Jeremy Lam [JLChnToZ] 2013-2014 & Alexander Xia [xfl03] 2014-2020 * @author Jeremy Lam [JLChnToZ] 2013-2014 & Alexander Xia [xfl03] 2014-2023
* @version @MOD_FULL_VERSION@ * @version @MOD_FULL_VERSION@
*/ */
public class CustomSkinLoader { public class CustomSkinLoader {
@@ -42,12 +44,13 @@ public class CustomSkinLoader {
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
public static final Logger logger = initLogger(); public static final Logger logger = initLogger();
public static final Config config = Config.loadConfig0(); public static final Config config = initConfig();
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();
private 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();
@@ -68,7 +71,8 @@ public class CustomSkinLoader {
THREAD_POOL.execute(runnable); THREAD_POOL.execute(runnable);
} }
public static void loadProfileLazily(GameProfile gameProfile, Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> consumer) { 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
@@ -190,13 +194,14 @@ 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);
//CustomSkinLoader needs username to load standard skin, if username not exist, only textures in NBT can be used //CustomSkinLoader needs username to load standard skin, if username not exist, only textures in NBT can be used
//Authlib 3.11.50 makes empty username to "\u0020" //Authlib 3.11.50 makes empty username to " "
if (username == null || username.isEmpty() || username.equals("\u0020") || credential == null) { if (username == null || username.isEmpty() || username.equals(" ") || credential == null) {
return dynamicSkullManager.getTexture(gameProfile); return dynamicSkullManager.getTexture(gameProfile);
} }
if (config.forceUpdateSkull ? profileCache.isReady(credential) : profileCache.isExist(credential)) { if (config.forceUpdateSkull ? profileCache.isReady(credential) : profileCache.isExist(credential)) {
@@ -221,13 +226,29 @@ public class CustomSkinLoader {
} }
private static Logger initLogger() { private static Logger initLogger() {
Logger logger = new Logger(LOG_FILE); LogManager.setLogFile(LOG_FILE.toPath());
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;
} }
/**
* Create <code>Config</code> object.
* To use <code>logger</code>, please make sure call this function after <code>initLogger</code>.
*
* @return <code>Config</code>
*/
private static Config initConfig() {
Config config = Config.loadConfig0();
logger.enableLogStdOut = config.enableLogStdOut;
return config;
}
} }
+5 -103
View File
@@ -1,106 +1,8 @@
package customskinloader; package customskinloader;
import java.io.BufferedWriter; /**
import java.io.File; * @deprecated From 14.16, use <code>customskinloader.log.Logger</code> instead.
import java.io.FileOutputStream; */
import java.io.OutputStreamWriter; @Deprecated
import java.io.PrintWriter; public class Logger extends customskinloader.log.Logger {
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@SuppressWarnings("ResultOfMethodCallIgnored")
public class Logger {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public enum Level{
DEBUG("DEBUG",false),
INFO("INFO",true),
WARNING("WARNING",true);
String name;
boolean display;
Level(String name,boolean display){
this.name=name;
this.display=display;
}
public String getName(){
return name;
}
public boolean display(){
return display;
}
}
private BufferedWriter writer=null;
public Logger(){
//Logger isn't created.
}
public Logger(String logFile) {
this(new File(logFile));
}
public Logger(File logFile){
try {
if(!logFile.getParentFile().exists()){
logFile.getParentFile().mkdirs();
}
if(!logFile.exists())
logFile.createNewFile();
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(logFile), "UTF-8"));
System.out.println("Log Path: " + logFile.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}
}
public void close(){
if(writer!=null){
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void log(Level level,String msg){
if(!level.display()&&writer==null)
return;
String sb = String.format("[%s %s] %s", Thread.currentThread().getName(), level.getName(), msg);
if(level.display())
System.out.println(sb);
if(writer==null)
return;
try {
String sb2 = String.format("[%s] %s\r\n", DATE_FORMAT.format(new Date()), sb);
writer.write(sb2);
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void debug(String msg){
log(Level.DEBUG,msg);
}
public void debug(String format, Object... objs) {
debug(String.format(format, objs));
}
public void info(String msg){
log(Level.INFO,msg);
}
public void info(String format, Object... objs){
info(String.format(format, objs));
}
public void warning(String msg){
log(Level.WARNING,msg);
}
public void warning(String format, Object... objs){
warning(String.format(format, objs));
}
public void warning(Throwable e){
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
log(Level.WARNING,"Exception: "+sw.toString());
}
} }
@@ -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;
@@ -26,21 +22,28 @@ public class Config {
public List<SkinSiteProfile> loadlist; public List<SkinSiteProfile> loadlist;
//Function //Function
public boolean enableDynamicSkull=true; public boolean enableDynamicSkull = true;
public boolean enableTransparentSkin=true; public boolean enableTransparentSkin = true;
public boolean forceIgnoreHttpsCertificate = false; public boolean forceIgnoreHttpsCertificate = false;
public boolean forceLoadAllTextures=false; public boolean forceLoadAllTextures = true;
public boolean enableCape = true; public boolean enableCape = true;
public int threadPoolSize = 3; public int threadPoolSize = 8;
public int retryTime = 1; /**
* Can logger write message to standard output(System.out).
* Because standard output won't write to latest.log after Forge 1.17,
* printing to standard output is meaningless,
* which makes this switch default value is <code>false</code>.
* @since 14.15
*/
public boolean enableLogStdOut = false;
//Profile Cache //Profile Cache
public int cacheExpiry=30; public int cacheExpiry = 30;
public boolean forceUpdateSkull = false; public boolean forceUpdateSkull = false;
public boolean enableLocalProfileCache=false; public boolean enableLocalProfileCache = false;
//Network Cache //Network Cache
public boolean enableCacheAutoClean=false; public boolean enableCacheAutoClean = false;
public boolean forceDisableCache = false; public boolean forceDisableCache = false;
// Used by Gson to create an instance with default value. // Used by Gson to create an instance with default value.
@@ -49,21 +52,21 @@ public class Config {
} }
//Init config //Init config
public Config(List<SkinSiteProfile> loadlist){ public Config(List<SkinSiteProfile> loadlist) {
this.version=CustomSkinLoader.CustomSkinLoader_VERSION; this.version = CustomSkinLoader.CustomSkinLoader_VERSION;
this.buildNumber=CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER; this.buildNumber = CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER;
this.loadlist=loadlist; this.loadlist = loadlist;
} }
public static Config loadConfig0() { public static Config loadConfig0() {
Config config=loadConfig(); Config config = loadConfig();
//LoadList null checker //LoadList null checker
if(config.loadlist==null){ if (config.loadlist == null) {
config.loadlist=new ArrayList<SkinSiteProfile>(); config.loadlist = new ArrayList<>();
}else{ } else {
for(int i=0;i<config.loadlist.size();i++){ for (int i = 0; i < config.loadlist.size(); i++) {
if(config.loadlist.get(i)==null) if (config.loadlist.get(i) == null)
config.loadlist.remove(i--); config.loadlist.remove(i--);
} }
} }
@@ -73,25 +76,25 @@ 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);
config.retryTime = Math.max(config.retryTime, 0); if (config.forceIgnoreHttpsCertificate)
if(config.forceIgnoreHttpsCertificate)
HttpUtil0.ignoreHttpsCertificate(); HttpUtil0.ignoreHttpsCertificate();
if(config.enableCacheAutoClean && !config.enableLocalProfileCache){ if (config.enableCacheAutoClean && !config.enableLocalProfileCache) {
try{ try {
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR); FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
FileUtils.deleteDirectory(HttpTextureUtil.getCacheDir()); FileUtils.deleteDirectory(HttpTextureUtil.getCacheDir());
CustomSkinLoader.logger.info("Successfully cleaned cache."); CustomSkinLoader.logger.info("Successfully cleaned cache.");
}catch(Exception e){ } catch (Exception e) {
CustomSkinLoader.logger.warning("Exception occurs while cleaning cache: "+e.toString()); CustomSkinLoader.logger.warning("Exception occurs while cleaning cache: " + e);
} }
} }
//Check config version //Check config version
Version configVersion = Version.of(config.version); Version configVersion = Version.of(config.version);
if (CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER == 0 // Custom builds if (CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER == 0 // Custom builds
|| configVersion.compareTo(CustomSkinLoader.CustomSkinLoader_VERSION) < 0 || configVersion.compareTo(CustomSkinLoader.CustomSkinLoader_VERSION) < 0
|| config.buildNumber < CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER) { || config.buildNumber < CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER) {
CustomSkinLoader.logger.info("Config File is out of date: " + config.version + ", build number: " + config.buildNumber); CustomSkinLoader.logger.info("Config File is out of date: " + config.version +
", build number: " + config.buildNumber);
config.version = CustomSkinLoader.CustomSkinLoader_VERSION; config.version = CustomSkinLoader.CustomSkinLoader_VERSION;
config.buildNumber = CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER; config.buildNumber = CustomSkinLoader.CustomSkinLoader_BUILD_NUMBER;
} }
@@ -102,51 +105,53 @@ public class Config {
try { try {
Object value = field.get(config); Object value = field.get(config);
CustomSkinLoader.logger.info(field.getName() + " : " + value); CustomSkinLoader.logger.info(field.getName() + " : " + value);
} catch (Exception ignored) { } } catch (Exception ignored) {
}
} }
return config; return config;
} }
private static Config loadConfig() { private static Config loadConfig() {
CustomSkinLoader.logger.info("Config File: "+CustomSkinLoader.CONFIG_FILE.getAbsolutePath()); CustomSkinLoader.logger.info("Config File: " + CustomSkinLoader.CONFIG_FILE.getAbsolutePath());
if(!CustomSkinLoader.CONFIG_FILE.exists()){ if (!CustomSkinLoader.CONFIG_FILE.exists()) {
CustomSkinLoader.logger.info("Config file not found, use default instead."); CustomSkinLoader.logger.info("Config file not found, use default instead.");
return initConfig(); return initConfig();
} }
try { try {
CustomSkinLoader.logger.info("Try to load config."); CustomSkinLoader.logger.info("Try to load config.");
String json=FileUtils.readFileToString(CustomSkinLoader.CONFIG_FILE, "UTF-8"); String json = FileUtils.readFileToString(CustomSkinLoader.CONFIG_FILE, "UTF-8");
Config config=Objects.requireNonNull(CustomSkinLoader.GSON.fromJson(json, Config.class)); Config config = Objects.requireNonNull(CustomSkinLoader.GSON.fromJson(json, Config.class));
CustomSkinLoader.logger.info("Successfully load config."); CustomSkinLoader.logger.info("Successfully load config.");
return config; return config;
}catch (Exception e) { } catch (Exception e) {
CustomSkinLoader.logger.info("Failed to load config, use default instead.("+e.toString()+")"); CustomSkinLoader.logger.info("Failed to load config, use default instead.(" + e + ")");
createBrokenFile(CustomSkinLoader.CONFIG_FILE); createBrokenFile(CustomSkinLoader.CONFIG_FILE);
return initConfig(); return initConfig();
} }
} }
private void loadExtraList(){ private void loadExtraList() {
File listAddition=new File(CustomSkinLoader.DATA_DIR,"ExtraList"); File listAddition = new File(CustomSkinLoader.DATA_DIR, "ExtraList");
if(!listAddition.isDirectory()){ if (!listAddition.isDirectory()) {
listAddition.mkdirs(); listAddition.mkdirs();
return; return;
} }
List<SkinSiteProfile> adds=new ArrayList<SkinSiteProfile>(); List<SkinSiteProfile> adds = new ArrayList<>();
File[] files=listAddition.listFiles(); File[] files = listAddition.listFiles();
for(File file: files != null ? files : new File[0]){ for (File file : files != null ? files : new File[0]) {
if(!file.getName().toLowerCase().endsWith(".json")&&!file.getName().toLowerCase().endsWith(".txt")) if (!file.getName().toLowerCase().endsWith(".json") && !file.getName().toLowerCase().endsWith(".txt"))
continue; continue;
try { try {
CustomSkinLoader.logger.info("Try to load Extra List.("+file.getName()+")"); CustomSkinLoader.logger.info("Try to load Extra List.(" + file.getName() + ")");
String json=FileUtils.readFileToString(file, "UTF-8"); String json = FileUtils.readFileToString(file, "UTF-8");
SkinSiteProfile ssp=CustomSkinLoader.GSON.fromJson(json, SkinSiteProfile.class); SkinSiteProfile ssp = CustomSkinLoader.GSON.fromJson(json, SkinSiteProfile.class);
CustomSkinLoader.logger.info("Successfully load Extra List."); CustomSkinLoader.logger.info("Successfully load Extra List.");
if (ssp.type != null) { if (ssp.type != null) {
ProfileLoader.IProfileLoader loader = ProfileLoader.LOADERS.get(ssp.type.toLowerCase()); ProfileLoader.IProfileLoader loader = ProfileLoader.LOADERS.get(ssp.type.toLowerCase());
if (loader == null) { if (loader == null) {
CustomSkinLoader.logger.info("Extra List will be ignored: Type '" + ssp.type + "' is not defined."); CustomSkinLoader.logger.info("Extra List will be ignored: Type '" + ssp.type +
"' is not defined.");
continue; continue;
} }
boolean duplicate = false; boolean duplicate = false;
@@ -166,36 +171,37 @@ public class Config {
} }
file.delete(); file.delete();
} else { } else {
CustomSkinLoader.logger.info("Extra List is invalid: Type is not defined.(" + file.getName() + ")"); CustomSkinLoader.logger.info("Extra List is invalid: Type is not defined.(" +
file.getName() + ")");
createBrokenFile(file); createBrokenFile(file);
} }
}catch (Exception e) { } catch (Exception e) {
CustomSkinLoader.logger.info("Failed to load Extra List.("+e.toString()+")"); CustomSkinLoader.logger.info("Failed to load Extra List.(" + e + ")");
createBrokenFile(file); createBrokenFile(file);
} }
} }
if(adds.size()!=0){ if (adds.size() != 0) {
adds.addAll(this.loadlist); adds.addAll(this.loadlist);
this.loadlist=adds; this.loadlist = adds;
} }
} }
private void updateLoadlist() { private void updateLoadlist() {
PluginLoader.PLUGINS.stream() PluginLoader.PLUGINS.stream()
.map(ICustomSkinLoaderPlugin::getDefaultProfiles) .map(ICustomSkinLoaderPlugin::getDefaultProfiles)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.flatMap(Collection::stream) .flatMap(Collection::stream)
.forEach(profile -> this.loadlist.stream() .forEach(profile -> this.loadlist.stream()
.filter(ssp -> profile.getName().equals(ssp.name)) .filter(ssp -> profile.getName().equals(ssp.name))
.forEach(profile::updateSkinSiteProfile)); .forEach(profile::updateSkinSiteProfile));
} }
private void initLocalFolder(){ private void initLocalFolder() {
for(SkinSiteProfile ssp:this.loadlist){ for (SkinSiteProfile ssp : this.loadlist) {
if(ssp.type==null) if (ssp.type == null)
continue; continue;
ProfileLoader.IProfileLoader loader=ProfileLoader.LOADERS.get(ssp.type.toLowerCase()); ProfileLoader.IProfileLoader loader = ProfileLoader.LOADERS.get(ssp.type.toLowerCase());
if(loader==null) if (loader == null)
continue; continue;
loader.init(ssp); loader.init(ssp);
} }
@@ -237,16 +243,17 @@ public class Config {
writeConfig(config, false); writeConfig(config, false);
return config; return config;
} }
private static void writeConfig(Config config, boolean update){
String json=CustomSkinLoader.GSON.toJson(config); private static void writeConfig(Config config, boolean update) {
if(CustomSkinLoader.CONFIG_FILE.exists()) String json = CustomSkinLoader.GSON.toJson(config);
if (CustomSkinLoader.CONFIG_FILE.exists())
CustomSkinLoader.CONFIG_FILE.delete(); CustomSkinLoader.CONFIG_FILE.delete();
try { try {
CustomSkinLoader.CONFIG_FILE.createNewFile(); CustomSkinLoader.CONFIG_FILE.createNewFile();
FileUtils.write(CustomSkinLoader.CONFIG_FILE, json, "UTF-8"); FileUtils.write(CustomSkinLoader.CONFIG_FILE, json, "UTF-8");
CustomSkinLoader.logger.info("Successfully "+(update?"update":"create")+" config."); CustomSkinLoader.logger.info("Successfully " + (update ? "update" : "create") + " config.");
} catch (Exception e) { } catch (Exception e) {
CustomSkinLoader.logger.info("Failed to "+(update?"update":"create")+" config.("+e.toString()+")"); CustomSkinLoader.logger.info("Failed to " + (update ? "update" : "create") + " config.(" + e + ")");
} }
} }
} }
@@ -30,14 +30,15 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
image = resetImageFormat(image, 22, 0, 46, 22); image = resetImageFormat(image, 22, 0, 46, 22);
return image; return image;
} }
} catch (IOException | NoSuchElementException ignored) { } } catch (IOException | NoSuchElementException ignored) {
}
return null; return null;
} }
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 ResourceLocation location; private final ResourceLocation location;
private String type = null; private String type = null;
public FakeCapeBuffer(ResourceLocation location) { public FakeCapeBuffer(ResourceLocation location) {
@@ -47,11 +48,19 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
@Override @Override
public FakeImage parseUserSkin(FakeImage image) { public FakeImage parseUserSkin(FakeImage image) {
if (image == null) return null; if (image == null) return null;
this.image = image; if (isOptiFineCape(image)) {
//OptiFine cape should be converted to standard cape
this.image = convertOptiFineCape(image);
//OptiFine cape contains elytra texture
//this.type = "elytra";//But its elytra texture doesn't work
} else {
this.image = image;
}
// When resource packs were changed, the elytra image needs to be reloaded, and here will be entered again // When resource packs were changed, the elytra image needs to be reloaded, and here will be entered again
// The first cape which find elytra texture is outdated will reload it
if (this.loaded == loadedGlobal) { if (this.loaded == loadedGlobal) {
elytraImage = loadElytra(image); elytraImage = loadElytra(this.image);
} }
this.loaded = loadedGlobal; this.loaded = loadedGlobal;
if (elytraImage != null) { if (elytraImage != null) {
@@ -126,15 +135,16 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
/** /**
* Traverse every elytra pixel * Traverse every elytra pixel
* @param predicate the predicate with x and y *
* @param returnValue if the condition flag equals the condition, then return this value * @param predicate the predicate with x and y
* @param returnValue if the condition flag equals the condition, then return this value
* @param defaultReturnValue otherwise return this value * @param defaultReturnValue otherwise return this value
*/ */
private <R> R withElytraPixels(BiPredicate<Integer, Integer> predicate, R returnValue, R defaultReturnValue) { private <R> R withElytraPixels(BiPredicate<Integer, Integer> predicate, R returnValue, R defaultReturnValue) {
int startX = (int) Math.ceil(22 * ratioX), endX = (int) Math.ceil(46 * ratioX); int startX = (int) Math.ceil(22 * ratioX), endX = (int) Math.ceil(46 * ratioX);
int startY = (int) Math.ceil(0 * ratioY), endY = (int) Math.ceil(22 * ratioY); int startY = (int) Math.ceil(0 * ratioY), endY = (int) Math.ceil(22 * ratioY);
int excludeX0 = (int) Math.ceil(24 * ratioX), excludeX1 = (int) Math.ceil(44 * ratioX); int excludeX0 = (int) Math.ceil(24 * ratioX), excludeX1 = (int) Math.ceil(44 * ratioX);
int excludeY = (int) Math.ceil(2 * ratioY); int excludeY = (int) Math.ceil(2 * ratioY);
for (int x = startX; x < endX; ++x) { for (int x = startX; x < endX; ++x) {
for (int y = startY; y < endY; ++y) { for (int y = startY; y < endY; ++y) {
if (y < excludeY && (x < excludeX0 || x >= excludeX1)) continue; if (y < excludeY && (x < excludeX0 || x >= excludeX1)) continue;
@@ -167,24 +177,27 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
/** /**
* Scale image * Scale image
* @param image the image to scale. *
* @param image the image to scale.
* @param closeOldImage whether close old image * @param closeOldImage whether close old image
* @param scaleWidth width enlargement ratio * @param scaleWidth width enlargement ratio
* @param scaleHeight height enlargement ratio * @param scaleHeight height enlargement ratio
* @param ratioX the ratio of 64 of the old image width * @param ratioX the ratio of 64 of the old image width
* @param ratioY the ratio of 32 of the old image height * @param ratioY the ratio of 32 of the old image height
* @param width the width after scaling. * @param width the width after scaling.
* @param height the height after scaling. * @param height the height after scaling.
* @param startX the x where start to copy. * @param startX the x where start to copy.
* @param startY the y where start to copy. * @param startY the y where start to copy.
* @param endX the x where end to copy. * @param endX the x where end to copy.
* @param endY the y where end to copy. * @param endY the y where end to copy.
* @return the image after scaling. * @return the image after scaling.
*/ */
private static FakeImage scaleImage(FakeImage image, boolean closeOldImage, double scaleWidth, double scaleHeight, double ratioX, double ratioY, int width, int height, int startX, int startY, int endX, int endY) { private static FakeImage scaleImage(FakeImage image, boolean closeOldImage, double scaleWidth, double scaleHeight, double ratioX, double ratioY, int width, int height, int startX, int startY, int endX, int endY) {
FakeImage newImage = image.createImage(width, height); FakeImage newImage = image.createImage(width, height);
startX = (int) (startX * ratioX); endX = (int) (endX * ratioX); startX = (int) (startX * ratioX);
startY = (int) (startY * ratioY); endY = (int) (endY * ratioY); endX = (int) (endX * ratioX);
startY = (int) (startY * ratioY);
endY = (int) (endY * ratioY);
int x0 = (int) (startX * scaleWidth), x1 = (int) ((startX + 1) * scaleWidth), dx0 = x1 - x0; int x0 = (int) (startX * scaleWidth), x1 = (int) ((startX + 1) * scaleWidth), dx0 = x1 - x0;
for (int x = startX; x < endX; ++x) { for (int x = startX; x < endX; ++x) {
@@ -196,12 +209,61 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
newImage.setRGBA(x0 + dx, y0 + dy, rgba); newImage.setRGBA(x0 + dx, y0 + dy, rgba);
} }
} }
y0 = y1; y1 = (int) ((y + 2) * scaleHeight); dy0 = y1 - y0; y0 = y1;
y1 = (int) ((y + 2) * scaleHeight);
dy0 = y1 - y0;
} }
x0 = x1; x1 = (int) ((x + 2) * scaleWidth); dx0 = x1 - x0; x0 = x1;
x1 = (int) ((x + 2) * scaleWidth);
dx0 = x1 - x0;
} }
if (closeOldImage) if (closeOldImage)
image.close(); image.close();
return newImage; return newImage;
} }
/**
* Judge OptiFine cape.
* OptiFine cape is 46*22 or 92*44 pixels.
* <a href="https://optifine.net/capes/Notch.png">46*22 example</a>
* <a href="https://optifine.net/capes/OptiFineCape.png">92*44 example</a>
*
* @param image cape image
* @return true if is OptiFine cape
* @since 14.16
*/
private static boolean isOptiFineCape(FakeImage image) {
int ratio = image.getWidth() / 46;
return image.getHeight() == 22 * ratio && image.getWidth() == 46 * ratio;
}
/**
* Convert OptiFine cape to standard cape
*
* @param image OptiFine cape image
* @return standard cape image
* @since 14.16
*/
private static FakeImage convertOptiFineCape(FakeImage image) {
int ratio = image.getWidth() / 46;
FakeImage newImage = image.createImage(64 * ratio, 32 * ratio);
copyImageData(image, newImage);
return newImage;
}
/**
* Copy image data to another image
*
* @param from from image
* @param to to image
*/
private static void copyImageData(FakeImage from, FakeImage to) {
int width = Math.min(from.getWidth(), to.getWidth());
int height = Math.min(from.getHeight(), to.getHeight());
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
to.setRGBA(x, y, from.getRGBA(x, y));
}
}
}
} }
@@ -21,6 +21,16 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
public class FakeClientPlayer { public class FakeClientPlayer {
/**
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
*/
public static ThreadDownloadImageData putCache(ThreadDownloadImageData threaddownloadimagedata, SkinManager.SkinAvailableCallback skinAvailableCallback, ResourceLocation resourcelocation) {
if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer) {//Cache for client player
textureCache.put(resourcelocation, threaddownloadimagedata);
}
return threaddownloadimagedata;
}
//For Legacy Skin //For Legacy Skin
public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation resourceLocationIn, String username) { public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation resourceLocationIn, String username) {
//CustomSkinLoader.logger.debug("FakeClientPlayer/getDownloadImageSkin "+username); //CustomSkinLoader.logger.debug("FakeClientPlayer/getDownloadImageSkin "+username);
@@ -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;
}
}
@@ -4,22 +4,22 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.hash.Hashing; import com.google.common.collect.Multimap;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.fake.itf.FakeInterfaceManager;
import customskinloader.utils.HttpTextureUtil; import customskinloader.utils.HttpTextureUtil;
import net.minecraft.client.Minecraft; import customskinloader.utils.MinecraftUtil;
import net.minecraft.client.renderer.IImageBuffer; import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager;
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class FakeSkinManager { public class FakeSkinManager {
@@ -32,59 +32,87 @@ public class FakeSkinManager {
HttpTextureUtil.defaultCacheDir = skinCacheDirectory; HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
} }
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { /**
return this.loadSkin(profileTexture, textureType, null); * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
} */
public static ResourceLocation setResourceLocation(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) { if (profileTexture instanceof FakeMinecraftProfileTexture) {
return this.loadSkin(profileTexture, HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl()), textureType, skinAvailableCallback); ((FakeMinecraftProfileTexture) profileTexture).setResourceLocation(resourceLocation);
}
private ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final HttpTextureUtil.HttpTextureInfo info, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) {
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + Hashing.sha1().hashUnencodedChars(info.hash).toString());
if (FakeInterfaceManager.TextureManager_getTexture(this.textureManager, resourcelocation, null) != null) {//Have already loaded
makeCallback(skinAvailableCallback, textureType, resourcelocation, modelCache.getOrDefault(resourcelocation, profileTexture));
} else {
SimpleTexture threaddownloadimagedata = FakeThreadDownloadImageData.createThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture), textureType);
if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer)//Cache for client player
FakeClientPlayer.textureCache.put(resourcelocation, threaddownloadimagedata);
FakeInterfaceManager.TextureManager_loadTexture(this.textureManager, resourcelocation, threaddownloadimagedata);
} }
return resourcelocation; return resourceLocation;
} }
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { /**
CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, m -> { * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
final Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap(); * <p>
map.putAll(m); * {@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);
}
for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) { /**
MinecraftProfileTexture profileTexture = map.get(type); * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
if (profileTexture != null) { */
HttpTextureUtil.HttpTextureInfo info = HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl()); public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, FakeSkinManager fakeManager, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
FakeThreadDownloadImageData.downloadTexture(info.cacheFile, info.url); Object[] params = list.toArray();
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) {
FakeInterfaceManager.Minecraft_addScheduledTask(Minecraft.getMinecraft(), () -> { FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
CustomSkinLoader.logger.debug("Loading type: " + type); ResourceLocation resourcelocation = fakeProfileTexture.getResourceLocation();
try { if (fakeProfileTexture.getResourceLocation() != null) {
this.loadSkin(profileTexture, info, type, skinAvailableCallback); params[0] = fakeProfileTexture.getCacheFile();
} catch (Throwable t) { if (params[params.length - 2] instanceof Boolean) {
CustomSkinLoader.logger.warning(t); 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) { public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = CustomSkinLoader.loadProfileFromCache(profile); Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = CustomSkinLoader.loadProfileFromCache(profile);
for (Iterator<Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture>> it = map.entrySet().iterator(); it.hasNext(); ) { for (Iterator<Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture>> it = map.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture> entry = it.next(); Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture> entry = it.next();
MinecraftProfileTexture texture = entry.getValue(); MinecraftProfileTexture texture = entry.getValue();
if (shouldJudgeType(texture)) { if (shouldJudgeType(texture)) {
texture = this.modelCache.get(this.loadSkin(texture, entry.getKey())); texture = this.modelCache.get(MinecraftUtil.getSkinManager().loadSkin(texture, entry.getKey()));
if (texture == null) { // remove texture if was not loaded before if (texture == null) { // remove texture if was not loaded before
it.remove(); it.remove();
} else { } else {
@@ -110,9 +138,9 @@ public class FakeSkinManager {
private SkinManager.SkinAvailableCallback callback; private SkinManager.SkinAvailableCallback callback;
private MinecraftProfileTexture.Type type; private MinecraftProfileTexture.Type type;
private ResourceLocation location; private ResourceLocation location;
private MinecraftProfileTexture texture; private FakeMinecraftProfileTexture texture;
public BaseBuffer(SkinManager.SkinAvailableCallback callback, MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture texture) { public BaseBuffer(SkinManager.SkinAvailableCallback callback, MinecraftProfileTexture.Type type, ResourceLocation location, FakeMinecraftProfileTexture texture) {
switch (type) { switch (type) {
case SKIN: this.buffer = new FakeSkinBuffer(); break; case SKIN: this.buffer = new FakeSkinBuffer(); break;
case CAPE: this.buffer = new FakeCapeBuffer(location); break; case CAPE: this.buffer = new FakeCapeBuffer(location); break;
@@ -140,7 +168,7 @@ public class FakeSkinManager {
Map<String, String> metadata = Maps.newHashMap(); Map<String, String> metadata = Maps.newHashMap();
String type = ((FakeSkinBuffer) buffer).judgeType(); String type = ((FakeSkinBuffer) buffer).judgeType();
metadata.put("model", type); metadata.put("model", type);
texture = new MinecraftProfileTexture(texture.getUrl(), metadata); texture = new FakeMinecraftProfileTexture(texture.getRawUrl(), metadata);
FakeSkinManager.this.modelCache.put(location, texture); FakeSkinManager.this.modelCache.put(location, texture);
} }
} }
@@ -1,101 +0,0 @@
package customskinloader.fake;
import java.io.File;
import java.util.EnumMap;
import java.util.function.Supplier;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.CustomSkinLoader;
import customskinloader.utils.HttpRequestUtil;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.DownloadingTexture;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.util.ResourceLocation;
public class FakeThreadDownloadImageData {
private static IThreadDownloadImageDataBuilder builder;
public static SimpleTexture createThreadDownloadImageData(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocationIn, IImageBuffer imageBufferIn, MinecraftProfileTexture.Type textureTypeIn) {
SimpleTexture texture = null;
if (FakeThreadDownloadImageData.builder == null) {
EnumMap<ThreadDownloadImageDataBuilder, Throwable> throwables = new EnumMap<>(ThreadDownloadImageDataBuilder.class);
for (ThreadDownloadImageDataBuilder builder : ThreadDownloadImageDataBuilder.values()) {
try {
FakeThreadDownloadImageData.builder = builder.get().get();
texture = FakeThreadDownloadImageData.builder.build(cacheFileIn, imageUrlIn, textureResourceLocationIn, imageBufferIn, textureTypeIn);
CustomSkinLoader.logger.info("ThreadDownloadImageData Class: %s", texture.getClass().getName());
break;
} catch (Throwable t) {
throwables.put(builder, t);
}
}
if (texture == null) {
CustomSkinLoader.logger.warning("Unable to get ThreadDownloadImageData Class: ");
throwables.forEach((k, v) -> {
CustomSkinLoader.logger.warning("Caused by: (%s)", k.name());
CustomSkinLoader.logger.warning(v);
});
throw new RuntimeException("Unable to get ThreadDownloadImageData Class!");
}
} else {
texture = builder.build(cacheFileIn, imageUrlIn, textureResourceLocationIn, imageBufferIn, textureTypeIn);
}
return texture;
}
public static void downloadTexture(File cacheFile, String imageUrl) {
HttpRequestUtil.HttpRequest request = new HttpRequestUtil.HttpRequest(imageUrl).setLoadContent(false).setCacheTime(0).setCacheFile(cacheFile);
for (int i = 0; i <= CustomSkinLoader.config.retryTime; i++) {
if (i != 0) {
CustomSkinLoader.logger.debug("Retry to download texture %s (%s)", imageUrl, i);
}
if (HttpRequestUtil.makeHttpRequest(request).success) {
break;
}
}
}
private interface IThreadDownloadImageDataBuilder {
SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType);
}
private enum ThreadDownloadImageDataBuilder {
// DO NOT replace new IThreadDownloadImageDataBuilder() with lambda.
V1(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.8.x~1.12.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new ThreadDownloadImageData(cacheFile, imageUrl, textureResourceLocation, imageBuffer);
}
}),
V2(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.13.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new net.minecraft.client.renderer.texture.ThreadDownloadImageData(cacheFile, imageUrl, textureResourceLocation, imageBuffer);
}
}),
V3(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.14.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new DownloadingTexture(cacheFile, imageUrl, textureResourceLocation, imageBuffer);
}
}),
V4(() -> new IThreadDownloadImageDataBuilder() { // Forge 1.15.x~1.16.x
@Override
public SimpleTexture build(File cacheFile, String imageUrl, ResourceLocation textureResourceLocation, IImageBuffer imageBuffer, MinecraftProfileTexture.Type textureType) {
return new DownloadingTexture(cacheFile, imageUrl, textureResourceLocation, true, imageBuffer);
}
});
private final Supplier<IThreadDownloadImageDataBuilder> builder;
ThreadDownloadImageDataBuilder(Supplier<IThreadDownloadImageDataBuilder> builder) {
this.builder = builder;
}
public Supplier<IThreadDownloadImageDataBuilder> get() {
return this.builder;
}
}
}
@@ -6,8 +6,6 @@ import java.io.InputStream;
import java.util.Optional; import java.util.Optional;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.Texture;
import net.minecraft.client.renderer.texture.TextureManager;
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;
@@ -25,18 +23,6 @@ public class FakeInterfaceManager {
return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G(); return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G();
} }
public static void Minecraft_addScheduledTask(Minecraft minecraft, Runnable runnable) {
((IFakeMinecraft) minecraft).execute(runnable);
}
public static void TextureManager_loadTexture(TextureManager textureManager, ResourceLocation textureLocation, Object textureObj) {
((IFakeTextureManager.V2) textureManager).func_229263_a_(textureLocation, (Texture) textureObj);
}
public static Texture TextureManager_getTexture(TextureManager textureManager, ResourceLocation textureLocation, Object textureObj) {
return ((IFakeTextureManager.V1) textureManager).getTexture(textureLocation, (Texture) textureObj);
}
public static void ThreadDownloadImageData_resetNewBufferedImage(Object threadDownloadImageData, BufferedImage image) { public static void ThreadDownloadImageData_resetNewBufferedImage(Object threadDownloadImageData, BufferedImage image) {
((IFakeThreadDownloadImageData) threadDownloadImageData).resetNewBufferedImage(image); ((IFakeThreadDownloadImageData) threadDownloadImageData).resetNewBufferedImage(image);
} }
@@ -8,9 +8,4 @@ public interface IFakeMinecraft {
default IResourceManager func_195551_G() { default IResourceManager func_195551_G() {
return (IResourceManager) ((Minecraft) this).getResourceManager(); return (IResourceManager) ((Minecraft) this).getResourceManager();
} }
// 1.14+
default void execute(Runnable runnable) {
((Minecraft) this).addScheduledTask(runnable);
}
} }
@@ -1,28 +0,0 @@
package customskinloader.fake.itf;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.Texture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
public interface IFakeTextureManager {
interface V1 {
default boolean func_229263_a_(ResourceLocation textureLocation, Texture textureObj) {
return ((TextureManager) this).loadTexture(textureLocation, (ITextureObject) textureObj);
}
default Texture func_229267_b_(ResourceLocation textureLocation) {
return (Texture) ((TextureManager) this).getTexture(textureLocation);
}
default Texture getTexture(ResourceLocation textureLocation, Texture textureObj) {
return func_229267_b_(textureLocation);
}
}
interface V2 {
default void func_229263_a_(ResourceLocation textureLocation, Texture textureObj) {
((IFakeTextureManager.V1) this).func_229263_a_(textureLocation, textureObj);
}
}
}
@@ -22,7 +22,21 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
String toJsonUrl(String root, String username); String toJsonUrl(String root, String username);
String getPayload(SkinSiteProfile ssp); default String getPayload(SkinSiteProfile ssp) {
return null;
}
/**
* get JSON API payload, which will make a POST request
*
* @param ssp skin site profile
* @param username username
* @return JSON payload
* @since 14.16
*/
default String getPayload(SkinSiteProfile ssp, String username) {
return getPayload(ssp);
}
UserProfile toUserProfile(String root, String json, boolean local); UserProfile toUserProfile(String root, String json, boolean local);
@@ -93,8 +107,15 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
} }
json = IOUtils.toString(Files.newInputStream(jsonFile.toPath()), StandardCharsets.UTF_8); json = IOUtils.toString(Files.newInputStream(jsonFile.toPath()), StandardCharsets.UTF_8);
} else { } else {
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(jsonUrl).setCacheTime(90).setUserAgent(ssp.userAgent).setPayload(this.jsonAPI.getPayload(ssp))); try {
json = responce.content; HttpRequestUtil.HttpResponce responce = HttpRequestUtil
.makeHttpRequest(new HttpRequestUtil.HttpRequest(jsonUrl).setCacheTime(90)
.setUserAgent(ssp.userAgent).setPayload(this.jsonAPI.getPayload(ssp, username)));
json = responce.content;
} catch (ProfileNotFoundException ignored) {
CustomSkinLoader.logger.info("Profile not found.");
return null;
}
} }
if (json == null || json.equals("")) { if (json == null || json.equals("")) {
CustomSkinLoader.logger.info("Profile not found."); CustomSkinLoader.logger.info("Profile not found.");
@@ -135,4 +156,11 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
f.mkdirs(); f.mkdirs();
} }
} }
/**
* When getting payload, this exception can end skin loading
* @since 14.16
*/
public static class ProfileNotFoundException extends RuntimeException {
}
} }
@@ -1,11 +1,11 @@
package customskinloader.loader; package customskinloader.loader;
import java.io.File; import java.io.File;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile; import customskinloader.config.SkinSiteProfile;
@@ -24,7 +24,12 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
@Override @Override
public List<IDefaultProfile> getDefaultProfiles() { public List<IDefaultProfile> getDefaultProfiles() {
return Collections.singletonList(new LocalSkin(this)); return Lists.newArrayList(new LocalSkin(this),
getCapeProfile(this, "OptiFine", "https://optifine.net/capes/{USERNAME}.png", 810),
getCapeProfile(this, "CloakPlus", "http://161.35.130.99/capes/{USERNAME}.png", 840),
getCapeProfile(this, "LabyMod", "https://dl.labymod.net/capes/{STANDARD_UUID}", 850),
getCapeProfile(this, "Cosmetica", "https://api.cosmetica.cc/get/cloak?username={USERNAME}&uuid={STANDARD_UUID}&nothirdparty", 860)
);
} }
public abstract static class DefaultProfile implements ICustomSkinLoaderPlugin.IDefaultProfile { public abstract static class DefaultProfile implements ICustomSkinLoaderPlugin.IDefaultProfile {
@@ -75,7 +80,7 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
@Override @Override
public int getPriority() { public int getPriority() {
return 600; return 710;
} }
@Override @Override
@@ -94,18 +99,48 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
} }
} }
// // Minecrack could not load skin correctly /**
// public static class Minecrack extends LegacyLoader.DefaultProfile { * Get cape Profile¬
// public Minecrack(LegacyLoader loader) { super(loader); } *
// @Override public String getName() { return "Minecrack"; } * @since 14.16
// @Override public int getPriority() { return 600; } */
// @Override public String getSkinRoot() { return "http://minecrack.fr.nf/mc/skinsminecrackd/{USERNAME}.png"; } public static LegacyLoader.DefaultProfile getCapeProfile(LegacyLoader loader, String name, String capeRoot, int priority) {
// @Override public String getCapeRoot() { return "http://minecrack.fr.nf/mc/cloaksminecrackd/{USERNAME}.png"; } return new DefaultProfile(loader) {
// @Override public String getElytraRoot() { return null; } @Override
// } public String getSkinRoot() {
return null;
}
@Override
public String getCapeRoot() {
return capeRoot;
}
@Override
public String getElytraRoot() {
return null;
}
@Override
public String getName() {
return name;
}
@Override
public int getPriority() {
return priority;
}
};
}
public static final String USERNAME_PLACEHOLDER = "{USERNAME}"; public static final String USERNAME_PLACEHOLDER = "{USERNAME}";
public static final String UUID_PLACEHOLDER = "{UUID}"; public static final String UUID_PLACEHOLDER = "{UUID}";
/**
* Mojang UUID with -
*
* @since 14.16
*/
public static final String STANDARD_UUID_PLACEHOLDER = "{STANDARD_UUID}";
@Override @Override
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) { public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) {
@@ -187,14 +222,15 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
private String expandURL(String url, String username) { private String expandURL(String url, String username) {
String t = url.replace(USERNAME_PLACEHOLDER, username); String t = url.replace(USERNAME_PLACEHOLDER, username);
if (!t.contains(UUID_PLACEHOLDER)) { if (!t.contains(UUID_PLACEHOLDER) && !t.contains(STANDARD_UUID_PLACEHOLDER)) {
return t; return t;
} }
String uuid = MojangAPILoader.getMojangUuidByUsername(username); String uuid = MojangAPILoader.getMojangUuidByUsername(username, true);
//If Mojang uuid not found, won't load the texture //If Mojang uuid not found, won't load the texture
if (uuid == null) { if (uuid == null) {
return null; return null;
} }
return t.replace(UUID_PLACEHOLDER, uuid); String styledUuid = uuid.replace("-", "");
return t.replace(UUID_PLACEHOLDER, styledUuid).replace(STANDARD_UUID_PLACEHOLDER, uuid);
} }
} }
@@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -24,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 org.apache.commons.codec.Charsets;
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;
@@ -93,7 +93,7 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
return ModelManager0.toUserProfile(map); return ModelManager0.toUserProfile(map);
} }
String username = gameProfile.getName(); String username = gameProfile.getName();
GameProfile newGameProfile = loadGameProfile(ssp.apiRoot, username); GameProfile newGameProfile = loadGameProfileCached(ssp.apiRoot, username);
if (newGameProfile == null) { if (newGameProfile == null) {
CustomSkinLoader.logger.info("Profile not found.(" + username + "'s profile not found.)"); CustomSkinLoader.logger.info("Profile not found.(" + username + "'s profile not found.)");
return null; return null;
@@ -108,6 +108,13 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
return null; return null;
} }
private static final Map<String, GameProfile> gameProfileCache = new ConcurrentHashMap<>();
public static GameProfile loadGameProfileCached(String apiRoot, String 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)
@@ -137,14 +144,16 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
* Get Mojang UUID by username. * Get Mojang UUID by username.
* *
* @param username username to query * @param username username to query
* @param standard if - in UUID
* @return UUID in Mojang API style string. Returns {@code null} if username not found in Mojang API. * @return UUID in Mojang API style string. Returns {@code null} if username not found in Mojang API.
*/ */
public static String getMojangUuidByUsername(String username) { public static String getMojangUuidByUsername(String username, boolean standard) {
GameProfile profile = loadGameProfile(getMojangApiRoot(), username); GameProfile profile = loadGameProfileCached(getMojangApiRoot(), username);
if (profile == null) { if (profile == null) {
return null; return null;
} }
return UUIDTypeAdapter.fromUUID(profile.getId()); UUID id = profile.getId();
return standard ? id.toString() : UUIDTypeAdapter.fromUUID(id);
} }
//UUID -> Profile //UUID -> Profile
@@ -6,7 +6,6 @@ import java.util.Map;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader; import customskinloader.loader.JsonAPILoader;
import customskinloader.plugin.ICustomSkinLoaderPlugin; import customskinloader.plugin.ICustomSkinLoaderPlugin;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
@@ -17,17 +16,45 @@ import org.apache.commons.lang3.StringUtils;
public class CustomSkinAPI implements JsonAPILoader.IJsonAPI { public class CustomSkinAPI implements JsonAPILoader.IJsonAPI {
public static class LittleSkin extends JsonAPILoader.DefaultProfile { public static class LittleSkin extends JsonAPILoader.DefaultProfile {
public LittleSkin(JsonAPILoader loader) { super(loader); } public LittleSkin(JsonAPILoader loader) {
@Override public String getName() { return "LittleSkin"; } super(loader);
@Override public int getPriority() { return 200; } }
@Override public String getRoot() { return "https://littleskin.cn/csl/"; }
@Override
public String getName() {
return "LittleSkin";
}
@Override
public int getPriority() {
return 200;
}
@Override
public String getRoot() {
return "https://littleskin.cn/csl/";
}
} }
public static class BlessingSkin extends JsonAPILoader.DefaultProfile { public static class BlessingSkin extends JsonAPILoader.DefaultProfile {
public BlessingSkin(JsonAPILoader loader) { super(loader); } public BlessingSkin(JsonAPILoader loader) {
@Override public String getName() { return "BlessingSkin"; } super(loader);
@Override public int getPriority() { return 300; } }
@Override public String getRoot() { return "https://skin.prinzeugen.net/"; }
@Override
public String getName() {
return "BlessingSkin";
}
@Override
public int getPriority() {
return 300;
}
@Override
public String getRoot() {
return "https://skin.prinzeugen.net/";
}
} }
// // OneSkin has been removed temporarily // // OneSkin has been removed temporarily
@@ -38,8 +65,8 @@ public class CustomSkinAPI implements JsonAPILoader.IJsonAPI {
// @Override public String getRoot() { return "http://fleey.cn/skin/skin_user/skin_json.php/"; } // @Override public String getRoot() { return "http://fleey.cn/skin/skin_user/skin_json.php/"; }
// } // }
private static final String TEXTURES="textures/"; private static final String TEXTURES = "textures/";
private static final String SUFFIX=".json"; private static final String SUFFIX = ".json";
@Override @Override
public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) { public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) {
@@ -53,65 +80,63 @@ public class CustomSkinAPI implements JsonAPILoader.IJsonAPI {
@Override @Override
public UserProfile toUserProfile(String root, String json, boolean local) { public UserProfile toUserProfile(String root, String json, boolean local) {
CustomSkinAPIProfile profile=CustomSkinLoader.GSON.fromJson(json, CustomSkinAPIProfile.class); CustomSkinAPIProfile profile = CustomSkinLoader.GSON.fromJson(json, CustomSkinAPIProfile.class);
UserProfile p=new UserProfile(); UserProfile p = new UserProfile();
if(StringUtils.isNotBlank(profile.skin)){ if (StringUtils.isNotBlank(profile.skin)) {
p.skinUrl=root+TEXTURES+profile.skin; p.skinUrl = root + TEXTURES + profile.skin;
if(local) if (local)
p.skinUrl=HttpTextureUtil.getLocalFakeUrl(p.skinUrl); p.skinUrl = HttpTextureUtil.getLocalFakeUrl(p.skinUrl);
} }
if(StringUtils.isNotBlank(profile.cape)){ if (StringUtils.isNotBlank(profile.cape)) {
p.capeUrl=root+TEXTURES+profile.cape; p.capeUrl = root + TEXTURES + profile.cape;
if(local) if (local)
p.capeUrl=HttpTextureUtil.getLocalFakeUrl(p.capeUrl); p.capeUrl = HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
} }
if(StringUtils.isNotBlank(profile.elytra)){ if (StringUtils.isNotBlank(profile.elytra)) {
p.elytraUrl=root+TEXTURES+profile.elytra; p.elytraUrl = root + TEXTURES + profile.elytra;
if(local) if (local)
p.elytraUrl=HttpTextureUtil.getLocalFakeUrl(p.elytraUrl); p.elytraUrl = HttpTextureUtil.getLocalFakeUrl(p.elytraUrl);
} }
Map<String,String> textures=new LinkedHashMap<>(); Map<String, String> textures = new LinkedHashMap<>();
if(profile.skins!=null) if (profile.skins != null)
textures.putAll(profile.skins); textures.putAll(profile.skins);
if(profile.textures!=null) if (profile.textures != null)
textures.putAll(profile.textures); textures.putAll(profile.textures);
if(textures.isEmpty()) if (textures.isEmpty())
return p; return p;
boolean hasSkin=false; boolean hasSkin = false;
for(String model:textures.keySet()){ for (String model : textures.keySet()) {
ModelManager0.Model enumModel=ModelManager0.getEnumModel(model); ModelManager0.Model enumModel = ModelManager0.getEnumModel(model);
if(enumModel==null||StringUtils.isEmpty(textures.get(model))) if (enumModel == null || StringUtils.isEmpty(textures.get(model)))
continue; continue;
if(ModelManager0.isSkin(enumModel)) if (ModelManager0.isSkin(enumModel))
if(hasSkin) if (hasSkin)
continue; continue;
else else
hasSkin=true; hasSkin = true;
String url=root+TEXTURES+textures.get(model); String url = root + TEXTURES + textures.get(model);
if(local) if (local)
url=HttpTextureUtil.getLocalFakeUrl(url); url = HttpTextureUtil.getLocalFakeUrl(url);
p.put(enumModel, url); p.put(enumModel, url);
} }
return p; return p;
} }
private static class CustomSkinAPIProfile{
public String username;
public LinkedHashMap<String,String> textures;
public LinkedHashMap<String,String> skins; private static class CustomSkinAPIProfile {
public String username;
public LinkedHashMap<String, String> textures;
public LinkedHashMap<String, String> skins;
public String skin; public String skin;
public String cape; public String cape;
public String elytra; public String elytra;
} }
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override @Override
public String getName() { public String getName() {
return "CustomSkinAPI"; return "CustomSkinAPI";
@@ -7,7 +7,6 @@ import com.google.common.collect.Lists;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader; import customskinloader.loader.JsonAPILoader;
import customskinloader.plugin.ICustomSkinLoaderPlugin; import customskinloader.plugin.ICustomSkinLoaderPlugin;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
@@ -16,17 +15,45 @@ import customskinloader.profile.UserProfile;
public class ElyByAPI implements JsonAPILoader.IJsonAPI { public class ElyByAPI implements JsonAPILoader.IJsonAPI {
public static class ElyBy extends JsonAPILoader.DefaultProfile { public static class ElyBy extends JsonAPILoader.DefaultProfile {
public ElyBy(JsonAPILoader loader) { super(loader); } public ElyBy(JsonAPILoader loader) {
@Override public String getName() { return "ElyBy"; } super(loader);
@Override public int getPriority() { return 400; } }
@Override public String getRoot() { return "http://skinsystem.ely.by/textures/"; }
@Override
public String getName() {
return "ElyBy";
}
@Override
public int getPriority() {
return 400;
}
@Override
public String getRoot() {
return "http://skinsystem.ely.by/textures/";
}
} }
public static class TLauncher extends JsonAPILoader.DefaultProfile { public static class TLauncher extends JsonAPILoader.DefaultProfile {
public TLauncher(JsonAPILoader loader) { super(loader); } public TLauncher(JsonAPILoader loader) {
@Override public String getName() { return "TLauncher"; } super(loader);
@Override public int getPriority() { return 550; } }
@Override public String getRoot() { return "https://auth.tlauncher.org/skin/profile/texture/login/"; }
@Override
public String getName() {
return "TLauncher";
}
@Override
public int getPriority() {
return 550;
}
@Override
public String getRoot() {
return "https://auth.tlauncher.org/skin/profile/texture/login/";
}
} }
@Override @Override
@@ -41,15 +68,11 @@ public class ElyByAPI implements JsonAPILoader.IJsonAPI {
@Override @Override
public UserProfile toUserProfile(String root, String json, boolean local) { public UserProfile toUserProfile(String root, String json, boolean local) {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> result = new Gson().fromJson(json, new TypeToken<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>() { }.getType()); Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> result = new Gson().fromJson(json, new TypeToken<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>() {
}.getType());
return ModelManager0.toUserProfile(result); return ModelManager0.toUserProfile(result);
} }
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override @Override
public String getName() { public String getName() {
return "ElyByAPI"; return "ElyByAPI";
@@ -6,7 +6,6 @@ import java.util.Map;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader; import customskinloader.loader.JsonAPILoader;
import customskinloader.plugin.ICustomSkinLoaderPlugin; import customskinloader.plugin.ICustomSkinLoaderPlugin;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
@@ -15,10 +14,24 @@ import customskinloader.profile.UserProfile;
public class GlitchlessAPI implements JsonAPILoader.IJsonAPI { public class GlitchlessAPI implements JsonAPILoader.IJsonAPI {
public static class GlitchlessGames extends JsonAPILoader.DefaultProfile { public static class GlitchlessGames extends JsonAPILoader.DefaultProfile {
public GlitchlessGames(JsonAPILoader loader) { super(loader); } public GlitchlessGames(JsonAPILoader loader) {
@Override public String getName() { return "GlitchlessGames"; } super(loader);
@Override public int getPriority() { return 700; } }
@Override public String getRoot() { return "https://games.glitchless.ru/api/minecraft/users/profiles/textures/?nickname="; }
@Override
public String getName() {
return "GlitchlessGames";
}
@Override
public int getPriority() {
return 700;
}
@Override
public String getRoot() {
return "https://games.glitchless.ru/api/minecraft/users/profiles/textures/?nickname=";
}
} }
@Override @Override
@@ -40,11 +53,6 @@ public class GlitchlessAPI implements JsonAPILoader.IJsonAPI {
return ModelManager0.toUserProfile(result.textures); return ModelManager0.toUserProfile(result.textures);
} }
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override @Override
public String getName() { public String getName() {
return "GlitchlessAPI"; return "GlitchlessAPI";
@@ -2,22 +2,15 @@ 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 com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.CustomSkinLoader;
import customskinloader.Logger;
import customskinloader.config.SkinSiteProfile; 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;
import customskinloader.profile.ModelManager0;
import customskinloader.profile.UserProfile; import customskinloader.profile.UserProfile;
import customskinloader.utils.HttpTextureUtil; import customskinloader.utils.TextureUtil;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.List; import java.util.List;
import java.util.Map;
public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI { public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
@@ -49,7 +42,7 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
@Override @Override
public String toJsonUrl(String root, String username) { public String toJsonUrl(String root, String username) {
String uuid = MojangAPILoader.getMojangUuidByUsername(username); String uuid = MojangAPILoader.getMojangUuidByUsername(username, false);
//If uuid cannot be found, we won't load profile in this API. //If uuid cannot be found, we won't load profile in this API.
if (uuid == null) { if (uuid == null) {
return null; return null;
@@ -65,23 +58,8 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
return null; return null;
} }
String capeBase64 = result.textures.cape;
byte[] capeBytes = Base64.decodeBase64(capeBase64);
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);
} catch (Exception e) {
CustomSkinLoader.logger.warning("Error parsing base64 image: " + capeBase64);
return null;
}
UserProfile profile = new UserProfile(); UserProfile profile = new UserProfile();
profile.capeUrl = fakeUrl; profile.capeUrl = TextureUtil.parseBase64Texture(result.textures.cape);
return profile; return profile;
} }
@@ -5,7 +5,6 @@ import java.util.Map;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import customskinloader.CustomSkinLoader; import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader; import customskinloader.loader.JsonAPILoader;
import customskinloader.plugin.ICustomSkinLoaderPlugin; import customskinloader.plugin.ICustomSkinLoaderPlugin;
import customskinloader.profile.ModelManager0; import customskinloader.profile.ModelManager0;
@@ -16,14 +15,28 @@ import org.apache.commons.lang3.StringUtils;
public class UniSkinAPI implements JsonAPILoader.IJsonAPI { public class UniSkinAPI implements JsonAPILoader.IJsonAPI {
public static class SkinMe extends JsonAPILoader.DefaultProfile { public static class SkinMe extends JsonAPILoader.DefaultProfile {
public SkinMe(JsonAPILoader loader) { super(loader); } public SkinMe(JsonAPILoader loader) {
@Override public String getName() { return "SkinMe"; } super(loader);
@Override public int getPriority() { return 500; } }
@Override public String getRoot() { return "http://www.skinme.cc/uniskin/"; }
@Override
public String getName() {
return "SkinMe";
}
@Override
public int getPriority() {
return 500;
}
@Override
public String getRoot() {
return "http://www.skinme.cc/uniskin/";
}
} }
private static final String TEXTURES="textures/"; private static final String TEXTURES = "textures/";
private static final String SUFFIX=".json"; private static final String SUFFIX = ".json";
@Override @Override
public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) { public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) {
@@ -37,55 +50,54 @@ public class UniSkinAPI implements JsonAPILoader.IJsonAPI {
@Override @Override
public UserProfile toUserProfile(String root, String json, boolean local) { public UserProfile toUserProfile(String root, String json, boolean local) {
UniSkinAPIProfile profile=CustomSkinLoader.GSON.fromJson(json, UniSkinAPIProfile.class); UniSkinAPIProfile profile = CustomSkinLoader.GSON.fromJson(json, UniSkinAPIProfile.class);
UserProfile p=new UserProfile(); UserProfile p = new UserProfile();
if(StringUtils.isNotBlank(profile.cape)){ if (StringUtils.isNotBlank(profile.cape)) {
p.capeUrl=root+TEXTURES+profile.cape; p.capeUrl = root + TEXTURES + profile.cape;
if(local) if (local)
p.capeUrl=HttpTextureUtil.getLocalFakeUrl(p.capeUrl); p.capeUrl = HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
} }
if(profile.skins==null||profile.skins.isEmpty()) if (profile.skins == null || profile.skins.isEmpty())
return p; return p;
if(profile.model_preference==null||profile.model_preference.isEmpty()) if (profile.model_preference == null || profile.model_preference.isEmpty())
return p; return p;
boolean hasSkin=false; boolean hasSkin = false;
for(String model:profile.model_preference){ for (String model : profile.model_preference) {
ModelManager0.Model enumModel=ModelManager0.getEnumModel(model); ModelManager0.Model enumModel = ModelManager0.getEnumModel(model);
if(enumModel==null||StringUtils.isEmpty(profile.skins.get(model))) if (enumModel == null || StringUtils.isEmpty(profile.skins.get(model)))
continue; continue;
if(ModelManager0.isSkin(enumModel)) if (ModelManager0.isSkin(enumModel))
if(hasSkin) if (hasSkin)
continue; continue;
else else
hasSkin=true; hasSkin = true;
String url=root+TEXTURES+profile.skins.get(model); String url = root + TEXTURES + profile.skins.get(model);
if(local) if (local)
url=HttpTextureUtil.getLocalFakeUrl(url); url = HttpTextureUtil.getLocalFakeUrl(url);
p.put(enumModel, url); p.put(enumModel, url);
} }
return p; return p;
} }
/** /**
* Json profile for UniSkinAPI * Json profile for UniSkinAPI
* Source Code: https://github.com/RecursiveG/UniSkinMod/blob/master/src/main/java/org/devinprogress/uniskinmod/UniSkinApiProfile.java#L18-L22 * <a href="https://github.com/RecursiveG/UniSkinMod/blob/master/src/main/java/org/devinprogress/uniskinmod/UniSkinApiProfile.java#L18-L22">Source Code</a>
*
* @author RecursiveG * @author RecursiveG
*/ */
private class UniSkinAPIProfile{ private static class UniSkinAPIProfile {
public String player_name; public String player_name;
public long last_update; public long last_update;
public List<String> model_preference; public List<String> model_preference;
public Map<String,String> skins; public Map<String, String> skins;
public String cape; public String cape;
} }
@Override
public String getPayload(SkinSiteProfile ssp) {
return null;
}
@Override @Override
public String getName() { public String getName() {
return "UniSkinAPI"; return "UniSkinAPI";
@@ -0,0 +1,110 @@
package customskinloader.loader.jsonapi;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import customskinloader.CustomSkinLoader;
import customskinloader.config.SkinSiteProfile;
import customskinloader.loader.JsonAPILoader;
import customskinloader.loader.MojangAPILoader;
import customskinloader.plugin.ICustomSkinLoaderPlugin;
import customskinloader.profile.UserProfile;
import customskinloader.utils.TextureUtil;
import java.util.List;
/**
* Wynntils cape API
* <a href="https://wynntils.com/">Home</a>
* Test player: Cael
*
* @since 14.16
*/
public class WynntilsAPI implements JsonAPILoader.IJsonAPI {
public static class Wynntils extends JsonAPILoader.DefaultProfile {
public Wynntils(JsonAPILoader loader) {
super(loader);
}
@Override
public String getName() {
return "Wynntils";
}
@Override
public int getPriority() {
return 820;
}
@Override
public String getRoot() {
return "https://athena.wynntils.com/user/getInfo";
}
}
@Override
public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) {
return Lists.newArrayList(new Wynntils(loader));
}
@Override
public String toJsonUrl(String root, String username) {
return root;
}
@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
WynntilsApiResponse result = new Gson().fromJson(json, WynntilsApiResponse.class);
if (result.user == null || result.user.cosmetics == null || result.user.cosmetics.texture == null) {
return null;
}
UserProfile profile = new UserProfile();
String fakeUrl = TextureUtil.parseBase64Texture(result.user.cosmetics.texture);
if (result.user.cosmetics.hasCape) {
profile.capeUrl = fakeUrl;
} else if (result.user.cosmetics.hasElytra) {
profile.elytraUrl = fakeUrl;
} else {
CustomSkinLoader.logger.warning("Illegal response found in Wynntils");
return null;
}
return profile;
}
@Override
public String getPayload(SkinSiteProfile ssp, String username) {
WynntilsApiRequest req = new WynntilsApiRequest();
req.uuid = MojangAPILoader.getMojangUuidByUsername(username, true);
if (req.uuid == null) {
throw new JsonAPILoader.ProfileNotFoundException();
}
return new Gson().toJson(req);
}
@Override
public String getName() {
return "WynntilsAPI";
}
public static class WynntilsApiRequest {
public String uuid;
}
public static class WynntilsApiResponse {
public User user;
public static class User {
public String accountType;
public Cosmetics cosmetics;
public static class Cosmetics {
public boolean hasCape;
public boolean hasElytra;
public boolean hasEars;
public String texture;
}
}
}
}
@@ -0,0 +1,44 @@
package customskinloader.log;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @since 14.16
*/
public class LogManager {
private static Path logFile;
private static Writer logWriter;
private static final Map<String, Logger> loggers = new ConcurrentHashMap<>();
public static void setLogFile(Path logFile) {
//Not updated
if (logFile == null || logFile.equals(LogManager.logFile)) {
return;
}
LogManager.logFile = logFile;
try {
//Close previous writer
if (logWriter != null) {
logWriter.close();
}
//Set new writer
Files.createDirectories(logFile.getParent());
logWriter = Files.newBufferedWriter(logFile, StandardCharsets.UTF_8, StandardOpenOption.CREATE);
loggers.forEach((k, v) -> v.setWriter(logWriter));
} catch (Exception e) {
e.printStackTrace();
}
}
public static Logger getLogger(String loggerName) {
return loggers.computeIfAbsent(loggerName,
it -> new Logger(logWriter, "CustomSkinLoader " + loggerName));
}
}
@@ -0,0 +1,185 @@
package customskinloader.log;
import javax.annotation.Nullable;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* the Logger
* Moved from <code>customskinloader.Logger</code>
*
* @since 14.16
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
public class Logger {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
* A copy of <code>Config.enableLogStdOut</code>.
* Because <code>Config.loadConfig0()</code> will use <code>Logger.log()</code>,
* which means cannot access <code>CustomSkinLoader.config</code> here.
*
* @see customskinloader.config.Config#enableLogStdOut
* @since 14.15
*/
public boolean enableLogStdOut = false;
public enum Level {
DEBUG("DEBUG", false),
INFO("INFO", true),
WARNING("WARNING", true);
final String name;
final boolean display;
Level(String name, boolean display) {
this.name = name;
this.display = display;
}
public String getName() {
return name;
}
public boolean display() {
return display;
}
}
private Writer writer = null;
public void setWriter(Writer writer) {
this.writer = writer;
}
public Logger() {
//Logger isn't created.
}
public Logger(String logFile) {
this(new File(logFile));
}
public Logger(File logFile) {
this(logFile, "Unknown");
}
/**
* Create Logger with File
*
* @since 14.16
*/
public Logger(File logFile, String loggerName) {
this.loggerName = loggerName;
try {
if (!logFile.getParentFile().exists()) {
logFile.getParentFile().mkdirs();
}
if (!logFile.exists()) {
logFile.createNewFile();
}
writer = new BufferedWriter(new OutputStreamWriter(
Files.newOutputStream(logFile.toPath()), StandardCharsets.UTF_8));
System.out.println("Log Path: " + logFile.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create Logger with special Writer
*
* @since 14.16
*/
public Logger(@Nullable Writer writer, String loggerName) {
this.loggerName = loggerName;
this.writer = writer;
}
/**
* Logger name in log
*
* @since 14.16
*/
String loggerName;
public void close() {
if (writer != null) {
try {
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Judge if a level can be printed to standard output(System.out) with config.
*
* @param level log level
* @return true - print
*/
private boolean canPrintToStdOut(Level level) {
return level.display() && enableLogStdOut;
}
public void log(Level level, String msg) {
//When it neither be printed to standard output nor write to file
if (!canPrintToStdOut(level) && writer == null) {
return;
}
//Format, print and write
String sb = String.format("[%s] [%s/%s] [%s]: %s",
DATE_FORMAT.format(new Date()), Thread.currentThread().getName(), level.getName(), loggerName, msg);
if (canPrintToStdOut(level)) {
System.out.println(sb);
}
if (writer == null) {
return;
}
try {
String sb2 = String.format("%s\r\n", sb);
writer.write(sb2);//Writer.write has lock
writer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public void debug(String msg) {
log(Level.DEBUG, msg);
}
public void debug(String format, Object... objs) {
debug(String.format(format, objs));
}
public void info(String msg) {
log(Level.INFO, msg);
}
public void info(String format, Object... objs) {
info(String.format(format, objs));
}
public void warning(String msg) {
log(Level.WARNING, msg);
}
public void warning(String format, Object... objs) {
warning(String.format(format, objs));
}
public void warning(Throwable e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
log(Level.WARNING, "Exception: " + sw);
}
}
@@ -24,7 +24,8 @@ public class PluginLoader {
new JsonAPILoader(new UniSkinAPI()), new JsonAPILoader(new UniSkinAPI()),
new JsonAPILoader(new ElyByAPI()), new JsonAPILoader(new ElyByAPI()),
new JsonAPILoader(new GlitchlessAPI()), new JsonAPILoader(new GlitchlessAPI()),
new JsonAPILoader(new MinecraftCapesAPI()) new JsonAPILoader(new MinecraftCapesAPI()),
new JsonAPILoader(new WynntilsAPI()),
}; };
public static final ArrayList<ICustomSkinLoaderPlugin> PLUGINS = loadPlugins(); public static final ArrayList<ICustomSkinLoaderPlugin> PLUGINS = loadPlugins();
@@ -3,11 +3,10 @@ package customskinloader.profile;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import customskinloader.fake.FakeMinecraftProfileTexture;
import org.apache.commons.lang3.StringUtils;
/** /**
* Model Manager for 1.8 and higher. * Model Manager for 1.8 and higher.
@@ -25,10 +24,10 @@ public class ModelManager0 {
} }
private static HashMap<String, Model> models = new HashMap<String, Model>(); private static HashMap<String, Model> models = new HashMap<String, Model>();
private static Type typeElytra = null; private static MinecraftProfileTexture.Type typeElytra = null;
static { static {
for (Type type : Type.values()) { for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) {
if (type.ordinal() == 2)//ELYTRA if (type.ordinal() == 2)//ELYTRA
typeElytra = type; typeElytra = type;
} }
@@ -76,17 +75,17 @@ public class ModelManager0 {
* @return profile - UserProfile instance * @return profile - UserProfile instance
* @since 13.1 * @since 13.1
*/ */
public static UserProfile toUserProfile(Map<Type, MinecraftProfileTexture> profile) { public static UserProfile toUserProfile(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> profile) {
UserProfile userProfile = new UserProfile(); UserProfile userProfile = new UserProfile();
if (profile == null) if (profile == null)
return userProfile; return userProfile;
MinecraftProfileTexture skin = profile.get(Type.SKIN); MinecraftProfileTexture skin = profile.get(MinecraftProfileTexture.Type.SKIN);
userProfile.skinUrl = skin == null ? null : skin.getUrl();//Avoid NullPointerException userProfile.skinUrl = skin == null ? null : skin.getUrl();//Avoid NullPointerException
userProfile.model = skin == null ? null : skin.getMetadata("model"); userProfile.model = skin == null ? null : skin.getMetadata("model");
if (StringUtils.isEmpty(userProfile.model)) if (StringUtils.isEmpty(userProfile.model))
userProfile.model = "default"; userProfile.model = "default";
MinecraftProfileTexture cape = profile.get(Type.CAPE); MinecraftProfileTexture cape = profile.get(MinecraftProfileTexture.Type.CAPE);
userProfile.capeUrl = cape == null ? null : cape.getUrl(); userProfile.capeUrl = cape == null ? null : cape.getUrl();
return userProfile; return userProfile;
} }
@@ -98,8 +97,8 @@ public class ModelManager0 {
* @return profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>) * @return profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>)
* @since 13.1 * @since 13.1
*/ */
public static Map<Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) { public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> fromUserProfile(UserProfile profile) {
Map<Type, MinecraftProfileTexture> map = Maps.newHashMap(); Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
if (profile == null) if (profile == null)
return map; return map;
if (profile.skinUrl != null) { if (profile.skinUrl != null) {
@@ -108,10 +107,10 @@ public class ModelManager0 {
metadata = Maps.newHashMap(); metadata = Maps.newHashMap();
metadata.put("model", profile.model); metadata.put("model", profile.model);
} }
map.put(Type.SKIN, getProfileTexture(profile.skinUrl, metadata)); map.put(MinecraftProfileTexture.Type.SKIN, getProfileTexture(profile.skinUrl, metadata));
} }
if (profile.capeUrl != null) if (profile.capeUrl != null)
map.put(Type.CAPE, getProfileTexture(profile.capeUrl, null)); map.put(MinecraftProfileTexture.Type.CAPE, getProfileTexture(profile.capeUrl, null));
if (typeElytra != null && profile.elytraUrl != null) if (typeElytra != null && profile.elytraUrl != null)
map.put(typeElytra, getProfileTexture(profile.elytraUrl, null)); map.put(typeElytra, getProfileTexture(profile.elytraUrl, null));
return map; return map;
@@ -126,6 +125,6 @@ public class ModelManager0 {
* @since 14.5 * @since 14.5
*/ */
public static MinecraftProfileTexture getProfileTexture(String url, Map<String, String> metadata) { public static MinecraftProfileTexture getProfileTexture(String url, Map<String, String> metadata) {
return new MinecraftProfileTexture(url, metadata); return new FakeMinecraftProfileTexture(url, metadata);
} }
} }
@@ -161,6 +161,7 @@ public class HttpRequestUtil {
} }
if (StringUtils.isNotEmpty(request.payload)) { if (StringUtils.isNotEmpty(request.payload)) {
CustomSkinLoader.logger.info("Payload: " + request.payload); CustomSkinLoader.logger.info("Payload: " + request.payload);
c.setRequestMethod("POST");
c.setRequestProperty("Content-Type", "application/json"); c.setRequestProperty("Content-Type", "application/json");
c.setDoOutput(true); c.setDoOutput(true);
OutputStream os = c.getOutputStream(); OutputStream os = c.getOutputStream();
@@ -1,7 +1,6 @@
package customskinloader.utils; package customskinloader.utils;
import java.io.File; import java.io.File;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.util.LinkedList; import java.util.LinkedList;
@@ -1,27 +1,19 @@
package customskinloader.utils; package customskinloader.utils;
import java.io.File; import java.io.File;
import java.io.FileReader;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager;
import net.minecraft.realms.RealmsSharedConstants;
import org.apache.commons.lang3.StringUtils;
/** /**
* @author Alexander Xia * @author Alexander Xia
@@ -77,7 +69,7 @@ public class MinecraftUtil {
// (domain|ip)(:port) // (domain|ip)(:port)
public static String getServerAddress() { public static String getServerAddress() {
net.minecraft.client.multiplayer.ServerData data = Minecraft.getMinecraft().getCurrentServerData(); ServerData data = Minecraft.getMinecraft().getCurrentServerData();
if (data == null)//Single Player if (data == null)//Single Player
return null; return null;
return data.serverIP; return data.serverIP;
@@ -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;
}
}
}
@@ -1,16 +0,0 @@
package net.minecraft.client.renderer.texture;
import java.io.File;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.util.ResourceLocation;
public class DownloadingTexture extends SimpleTexture {
public DownloadingTexture(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, IImageBuffer imageBufferIn) {
super(textureResourceLocation);
}
public DownloadingTexture(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, boolean legacySkinIn, Runnable processTaskIn) {
super(textureResourceLocation);
}
}
@@ -1,12 +0,0 @@
package net.minecraft.client.renderer.texture;
import java.io.File;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.util.ResourceLocation;
public class ThreadDownloadImageData extends SimpleTexture {
public ThreadDownloadImageData(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, IImageBuffer imageBufferIn) {
super(textureResourceLocation);
}
}
+4 -12
View File
@@ -7,19 +7,11 @@ 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/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z method_4616
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; method_4619
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; method_34590
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V method_4616
net/minecraft/client/Minecraft net/minecraft/class_310 net/minecraft/client/Minecraft net/minecraft/class_310
gameDir field_1697 gameDir field_1697
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; method_1558 getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; method_1558
getMinecraft ()Lnet/minecraft/client/Minecraft; method_1551 getMinecraft ()Lnet/minecraft/client/Minecraft; method_1551
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; method_1478 getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; method_1478
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; method_1495
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
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046 net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007 net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972 net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
net/minecraft/client/renderer/texture/DownloadingTexture net/minecraft/class_1046
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062 net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011 net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
func_195699_a (IIIIIIZZ)V method_4304 func_195699_a (IIIIIIZZ)V method_4304
@@ -47,20 +38,21 @@ net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
func_195714_b ()I method_4323 func_195714_b ()I method_4323
func_195715_a (IIIII)V method_4326 func_195715_a (IIIII)V method_4326
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049 net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049
net/minecraft/client/renderer/texture/Texture net/minecraft/class_1044
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060 net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619 getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616 loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616
net/minecraft/client/renderer/texture/ThreadDownloadImageData net/minecraft/class_1046
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068 net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648 getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; method_4649
net/minecraft/client/resources/IResource net/minecraft/class_3298 net/minecraft/client/resources/IResource net/minecraft/class_3298
getInputStream ()Ljava/io/InputStream; method_14482 getInputStream ()Ljava/io/InputStream; method_14482
net/minecraft/client/resources/IResourceManager net/minecraft/class_3300 net/minecraft/client/resources/IResourceManager net/minecraft/class_3300
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; method_14486 getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; method_14486
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
net/minecraft/client/resources/SkinManager$3 net/minecraft/class_1071$3
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/resources/IResource net/minecraft/class_3298 net/minecraft/resources/IResource net/minecraft/class_3298
+3 -4
View File
@@ -49,11 +49,10 @@ tasks.publishModrinth.doFirst {
// https://github.com/MinecraftForge/ForgeGradle/blob/fc67182a61926f0bdb0d12da5fba7f4322f64d86/src/main/java/net/minecraftforge/gradle/common/BasePlugin.java#L229 // 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 -> jsonSlurper.parse(plugin.cacheFile("McManifest.json")).versions.each { version ->
if (version.type == "snapshot") { if (version.type == "snapshot") {
// If the first version is a snapshot, assume the target release version is the same as the assets version. // 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) { if (currentRelease == null) {
currentRelease = jsonSlurper.parse(new URL(version.url)).assets.with { return
it.toString().split($/\./$).with { "${it[0]}.${it[1]}" }
}
} }
} else if (version.type == "release") { } else if (version.type == "release") {
currentRelease = version.id.with { currentRelease = version.id.with {
+1 -1
View File
@@ -1,5 +1,5 @@
minecraft_version=1.14 minecraft_version=1.14
minecraft_full_versions=1.14-Snapshot,1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15-Snapshot,1.15,1.15.1,1.15.2,1.16-Snapshot,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17-Snapshot,1.17,1.17.1,1.18-Snapshot,1.18,1.18.1,1.18.2,1.19-Snapshot,1.19,1.19.1,1.19.2 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 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
+13
View File
@@ -4,10 +4,14 @@ net/minecraft/client/Minecraft net/minecraft/class_310
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 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 getLocationSkin (Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; method_3124
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
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/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
@@ -26,10 +30,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
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/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_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4655
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$3 net/minecraft/class_1071$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 net/minecraft/class_1071$3$1
field_152803_a field_152803_a
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
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
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
+2 -1
View File
@@ -10,7 +10,8 @@
"MixinMinecraft", "MixinMinecraft",
"MixinRenderPlayer", "MixinRenderPlayer",
"MixinSkinManager", "MixinSkinManager",
"MixinTextureManager", "MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV2", "MixinThreadDownloadImageDataV2",
"MixinThreadDownloadImageDataV3" "MixinThreadDownloadImageDataV3"
], ],
@@ -35,13 +35,6 @@ public class DevEnvRemapper extends SimpleRemapper {
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager") Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
) )
); );
remappedClasses.put(
"net.minecraft.class_1060",
new AbstractMap.SimpleEntry<>(
Lists.newArrayList("customskinloader.fake.itf.IFakeTextureManager$V1", "customskinloader.fake.itf.IFakeTextureManager$V2"),
Lists.newArrayList("customskinloader.fake.itf.FakeInterfaceManager")
)
);
remappedClasses.put( remappedClasses.put(
"net.minecraft.class_3298", "net.minecraft.class_3298",
new AbstractMap.SimpleEntry<>( new AbstractMap.SimpleEntry<>(
@@ -1,27 +1,28 @@
package customskinloader.fabric; package customskinloader.fabric;
import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.nio.file.Paths;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import customskinloader.Logger; import customskinloader.log.LogManager;
import customskinloader.log.Logger;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 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 = new Logger(new File("./CustomSkinLoader/FabricPlugin.log")); 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"));
URL versionJson = this.getClass().getResource("/version.json"); URL versionJson = this.getClass().getResource("/version.json");
if (versionJson != null) { if (versionJson != null) {
logger.info("\"version.json\": " + versionJson.toString()); logger.info("\"version.json\": " + versionJson.toString());
@@ -56,6 +57,8 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
boolean result = true; boolean result = true;
if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV2")) { if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV2")) {
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 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(".MixinThreadDownloadImageDataV3")) { } else if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV3")) {
+4 -12
View File
@@ -7,19 +7,11 @@ 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/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; m_118506_
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; m_174786_
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V m_118495_
net/minecraft/client/Minecraft net/minecraft/client/Minecraft net/minecraft/client/Minecraft net/minecraft/client/Minecraft
gameDir f_91069_ gameDir f_91069_
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; m_91089_ getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; m_91089_
getMinecraft ()Lnet/minecraft/client/Minecraft; m_91087_ getMinecraft ()Lnet/minecraft/client/Minecraft; m_91087_
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; m_91098_ getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; m_91098_
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; m_91108_
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
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffe
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer
net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer
net/minecraft/client/renderer/texture/DownloadingTexture net/minecraft/client/renderer/texture/HttpTexture
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V m_85025_ func_195699_a (IIIIIIZZ)V m_85025_
@@ -47,20 +38,21 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195714_b ()I m_85084_ func_195714_b ()I m_85084_
func_195715_a (IIIII)V m_84997_ func_195715_a (IIIII)V m_84997_
net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture
net/minecraft/client/renderer/texture/Texture net/minecraft/client/renderer/texture/AbstractTexture
net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture
net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_ getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; m_118626_
net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource
getInputStream ()Ljava/io/InputStream; m_6679_ getInputStream ()Ljava/io/InputStream; m_6679_
net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; m_142591_ getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; m_142591_
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_
net/minecraft/client/resources/SkinManager$3 net/minecraft/client/resources/SkinManager$3
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/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
+1 -1
View File
@@ -1,5 +1,5 @@
minecraft_version=1.17.1 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 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 java_full_versions=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
+75 -27
View File
@@ -5,6 +5,7 @@ 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 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 InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode'); var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
var MethodInsnNode = getJavaType('org.objectweb.asm.tree.MethodInsnNode'); var MethodInsnNode = getJavaType('org.objectweb.asm.tree.MethodInsnNode');
var TypeInsnNode = getJavaType('org.objectweb.asm.tree.TypeInsnNode'); var TypeInsnNode = getJavaType('org.objectweb.asm.tree.TypeInsnNode');
@@ -55,23 +56,81 @@ function initializeCoreMod() {
} }
} }
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) { } 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;")) {
var first = mn.instructions.getFirst(); for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0)); var node = iterator.next();
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;")); 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(first, new VarInsnNode(Opcodes.ALOAD, 1)); || (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(first, new VarInsnNode(Opcodes.ALOAD, 2)); mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 3)); 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(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkin", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;", false)); }
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN));
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("net/minecraft/client/resources/SkinManager$SkinTextureCallback") && checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 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, 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"))) {
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, 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, 2));
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++) {
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));
}
}
} else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) { } else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) {
var first = mn.instructions.getFirst(); for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0)); var node = iterator.next();
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;")); if (node.getOpcode() === Opcodes.INVOKEINTERFACE
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1)); && (node.owner.equals("java/util/concurrent/Executor") // 1.17.1
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2)); || node.owner.equals("java/util/concurrent/ExecutorService")) // 1.18+
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ILOAD, 3)); && checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")) {
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V", false)); mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.RETURN)); mn.instructions.insert(node, new InsnNode(Opcodes.POP));
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
}
}
} 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();) {
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", "getUserProfile", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
break;
}
}
} 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();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"))
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
}
}
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) { } 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 VarInsnNode(Opcodes.ALOAD, 0));
@@ -115,17 +174,6 @@ function initializeCoreMod() {
return cn; return cn;
} }
}, },
'TextureManagerTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/TextureManager'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V1");
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V2");
return cn;
}
},
'RenderPlayer_LayerCapeTransformer': { 'RenderPlayer_LayerCapeTransformer': {
'target': { 'target': {
'type': 'CLASS', 'type': 'CLASS',
+100 -54
View File
@@ -5,11 +5,9 @@ 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 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 InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode'); var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
var JumpInsnNode = getJavaType('org.objectweb.asm.tree.JumpInsnNode');
var LabelNode = getJavaType('org.objectweb.asm.tree.LabelNode');
var MethodInsnNode = getJavaType('org.objectweb.asm.tree.MethodInsnNode'); var MethodInsnNode = getJavaType('org.objectweb.asm.tree.MethodInsnNode');
var MethodNode = getJavaType('org.objectweb.asm.tree.MethodNode');
var TypeInsnNode = getJavaType('org.objectweb.asm.tree.TypeInsnNode'); var TypeInsnNode = getJavaType('org.objectweb.asm.tree.TypeInsnNode');
var VarInsnNode = getJavaType('org.objectweb.asm.tree.VarInsnNode'); var VarInsnNode = getJavaType('org.objectweb.asm.tree.VarInsnNode');
@@ -69,25 +67,108 @@ function initializeCoreMod() {
} else if (checkName(mn.name, "func_152789_a") } else if (checkName(mn.name, "func_152789_a")
&& (mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;") // 1.13.2- && (mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;") // 1.13.2-
|| mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;"))) { // 1.14.2+ || mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;"))) { // 1.14.2+
var first = mn.instructions.getFirst(); for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0)); var node = iterator.next();
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;")); if (node.getOpcode() === Opcodes.INVOKESPECIAL && node.owner.equals("net/minecraft/util/ResourceLocation") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/lang/String;)V")) {
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1)); mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2)); mn.instructions.insert(node, node = new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/util/ResourceLocation;", false));
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 3)); }
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkin", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;", false));
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN)); if (node.getOpcode() === Opcodes.INVOKEINTERFACE
&& (node.owner.equals("net/minecraft/client/resources/SkinManager$SkinAvailableCallback") // 1.13.2-
|| node.owner.equals("net/minecraft/client/resources/SkinManager$ISkinAvailableCallback")) // 1.14.2+
&& checkName(node.name, "onSkinTextureAvailable") && node.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 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, 5));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcustomskinloader/fake/FakeSkinManager;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
}
if (node.getOpcode() === Opcodes.INVOKESPECIAL
&& (node.owner.equals("net/minecraft/client/renderer/texture/ThreadDownloadImageData") // 1.13.2-
|| node.owner.equals("net/minecraft/client/renderer/texture/DownloadingTexture")) // 1.14.2+
&& checkName(node.name, "<init>")
&& (node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V") // 1.14.4-
|| node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V"))) { // 1.15+
var args = Type.getType(node.desc).getArgumentTypes();
var s = "(";
for (var i = 0; i < args.length; i++) {
s = s + "Ljava/lang/Object;";
}
if (node.desc.contains("Z")) {
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, 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, 2));
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$SkinAvailableCallback;)[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));
}
}
} else if (checkName(mn.name, "func_152790_a") } else if (checkName(mn.name, "func_152790_a")
&& (mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V") // 1.13.2- && (mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V") // 1.13.2-
|| mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;Z)V"))) { // 1.14.2+ || mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;Z)V"))) { // 1.14.2+
var first = mn.instructions.getFirst(); for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0)); var node = iterator.next();
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;")); if (node.getOpcode() === Opcodes.INVOKEINTERFACE
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1)); && ((node.owner.equals("java/util/concurrent/ExecutorService") && checkName(node.name, "submit") && node.desc.equals("(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) // 1.14.4-
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 2)); || (node.owner.equals("java/util/concurrent/Executor") && checkName(node.name, "execute") && node.desc.equals("(Ljava/lang/Runnable;)V")))) { // 1.15+
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ILOAD, 3)); mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V", false)); if (node.desc.endsWith("V")) {
mn.instructions.insertBefore(first, new InsnNode(Opcodes.RETURN)); mn.instructions.insert(node, new InsnNode(Opcodes.POP));
}
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
}
}
} else if (((checkName(mn.name, "func_210275_a") || checkName(mn.name, "lambda$loadProfileTextures$1")) // 1.14.4-
|| (checkName(mn.name, "func_229293_a_") || checkName(mn.name, "lambda$loadProfileTextures$4"))) // 1.15+
&& (mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V") // 1.13.2-
|| mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)V"))) { // 1.14.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", "getUserProfile", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
break;
}
}
} else if ((checkName(mn.name, "func_210276_a") || checkName(mn.name, "lambda$null$0"))
&& (mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V") // 1.13.2-
|| mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)V"))) { // 1.14.2 ~ 1.14.4
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.RETURN) {
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadElytraTexture", "(Lnet/minecraft/client/resources/SkinManager;" + mn.desc.substring(1), false));
}
}
} else if ((checkName(mn.name, "func_229297_b_") || checkName(mn.name, "lambda$null$2")) && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$ISkinAvailableCallback;)V")) { // 1.15+
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
var node = iterator.next();
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("com/google/common/collect/ImmutableList") && checkName(node.name, "of") && node.desc.equals("(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;")) {
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP2));
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mojang/authlib/minecraft/MinecraftProfileTexture$Type", "values", "()[Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"))
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
}
}
} else if (checkName(mn.name, "func_152788_a") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) { } else if (checkName(mn.name, "func_152788_a") && 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 VarInsnNode(Opcodes.ALOAD, 0));
@@ -124,30 +205,6 @@ function initializeCoreMod() {
} }
}, },
// For 1.13+
'AbstractTextureTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/AbstractTexture'
},
'transformer': function (cn) {
cn.interfaces.add("net/minecraft/client/renderer/texture/Texture");
return cn;
}
},
'TextureTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/Texture'
},
'transformer': function (cn) {
if (cn.access === 0) {
cn.access = Opcodes.ACC_PUBLIC | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT;
}
return cn;
}
},
// For 1.14+ // For 1.14+
'MinecraftTransformer': { 'MinecraftTransformer': {
'target': { 'target': {
@@ -194,17 +251,6 @@ function initializeCoreMod() {
}, },
// For 1.15+ // For 1.15+
'TextureManagerTransformer': {
'target': {
'type': 'CLASS',
'name': 'net/minecraft/client/renderer/texture/TextureManager'
},
'transformer': function (cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V1");
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V2");
return cn;
}
},
'DownloadingTextureTransformer': { 'DownloadingTextureTransformer': {
'target': { 'target': {
'type': 'CLASS', 'type': 'CLASS',
@@ -5,13 +5,14 @@ import java.lang.reflect.Field;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import customskinloader.Logger; import customskinloader.log.LogManager;
import customskinloader.log.Logger;
import net.minecraft.launchwrapper.ITweaker; import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch; import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
public class ForgeTweaker implements ITweaker { public class ForgeTweaker implements ITweaker {
public static Logger logger = new Logger(new File("./CustomSkinLoader/ForgePlugin.log")); public static Logger logger = LogManager.getLogger("Forge");
private final static String FML_PLATFORM_INITIALIZER = "customskinloader.forge.platform.IFMLPlatform$FMLPlatformInitializer"; private final static String FML_PLATFORM_INITIALIZER = "customskinloader.forge.platform.IFMLPlatform$FMLPlatformInitializer";
@@ -32,7 +33,7 @@ public class ForgeTweaker implements ITweaker {
@Override @Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) { public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
LogManager.setLogFile(gameDir.toPath().resolve("CustomSkinLoader/CustomSkinLoader.log"));
} }
@Override @Override
@@ -48,6 +48,10 @@ public class TransformerManager {
return remapper.mapFieldName(owner, name, desc); return remapper.mapFieldName(owner, name, desc);
} }
public static String mapFieldDesc(String desc) {
return remapper.mapDesc(desc);
}
public static String mapMethodName(String owner, String name, String desc) { public static String mapMethodName(String owner, String name, String desc) {
return remapper.mapMethodName(owner, name, desc); return remapper.mapMethodName(owner, name, desc);
} }
@@ -64,6 +68,22 @@ public class TransformerManager {
} }
} }
public static boolean checkFieldName(String owner, String name, String desc, String srgName) {
if (isDevelopmentEnvironment) {
return mapFieldName(owner, srgName, desc).equals(name);
} else {
return mapFieldName(owner, name, desc).equals(srgName);
}
}
public static boolean checkFieldDesc(String desc, String deobfDesc) {
if (isDevelopmentEnvironment) {
return desc.equals(deobfDesc);
} else {
return mapFieldDesc(desc).equals(deobfDesc);
}
}
public static boolean checkMethodName(String owner, String name, String desc, String srgName) { public static boolean checkMethodName(String owner, String name, String desc, String srgName) {
if (isDevelopmentEnvironment) { if (isDevelopmentEnvironment) {
return mapMethodName(owner, srgName, desc).equals(name); return mapMethodName(owner, srgName, desc).equals(name);
@@ -19,9 +19,6 @@ public class LaunchWrapper implements IClassTransformer {
private static final TransformerManager.IClassTransformer[] CLASS_TRANSFORMERS = { private static final TransformerManager.IClassTransformer[] CLASS_TRANSFORMERS = {
new FakeInterfacesTransformer.MinecraftTransformer(), new FakeInterfacesTransformer.MinecraftTransformer(),
new FakeInterfacesTransformer.ThreadDownloadImageDataTransformer(), new FakeInterfacesTransformer.ThreadDownloadImageDataTransformer(),
new FakeInterfacesTransformer.AbstractTextureTransformer(),
new FakeInterfacesTransformer.TextureTransformer(),
new FakeInterfacesTransformer.TextureManagerTransformer(),
new FakeInterfacesTransformer.ClientIResourceTransformer(), new FakeInterfacesTransformer.ClientIResourceTransformer(),
new FakeInterfacesTransformer.ClientIResourceManagerTransformer(), new FakeInterfacesTransformer.ClientIResourceManagerTransformer(),
new FakeInterfacesTransformer.IResourceTransformer(), new FakeInterfacesTransformer.IResourceTransformer(),
@@ -32,6 +29,8 @@ public class LaunchWrapper implements IClassTransformer {
new SkinManagerTransformer.LoadSkinTransformer(), new SkinManagerTransformer.LoadSkinTransformer(),
new SkinManagerTransformer.LoadProfileTexturesTransformer(), new SkinManagerTransformer.LoadProfileTexturesTransformer(),
new SkinManagerTransformer.LoadSkinFromCacheTransformer(), new SkinManagerTransformer.LoadSkinFromCacheTransformer(),
new SkinManagerTransformer.Run0Transformer(),
new SkinManagerTransformer.Run1Transformer(),
new PlayerTabTransformer.ScoreObjectiveTransformer(), new PlayerTabTransformer.ScoreObjectiveTransformer(),
new SpectatorMenuTransformer.PlayerMenuObjectTransformer() new SpectatorMenuTransformer.PlayerMenuObjectTransformer()
}; };
@@ -52,36 +52,6 @@ public class FakeInterfacesTransformer {
} }
} }
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.texture.AbstractTexture"
)
public static class AbstractTextureTransformer implements TransformerManager.IClassTransformer {
@Override
public ClassNode transform(ClassNode cn) {
cn.interfaces.add("net/minecraft/client/renderer/texture/Texture");
return cn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.texture.Texture"
)
public static class TextureTransformer extends FakeInterfacesTransformer.FakeInterfaceTransformer {
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.renderer.texture.TextureManager"
)
public static class TextureManagerTransformer implements TransformerManager.IClassTransformer {
@Override
public ClassNode transform(ClassNode cn) {
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V1");
cn.interfaces.add("customskinloader/fake/itf/IFakeTextureManager$V2");
return cn;
}
}
@TransformerManager.TransformTarget( @TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.IResource" className = "net.minecraft.client.resources.IResource"
) )
@@ -2,6 +2,7 @@ package customskinloader.forge.transformer;
import customskinloader.forge.TransformerManager; import customskinloader.forge.TransformerManager;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode; import org.objectweb.asm.tree.FieldInsnNode;
@@ -9,6 +10,7 @@ import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.FrameNode; import org.objectweb.asm.tree.FrameNode;
import org.objectweb.asm.tree.InsnList; import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.InsnNode; import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.IntInsnNode;
import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TypeInsnNode; import org.objectweb.asm.tree.TypeInsnNode;
@@ -53,16 +55,67 @@ public class SkinManagerTransformer {
public static class LoadSkinTransformer implements TransformerManager.IMethodTransformer { public static class LoadSkinTransformer implements TransformerManager.IMethodTransformer {
@Override @Override
public MethodNode transform(ClassNode cn, MethodNode mn) { public MethodNode transform(ClassNode cn, MethodNode mn) {
InsnList il = new InsnList(); for (AbstractInsnNode ain : mn.instructions.toArray()) {
il.add(new VarInsnNode(Opcodes.ALOAD, 0)); if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;")); MethodInsnNode min = (MethodInsnNode) ain;
il.add(new VarInsnNode(Opcodes.ALOAD, 1)); if (TransformerManager.checkClassName(min.owner, "net/minecraft/util/ResourceLocation") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "<init>") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/String;)V")) {
il.add(new VarInsnNode(Opcodes.ALOAD, 2)); InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 3)); il.add(new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkin", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;", false)); il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setResourceLocation", "(Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Lnet/minecraft/util/ResourceLocation;", false));
il.add(new InsnNode(Opcodes.ARETURN)); mn.instructions.insert(min, il);
il.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null)); }
mn.instructions.insert(il); }
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/client/resources/SkinManager$SkinAvailableCallback") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "func_180521_a") && TransformerManager.checkMethodDesc(min.desc, "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V")) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 4));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getModelCache", "(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcustomskinloader/fake/FakeSkinManager;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
mn.instructions.insertBefore(min, il);
}
}
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "net/minecraft/client/renderer/ThreadDownloadImageData") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "<init>") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V")) {
InsnList il0 = new InsnList();
Type[] args = Type.getType(min.desc).getArgumentTypes();
StringBuilder sb = new StringBuilder("(");
for (int i = 0, len = args.length; i < len; i++) {
sb.append("Ljava/lang/Object;");
}
il0.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", sb.append(")Lcom/google/common/collect/ImmutableList;").toString(), false));
il0.add(new VarInsnNode(Opcodes.ALOAD, 0));
il0.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
il0.add(new VarInsnNode(Opcodes.ALOAD, 1));
il0.add(new VarInsnNode(Opcodes.ALOAD, 2));
il0.add(new VarInsnNode(Opcodes.ALOAD, 3));
il0.add(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$SkinAvailableCallback;)[Ljava/lang/Object;", false));
for (int i = 0, len = args.length; i < len; i++) {
il0.add(new InsnNode(Opcodes.DUP));
il0.add(new IntInsnNode(Opcodes.BIPUSH, i));
il0.add(new InsnNode(Opcodes.AALOAD));
il0.add(new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
il0.add(new InsnNode(Opcodes.SWAP));
}
il0.add(new InsnNode(Opcodes.POP));
mn.instructions.insertBefore(min, il0);
// This is only for 1.12.2-
InsnList il1 = new InsnList();
il1.add(new VarInsnNode(Opcodes.ALOAD, 3));
il1.add(new VarInsnNode(Opcodes.ALOAD, 4));
il1.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeClientPlayer", "putCache", "(Lnet/minecraft/client/renderer/ThreadDownloadImageData;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/ThreadDownloadImageData;", false));
mn.instructions.insert(min, il1);
}
}
}
return mn; return mn;
} }
} }
@@ -76,16 +129,15 @@ public class SkinManagerTransformer {
public static class LoadProfileTexturesTransformer implements TransformerManager.IMethodTransformer { public static class LoadProfileTexturesTransformer implements TransformerManager.IMethodTransformer {
@Override @Override
public MethodNode transform(ClassNode cn, MethodNode mn) { public MethodNode transform(ClassNode cn, MethodNode mn) {
InsnList il = new InsnList(); for (AbstractInsnNode ain : mn.instructions.toArray()) {
il.add(new VarInsnNode(Opcodes.ALOAD, 0)); if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;")); MethodInsnNode min = (MethodInsnNode) ain;
il.add(new VarInsnNode(Opcodes.ALOAD, 1)); if (TransformerManager.checkClassName(min.owner, "java/util/concurrent/ExecutorService") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "submit") && TransformerManager.checkMethodDesc(min.desc, "(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) {
il.add(new VarInsnNode(Opcodes.ALOAD, 2)); mn.instructions.insertBefore(min, new VarInsnNode(Opcodes.ALOAD, 1));
il.add(new VarInsnNode(Opcodes.ILOAD, 3)); mn.instructions.set(min, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V", false)); }
il.add(new InsnNode(Opcodes.RETURN)); }
il.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null)); }
mn.instructions.insert(il);
return mn; return mn;
} }
} }
@@ -110,4 +162,89 @@ public class SkinManagerTransformer {
return mn; return mn;
} }
} }
@TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.SkinManager$3",
methodNameSrg = "run",
methodNames = "run",
desc = "()V"
)
public static class Run0Transformer implements TransformerManager.IMethodTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.INVOKEINTERFACE) {
MethodInsnNode min = (MethodInsnNode) ain;
if (TransformerManager.checkClassName(min.owner, "com/mojang/authlib/minecraft/MinecraftSessionService") && TransformerManager.checkMethodName(min.owner, min.name, min.desc, "getTextures") && TransformerManager.checkMethodDesc(min.desc, "(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
mn.instructions.set(min, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "getUserProfile", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
break;
}
}
}
return mn;
}
}
@TransformerManager.TransformTarget(
className = "net.minecraft.client.resources.SkinManager$3$1",
methodNameSrg = "run",
methodNames = "run",
desc = "()V"
)
public static class Run1Transformer implements TransformerManager.IMethodTransformer {
@Override
public MethodNode transform(ClassNode cn, MethodNode mn) {
String val$skinAvailableCallback = null;
String this$0 = null;
String val$map = null;
String this$1 = null;
for (FieldNode fn : cn.fields) {
if (val$map == null && TransformerManager.checkFieldDesc(fn.desc, "Ljava/util/Map;")) {
val$map = TransformerManager.mapFieldName(cn.name, fn.name, fn.desc);
} else if (this$1 == null && TransformerManager.checkFieldDesc(fn.desc, "Lnet/minecraft/client/resources/SkinManager$3;")) {
this$1 = TransformerManager.mapFieldName(cn.name, fn.name, fn.desc);
}
}
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain.getOpcode() == Opcodes.GETFIELD) {
FieldInsnNode fin = (FieldInsnNode) ain;
if (TransformerManager.checkClassName(fin.owner, "net/minecraft/client/resources/SkinManager$3")) {
if (TransformerManager.checkFieldDesc(fin.desc, "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;")) {
val$skinAvailableCallback = TransformerManager.mapFieldName(fin.owner, fin.name, fin.desc);
} else if (TransformerManager.checkFieldDesc(fin.desc, "Lnet/minecraft/client/resources/SkinManager;")) {
this$0 = TransformerManager.mapFieldName(fin.owner, fin.name, fin.desc);
}
}
}
}
if (val$skinAvailableCallback != null && this$0 != null && val$map != null && this$1 != null) {
AbstractInsnNode frame = null;
for (AbstractInsnNode ain : mn.instructions.toArray()) {
if (ain instanceof FrameNode) {
frame = ain;
}
if (ain.getOpcode() == Opcodes.RETURN) {
InsnList il = new InsnList();
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3$1", this$1, "Lnet/minecraft/client/resources/SkinManager$3;"));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3", this$0, "Lnet/minecraft/client/resources/SkinManager;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3$1", val$map, "Ljava/util/Map;"));
il.add(new VarInsnNode(Opcodes.ALOAD, 0));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3$1", this$1, "Lnet/minecraft/client/resources/SkinManager$3;"));
il.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$3", val$skinAvailableCallback, "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;"));
il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadElytraTexture", "(Lnet/minecraft/client/resources/SkinManager;Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V", false));
mn.instructions.insertBefore(ain, il);
}
}
mn.instructions.set(frame, new FrameNode(Opcodes.F_SAME, 0, null, 0, null));
}
return mn;
}
}
} }
+47 -19
View File
@@ -1,29 +1,46 @@
# CustomSkinLoader # CustomSkinLoader
[![Version](https://img.shields.io/github/v/release/xfl03/MCCustomSkinLoader?label=&logo=V&labelColor=E1F5FE&color=5D87BF&style=for-the-badge)](https://github.com/xfl03/MCCustomSkinLoader/tags)
[![CurseForge](https://cf.way2muchnoise.eu/short_CustomSkinLoader.svg?badge_style=for_the_badge)](https://www.curseforge.com/minecraft/mc-mods/customskinloader)
[![Modrinth](https://img.shields.io/modrinth/dt/idMHQ4n2?label=&logo=Modrinth&labelColor=white&color=00AF5C&style=for-the-badge)](https://modrinth.com/mod/customskinloader)
[![License](https://img.shields.io/github/license/xfl03/MCCustomSkinLoader?label=&logo=c&style=for-the-badge&color=A8B9CC&labelColor=455A64)](https://github.com/xfl03/MCCustomSkinLoader/blob/14-develop/LICENSE)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/xfl03/MCCustomSkinLoader/beta.yml?style=for-the-badge&label=&logo=Gradle&labelColor=388E3C)](https://github.com/xfl03/MCCustomSkinLoader/actions)
[![Star](https://img.shields.io/github/stars/xfl03/MCCustomSkinLoader?label=&logo=GitHub&labelColor=black&color=FAFAFA&style=for-the-badge)](https://github.com/xfl03/MCCustomSkinLoader/stargazers)
[![Minecraft Version](https://img.shields.io/badge/Minecraft-1.20%20|%201.19%20|%201.18%20|%201.17%20|%201.16%20|%201.15%20|%201.14%20|%201.13%20|%201.12%20|%201.11%20|%201.10%20|%201.9%20|%201.8-green?style=for-the-badge&labelColor=388E3C&color=8BC34A)](https://github.com/xfl03/MCCustomSkinLoader)
## What's this? ## What's this?
Custom Skin Loader mod for Minecraft. Custom Skin Loader mod for Minecraft.
It's a mod which can load skins and capes from any online source or from your local. It's a mod which can load skins and capes from any online source or from your local.
## Download ## Download
Latest version could be found in [CurseForge](https://minecraft.curseforge.com/projects/customskinloader) or [Modrinth](https://modrinth.com/mod/customskinloader). ### Release Build
中文用户也可以从[33 Kit](https://3-3.dev/csl-download)获取最新版本。 - [CurseForge](https://minecraft.curseforge.com/projects/customskinloader)
- [Modrinth](https://modrinth.com/mod/customskinloader)
Build Server : [CircleCI](https://circleci.com/gh/xfl03/MCCustomSkinLoader) & ~~[Infinity Studio CI](https://ci.infstudio.net/job/CustomSkinLoader/)~~ ### Develop Build
Release Page : [MCBBS](http://www.mcbbs.net/thread-269807-1-1.html) & [GitHub](https://github.com/xfl03/MCCustomSkinLoader/releases) & [CurseForge](https://minecraft.curseforge.com/projects/customskinloader) & [Modrinth](https://modrinth.com/mod/customskinloader) & [33 Kit](https://3-3.dev/csl-download) - [GitHub Action](https://github.com/xfl03/MCCustomSkinLoader/actions)
- [33 Kit(Chinese/中文)](https://3-3.dev/csl-download)
## Contact Us ## Contact Us
[QQ Group](https://im.qq.com/): [651287593](https://jq.qq.com/?_wv=1027&k=vF16R5tg) - [Telegram @customskinloader](https://t.me/customskinloader)
[Telegram](https://telegram.org/): [@customskinloader](https://t.me/customskinloader) - [QQ Group(Chinese/中文) 651287593](https://jq.qq.com/?_wv=1027&k=vF16R5tg)
## Feature ## Feature
### Support Plenty of Skin Load API and Customizable Skin Load List ### Support Plenty of Skin Load API and Customizable Skin Load List
Supported Skin Load APIs: Supported skin loading APIs:
- [Mojang API](http://wiki.vg/Mojang_API) - [MojangAPI](http://wiki.vg/Mojang_API)
- [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI) - [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI)
- CustomSkinAPIPlus (Test Only) - CustomSkinAPIPlus (Test Only)
- [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc) - [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc)
- [ElyByAPI](http://docs.ely.by/api.html) - [ElyByAPI](https://docs.ely.by/en/api.html)
- Legacy - Legacy
Supported special skin sites:
- **ANY SITE** implements skin loading API above
- [Glitchless](https://games.glitchless.ru/games/minecraft/)
- [MinecraftCapes](https://minecraftcapes.net/)
- [Wynntils](https://wynntils.com/)
You can use this feature to customize your skin load list so as to load your skins from any skin server you want. You can use this feature to customize your skin load list so as to load your skins from any skin server you want.
If you are the owner of skin server, you can use CustomSkinLoader to load skins from your server if one of the APIs has been actualized by your server. If you are the owner of skin server, you can use CustomSkinLoader to load skins from your server if one of the APIs has been actualized by your server.
@@ -58,13 +75,21 @@ The problem of incorrectly rendering textures has been fixed.
By using this mod, you can see correct avatar of players in Spectator Menu rather than steve and alex. By using this mod, you can see correct avatar of players in Spectator Menu rather than steve and alex.
## Default Load List ## Default Load List
- [Mojang](http://www.minecraft.net/) (Mojang API) - [Mojang](http://www.minecraft.net/) (MojangAPI)
- [LittleSkin](https://littleskin.cn/) (CustomSkinAPI) - [LittleSkin](https://littleskin.cn/) (CustomSkinAPI)
- [Blessing Skin](http://skin.prinzeugen.net/) (CustomSkinAPI) - [BlessingSkin](http://skin.prinzeugen.net/) (CustomSkinAPI)
- [ElyBy](http://docs.ely.by/) (ElyByAPI) - [ElyBy](http://docs.ely.by/) (ElyByAPI)
- SkinMe (UniSkinAPI) - SkinMe (UniSkinAPI)
- [TLauncher](https://tlauncher.org/) (ElyByAPI) - [TLauncher](https://tlauncher.org/) (ElyByAPI)
- [Glitchless](https://games.glitchless.ru/games/minecraft/)
- LocalSkin (Legacy) - LocalSkin (Legacy)
- [MinecraftCapes](https://minecraftcapes.net/)
- [OptiFineCape](https://optifine.net/home)
- [Wynntils](https://wynntils.com/)
- [Cloaks+](https://cloaksplus.com/)
- [LabyMod](https://www.labymod.net/en)
- [Cosmetica](https://cosmetica.cc/)
If you want to apply to add other skin server to default list, please go to [issue](https://github.com/JLChnToZ/MCCustomSkinLoader/issues). If you want to apply to add other skin server to default list, please go to [issue](https://github.com/JLChnToZ/MCCustomSkinLoader/issues).
## To Skin Server Owner ## To Skin Server Owner
@@ -78,26 +103,29 @@ You can also use 'ExtraList' which makes it easier for users to add your server
See [CONTRIBUTING.md](CONTRIBUTING.md) See [CONTRIBUTING.md](CONTRIBUTING.md)
## Copyright & LICENSE ## Copyright & LICENSE
### Major Contributor
- 2013-2014 Jeremy Lam([JLChnToZ](https://github.com/JLChnToZ))
- 2014-2023 Alexander Xia([xfl03](https://github.com/xfl03))
- 2020-2023 [ZekerZhayard](https://github.com/ZekerZhayard)
### Binary File ### Binary File
You could not modify binary file. You could not modify binary file.
Feel free to use and share this mod and unmodified file in anyway like modpack. Feel free to use and share this mod and unmodified file in anyway like modpack.
When using in modpack, you must put 'CustomSkinLoader' in mod list. When using in modpack, you must put 'CustomSkinLoader' in mod list.
You could not repost this mod to any website without permission. You could not repost this mod to any website without permission.
You could not earn money with this mod excluding modpack. You could not earn money with this mod excluding modpack.
### Source Code ### Source Code
#### Package 'customskinloader' #### Package 'customskinloader'
Including some codes from Including some codes from
- [AsteriskTeam/TabIconHackForge](http://git.oschina.net/AsteriskTeam/TabIconHackForge) (GPLv3) - [AsteriskTeam/TabIconHackForge](https://gitee.com/AsteriskTeam/TabIconHackForge) (GPLv3)
- [RecursiveG/UniSkinMod](https://github.com/RecursiveG/UniSkinMod) (GPLv3) - [RecursiveG/UniSkinMod](https://github.com/RecursiveG/UniSkinMod) (GPLv3)
- [NekoCaffeine/Alchemy](https://github.com/NekoCaffeine/Alchemy) (GPLv3) - [NekoCaffeine/Alchemy](https://github.com/NekoCaffeine/Alchemy) (GPLv3)
Copyright © 2013-2014 Jeremy Lam "JLChnToZ". ```
Copyright © 2014-2019 Alexander Xia "xfl03". This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ```
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
GPLv3: http://www.gnu.org/licenses/gpl.html GPLv3: http://www.gnu.org/licenses/gpl.html
You should change the name of the package to avoid others' misunderstanding. You should change the name of the package to avoid others' misunderstanding.
+4 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; O func_195551_G ()Lnet/minecraft/resources/IResourceManager; O
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; func_229267_b_
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; getTexture
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V func_229263_a_
net/minecraft/client/Minecraft bib net/minecraft/client/Minecraft bib
gameDir w gameDir w
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; C getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; C
getMinecraft ()Lnet/minecraft/client/Minecraft; z getMinecraft ()Lnet/minecraft/client/Minecraft; z
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; O getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; O
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; X
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Y getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Y
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; N getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; N
net/minecraft/client/gui/GuiPlayerTabOverlay bjq net/minecraft/client/gui/GuiPlayerTabOverlay bjq
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer but
net/minecraft/client/renderer/ThreadDownloadImageData cdh net/minecraft/client/renderer/ThreadDownloadImageData cdh
net/minecraft/client/renderer/entity/RenderPlayer cct net/minecraft/client/renderer/entity/RenderPlayer cct
net/minecraft/client/renderer/entity/layers/LayerCape cbr net/minecraft/client/renderer/entity/layers/LayerCape cbr
net/minecraft/client/renderer/texture/DownloadingTexture cdh
net/minecraft/client/renderer/texture/ITextureObject cds net/minecraft/client/renderer/texture/ITextureObject cds
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V func_195699_a func_195699_a (IIIIIIZZ)V func_195699_a
@@ -47,20 +38,21 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195714_b ()I func_195714_b func_195714_b ()I func_195714_b
func_195715_a (IIIII)V func_195715_a func_195715_a (IIIII)V func_195715_a
net/minecraft/client/renderer/texture/SimpleTexture cdm net/minecraft/client/renderer/texture/SimpleTexture cdm
net/minecraft/client/renderer/texture/Texture cdf
net/minecraft/client/renderer/texture/TextureManager cdr net/minecraft/client/renderer/texture/TextureManager cdr
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z a
net/minecraft/client/renderer/texture/ThreadDownloadImageData cdh
net/minecraft/client/resources/DefaultPlayerSkin cef net/minecraft/client/resources/DefaultPlayerSkin cef
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource ceo net/minecraft/client/resources/IResource ceo
getInputStream ()Ljava/io/InputStream; b getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager cep net/minecraft/client/resources/IResourceManager cep
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
net/minecraft/client/resources/SkinManager cex net/minecraft/client/resources/SkinManager cex
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/SkinManager$3 cex$3
field_152801_c c
field_152802_d d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback cex$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback cex$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/resources/IResource ceo net/minecraft/resources/IResource ceo
+11
View File
@@ -9,6 +9,8 @@ net/minecraft/client/gui/GuiPlayerTabOverlay bjq
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_238523_a_ renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_238523_a_
net/minecraft/client/gui/spectator/PlayerMenuObject boo net/minecraft/client/gui/spectator/PlayerMenuObject boo
net/minecraft/client/model/ModelRenderer brs net/minecraft/client/model/ModelRenderer brs
net/minecraft/client/renderer/IImageBuffer but
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/IRenderTypeBuffer
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; func_228634_a_ getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; func_228634_a_
net/minecraft/client/renderer/ThreadDownloadImageData cdh net/minecraft/client/renderer/ThreadDownloadImageData cdh
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape cbr
net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage
net/minecraft/client/renderer/texture/TextureManager cdr net/minecraft/client/renderer/texture/TextureManager cdr
net/minecraft/client/resources/SkinManager cex net/minecraft/client/resources/SkinManager cex
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_210275_a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_229297_b_
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 cex$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 cex$3$1
field_152803_a a
field_152804_b b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback cex$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback cex$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/scoreboard/ScoreObjective bhg net/minecraft/scoreboard/ScoreObjective bhg
net/minecraft/scoreboard/Scoreboard bhk net/minecraft/scoreboard/Scoreboard bhk
net/minecraft/util/ResourceLocation nf net/minecraft/util/ResourceLocation nf
@@ -9,7 +9,8 @@
"MixinMinecraft", "MixinMinecraft",
"MixinPlayerMenuObject", "MixinPlayerMenuObject",
"MixinSkinManager", "MixinSkinManager",
"MixinTextureManager", "MixinSkinManager$3",
"MixinSkinManager$3$1",
"MixinThreadDownloadImageDataV1" "MixinThreadDownloadImageDataV1"
], ],
"refmap": "mixins.customskinloader.refmap.json", "refmap": "mixins.customskinloader.refmap.json",
+4 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; N func_195551_G ()Lnet/minecraft/resources/IResourceManager; N
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; b
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; getTexture
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V a
net/minecraft/client/Minecraft djz net/minecraft/client/Minecraft djz
gameDir n gameDir n
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; E getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; E
getMinecraft ()Lnet/minecraft/client/Minecraft; C getMinecraft ()Lnet/minecraft/client/Minecraft; C
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; N getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; N
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; Y
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Z getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Z
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; M getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; M
net/minecraft/client/gui/GuiPlayerTabOverlay dly net/minecraft/client/gui/GuiPlayerTabOverlay dly
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageB
net/minecraft/client/renderer/ThreadDownloadImageData ejt net/minecraft/client/renderer/ThreadDownloadImageData ejt
net/minecraft/client/renderer/entity/RenderPlayer ejk net/minecraft/client/renderer/entity/RenderPlayer ejk
net/minecraft/client/renderer/entity/layers/LayerCape ehu net/minecraft/client/renderer/entity/layers/LayerCape ehu
net/minecraft/client/renderer/texture/DownloadingTexture ejt
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage det net/minecraft/client/renderer/texture/NativeImage det
func_195699_a (IIIIIIZZ)V a func_195699_a (IIIIIIZZ)V a
@@ -47,20 +38,21 @@ net/minecraft/client/renderer/texture/NativeImage det
func_195714_b ()I b func_195714_b ()I b
func_195715_a (IIIII)V a func_195715_a (IIIII)V a
net/minecraft/client/renderer/texture/SimpleTexture ejy net/minecraft/client/renderer/texture/SimpleTexture ejy
net/minecraft/client/renderer/texture/Texture ejq
net/minecraft/client/renderer/texture/TextureManager ekd net/minecraft/client/renderer/texture/TextureManager ekd
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData ejt
net/minecraft/client/resources/DefaultPlayerSkin ekj net/minecraft/client/resources/DefaultPlayerSkin ekj
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource acg net/minecraft/client/resources/IResource acg
getInputStream ()Ljava/io/InputStream; b getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager ach net/minecraft/client/resources/IResourceManager ach
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
net/minecraft/client/resources/SkinManager eks net/minecraft/client/resources/SkinManager eks
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/SkinManager$3 eks$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback eks$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback eks$a
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/resources/IResource acg net/minecraft/resources/IResource acg
+11
View File
@@ -7,7 +7,9 @@ net/minecraft/client/entity/AbstractClientPlayer dzj
net/minecraft/client/gui/GuiPlayerTabOverlay dly net/minecraft/client/gui/GuiPlayerTabOverlay dly
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
net/minecraft/client/gui/spectator/PlayerMenuObject ehx
net/minecraft/client/model/ModelRenderer dwn net/minecraft/client/model/ModelRenderer dwn
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
net/minecraft/client/renderer/IRenderTypeBuffer eag net/minecraft/client/renderer/IRenderTypeBuffer eag
net/minecraft/client/renderer/RenderType eao net/minecraft/client/renderer/RenderType eao
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape ehu
net/minecraft/client/renderer/texture/NativeImage det net/minecraft/client/renderer/texture/NativeImage det
net/minecraft/client/renderer/texture/TextureManager ekd net/minecraft/client/renderer/texture/TextureManager ekd
net/minecraft/client/resources/SkinManager eks net/minecraft/client/resources/SkinManager eks
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V b
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 eks$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 eks$3$1
field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback eks$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback eks$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective ddk net/minecraft/scoreboard/ScoreObjective ddk
net/minecraft/scoreboard/Scoreboard ddn net/minecraft/scoreboard/Scoreboard ddn
net/minecraft/util/ResourceLocation vk net/minecraft/util/ResourceLocation vk
@@ -10,7 +10,8 @@
"MixinMinecraft", "MixinMinecraft",
"MixinRenderPlayer", "MixinRenderPlayer",
"MixinSkinManager", "MixinSkinManager",
"MixinTextureManager", "MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV2" "MixinThreadDownloadImageDataV2"
], ],
"refmap": "mixins.customskinloader.refmap.json", "refmap": "mixins.customskinloader.refmap.json",
+4 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; N func_195551_G ()Lnet/minecraft/resources/IResourceManager; N
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; b
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; b
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V a
net/minecraft/client/Minecraft dyr net/minecraft/client/Minecraft dyr
gameDir o gameDir o
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; F getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; F
getMinecraft ()Lnet/minecraft/client/Minecraft; D getMinecraft ()Lnet/minecraft/client/Minecraft; D
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; N getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; N
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; X
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Y getSkinManager ()Lnet/minecraft/client/resources/SkinManager; Y
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; M getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; M
net/minecraft/client/gui/GuiPlayerTabOverlay eau net/minecraft/client/gui/GuiPlayerTabOverlay eau
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageB
net/minecraft/client/renderer/ThreadDownloadImageData fap net/minecraft/client/renderer/ThreadDownloadImageData fap
net/minecraft/client/renderer/entity/RenderPlayer faf net/minecraft/client/renderer/entity/RenderPlayer faf
net/minecraft/client/renderer/entity/layers/LayerCape eyo net/minecraft/client/renderer/entity/layers/LayerCape eyo
net/minecraft/client/renderer/texture/DownloadingTexture fap
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage dsn net/minecraft/client/renderer/texture/NativeImage dsn
func_195699_a (IIIIIIZZ)V a func_195699_a (IIIIIIZZ)V a
@@ -47,20 +38,21 @@ net/minecraft/client/renderer/texture/NativeImage dsn
func_195714_b ()I b func_195714_b ()I b
func_195715_a (IIIII)V a func_195715_a (IIIII)V a
net/minecraft/client/renderer/texture/SimpleTexture fau net/minecraft/client/renderer/texture/SimpleTexture fau
net/minecraft/client/renderer/texture/Texture fam
net/minecraft/client/renderer/texture/TextureManager faz net/minecraft/client/renderer/texture/TextureManager faz
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData fap
net/minecraft/client/resources/DefaultPlayerSkin fbf net/minecraft/client/resources/DefaultPlayerSkin fbf
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource afz net/minecraft/client/resources/IResource afz
getInputStream ()Ljava/io/InputStream; b getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager aga net/minecraft/client/resources/IResourceManager aga
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
net/minecraft/client/resources/SkinManager fbo net/minecraft/client/resources/SkinManager fbo
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/SkinManager$3 fbo$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fbo$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback fbo$a
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/resources/IResource afz net/minecraft/resources/IResource afz
+11
View File
@@ -7,7 +7,9 @@ net/minecraft/client/entity/AbstractClientPlayer ept
net/minecraft/client/gui/GuiPlayerTabOverlay eau net/minecraft/client/gui/GuiPlayerTabOverlay eau
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
net/minecraft/client/gui/spectator/PlayerMenuObject ehx
net/minecraft/client/model/ModelRenderer emb net/minecraft/client/model/ModelRenderer emb
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
net/minecraft/client/renderer/IRenderTypeBuffer eqs net/minecraft/client/renderer/IRenderTypeBuffer eqs
net/minecraft/client/renderer/RenderType era net/minecraft/client/renderer/RenderType era
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape eyo
net/minecraft/client/renderer/texture/NativeImage dsn net/minecraft/client/renderer/texture/NativeImage dsn
net/minecraft/client/renderer/texture/TextureManager faz net/minecraft/client/renderer/texture/TextureManager faz
net/minecraft/client/resources/SkinManager fbo net/minecraft/client/resources/SkinManager fbo
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V b
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 fbo$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 fbo$3$1
field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fbo$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback fbo$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective dqj net/minecraft/scoreboard/ScoreObjective dqj
net/minecraft/scoreboard/Scoreboard dqm net/minecraft/scoreboard/Scoreboard dqm
net/minecraft/util/ResourceLocation yt net/minecraft/util/ResourceLocation yt
@@ -10,7 +10,8 @@
"MixinMinecraft", "MixinMinecraft",
"MixinRenderPlayer", "MixinRenderPlayer",
"MixinSkinManager", "MixinSkinManager",
"MixinTextureManager", "MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV3" "MixinThreadDownloadImageDataV3"
], ],
"refmap": "mixins.customskinloader.refmap.json", "refmap": "mixins.customskinloader.refmap.json",
@@ -1,43 +1,34 @@
customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIResource$V1 customskinloader/fake/itf/IFakeIResource$V1
func_199027_b ()Ljava/io/InputStream; func_199027_b func_199027_b ()Ljava/io/InputStream; func_199027_b
customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2 customskinloader/fake/itf/IFakeIResource$V2
open ()Ljava/io/InputStream; b open ()Ljava/io/InputStream; d
customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeIResourceManager
func_199002_a (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/resources/IResource; func_199002_a func_199002_a (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/resources/IResource; func_199002_a
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; S func_195551_G ()Lnet/minecraft/resources/IResourceManager; Y
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1 net/minecraft/client/Minecraft emh
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; b
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; b
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V a
net/minecraft/client/Minecraft efu
gameDir p gameDir p
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; func_152344_a getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; P
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; K getMinecraft ()Lnet/minecraft/client/Minecraft; N
getMinecraft ()Lnet/minecraft/client/Minecraft; I getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; Y
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; S getSkinManager ()Lnet/minecraft/client/resources/SkinManager; ak
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; ac getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; X
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; ad net/minecraft/client/gui/GuiPlayerTabOverlay eoz
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; R net/minecraft/client/gui/spectator/PlayerMenuObject eya
net/minecraft/client/gui/GuiPlayerTabOverlay eii net/minecraft/client/multiplayer/ServerData fdq
net/minecraft/client/gui/spectator/PlayerMenuObject epw
net/minecraft/client/multiplayer/ServerData evb
serverIP b serverIP b
net/minecraft/client/renderer/RenderType faa net/minecraft/client/renderer/RenderType fio
func_228644_e_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; h func_228644_e_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; h
net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
func_195786_a (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; func_195786_a func_195786_a (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; func_195786_a
parseUserSkin (Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage; func_78432_a parseUserSkin (Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage; func_78432_a
skinAvailable ()V func_152634_a skinAvailable ()V func_152634_a
net/minecraft/client/renderer/ThreadDownloadImageData fjv net/minecraft/client/renderer/ThreadDownloadImageData fsq
net/minecraft/client/renderer/entity/RenderPlayer fjk net/minecraft/client/renderer/entity/RenderPlayer fsf
net/minecraft/client/renderer/entity/layers/LayerCape fhs net/minecraft/client/renderer/entity/layers/LayerCape fqn
net/minecraft/client/renderer/texture/DownloadingTexture fjv
net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject
net/minecraft/client/renderer/texture/NativeImage dzq net/minecraft/client/renderer/texture/NativeImage egf
func_195699_a (IIIIIIZZ)V a func_195699_a (IIIIIIZZ)V a
func_195700_a (III)V a func_195700_a (III)V a
func_195702_a ()I a func_195702_a ()I a
@@ -46,25 +37,26 @@ net/minecraft/client/renderer/texture/NativeImage dzq
func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; a func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; a
func_195714_b ()I b func_195714_b ()I b
func_195715_a (IIIII)V a func_195715_a (IIIII)V a
net/minecraft/client/renderer/texture/SimpleTexture fka net/minecraft/client/renderer/texture/SimpleTexture fsv
net/minecraft/client/renderer/texture/Texture fjs net/minecraft/client/renderer/texture/TextureManager ftd
net/minecraft/client/renderer/texture/TextureManager fkf
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a
net/minecraft/client/renderer/texture/ThreadDownloadImageData fjv net/minecraft/client/resources/DefaultPlayerSkin ftt
net/minecraft/client/resources/DefaultPlayerSkin fkl
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a net/minecraft/client/resources/IResource alf
net/minecraft/client/resources/IResource aik getInputStream ()Ljava/io/InputStream; d
getInputStream ()Ljava/io/InputStream; b net/minecraft/client/resources/IResourceManager alh
net/minecraft/client/resources/IResourceManager aim
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
net/minecraft/client/resources/SkinManager fku net/minecraft/client/resources/SkinManager fub
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fku$a loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/SkinManager$3 fub$3
field_152801_c field_152801_c
field_152802_d field_152802_d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fub$a
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/resources/IResource aik net/minecraft/resources/IResource alf
net/minecraft/resources/IResourceManager aim net/minecraft/resources/IResourceManager alh
net/minecraft/util/ResourceLocation abb net/minecraft/util/ResourceLocation add
net/minecraft/util/StringUtils amx net/minecraft/util/StringUtils aqb
stripControlCodes (Ljava/lang/String;)Ljava/lang/String; a stripControlCodes (Ljava/lang/String;)Ljava/lang/String; a
@@ -1,8 +1,8 @@
minecraft_version=1.19.2 minecraft_version=1.19.4
minecraft_full_versions=1.19.2 minecraft_full_versions=1.19.4
java_full_versions=16,17,18 java_full_versions=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
mappings_version=stable_39 mappings_version=stable_39
srg_notch_map=1.19.2.tsrg srg_notch_map=1.19.4.tsrg
@@ -1,35 +1,46 @@
com/mojang/blaze3d/matrix/MatrixStack eaq com/mojang/blaze3d/matrix/MatrixStack ehe
net/minecraft/client/Minecraft efu net/minecraft/client/Minecraft emh
isIntegratedServerRunning ()Z L isIntegratedServerRunning ()Z Q
net/minecraft/client/entity/AbstractClientPlayer eyt net/minecraft/client/entity/AbstractClientPlayer fhh
getDownloadImageSkin (Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)Lnet/minecraft/client/renderer/ThreadDownloadImageData; a getDownloadImageSkin (Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)Lnet/minecraft/client/renderer/ThreadDownloadImageData; a
getLocationSkin (Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; c getLocationSkin (Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; c
net/minecraft/client/gui/GuiPlayerTabOverlay eii net/minecraft/client/gui/GuiPlayerTabOverlay eoz
renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_175249_a renderPlayerlist (ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V a
net/minecraft/client/model/ModelRenderer eue net/minecraft/client/gui/spectator/PlayerMenuObject eya
net/minecraft/client/renderer/IRenderTypeBuffer ezs net/minecraft/client/model/ModelRenderer fcr
net/minecraft/client/renderer/RenderType faa net/minecraft/client/renderer/IImageBuffer net/minecraft/client/renderer/IImageBuffer
net/minecraft/client/renderer/IRenderTypeBuffer fig
net/minecraft/client/renderer/RenderType fio
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; b
net/minecraft/client/renderer/ThreadDownloadImageData fjv net/minecraft/client/renderer/ThreadDownloadImageData fsq
bufferedImage field_110560_d bufferedImage field_110560_d
textureUploaded o textureUploaded o
processTask m processTask m
loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; a loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; a
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; c processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; c
net/minecraft/client/renderer/entity/RenderPlayer fjk net/minecraft/client/renderer/entity/RenderPlayer fsf
renderItem (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;Lnet/minecraft/client/model/ModelRenderer;Lnet/minecraft/client/model/ModelRenderer;)V a renderItem (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;Lnet/minecraft/client/model/ModelRenderer;Lnet/minecraft/client/model/ModelRenderer;)V a
renderItem (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;Lnet/minecraft/client/entity/AbstractClientPlayer;Lnet/minecraft/client/model/ModelRenderer;Lnet/minecraft/client/model/ModelRenderer;)V func_229145_a_ renderItem (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;Lnet/minecraft/client/entity/AbstractClientPlayer;Lnet/minecraft/client/model/ModelRenderer;Lnet/minecraft/client/model/ModelRenderer;)V func_229145_a_
net/minecraft/client/renderer/entity/layers/LayerCape fhs net/minecraft/client/renderer/entity/layers/LayerCape fqn
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V a doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V a
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V func_225628_a_ doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V func_225628_a_
net/minecraft/client/renderer/texture/NativeImage dzq net/minecraft/client/renderer/texture/NativeImage egf
net/minecraft/client/renderer/texture/TextureManager fkf net/minecraft/client/renderer/texture/TextureManager ftd
net/minecraft/client/resources/SkinManager fku net/minecraft/client/resources/SkinManager fub
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V b
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fku$a net/minecraft/client/resources/SkinManager$3 fub$3
net/minecraft/scoreboard/ScoreObjective dxl run ()V run
net/minecraft/scoreboard/Scoreboard dxo net/minecraft/client/resources/SkinManager$3$1 fub$3$1
net/minecraft/util/ResourceLocation abb field_152803_a field_152803_a
field_152804_b field_152804_b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback fub$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
net/minecraft/scoreboard/ScoreObjective edz
net/minecraft/scoreboard/Scoreboard eec
net/minecraft/util/ResourceLocation add
@@ -10,7 +10,8 @@
"MixinMinecraft", "MixinMinecraft",
"MixinRenderPlayer", "MixinRenderPlayer",
"MixinSkinManager", "MixinSkinManager",
"MixinTextureManager", "MixinSkinManager$V1",
"MixinSkinManager$V2",
"MixinThreadDownloadImageDataV3" "MixinThreadDownloadImageDataV3"
], ],
"refmap": "mixins.customskinloader.refmap.json", "refmap": "mixins.customskinloader.refmap.json",
+4 -12
View File
@@ -7,19 +7,11 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI
getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource
customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft
func_195551_G ()Lnet/minecraft/resources/IResourceManager; Q func_195551_G ()Lnet/minecraft/resources/IResourceManager; Q
customskinloader/fake/itf/IFakeTextureManager$V1 customskinloader/fake/itf/IFakeTextureManager$V1
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Z func_229263_a_
func_229267_b_ (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/Texture; func_229267_b_
getTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)Lnet/minecraft/client/renderer/texture/Texture; getTexture
customskinloader/fake/itf/IFakeTextureManager$V2 customskinloader/fake/itf/IFakeTextureManager$V2
func_229263_a_ (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/Texture;)V func_229263_a_
net/minecraft/client/Minecraft ave net/minecraft/client/Minecraft ave
gameDir v gameDir v
addScheduledTask (Ljava/lang/Runnable;)Lcom/google/common/util/concurrent/ListenableFuture; a
getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; D getCurrentServerData ()Lnet/minecraft/client/multiplayer/ServerData; D
getMinecraft ()Lnet/minecraft/client/Minecraft; A getMinecraft ()Lnet/minecraft/client/Minecraft; A
getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; Q getResourceManager ()Lnet/minecraft/client/resources/IResourceManager; Q
getSessionService ()Lcom/mojang/authlib/minecraft/MinecraftSessionService; aa
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; ab getSkinManager ()Lnet/minecraft/client/resources/SkinManager; ab
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; P getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; P
net/minecraft/client/gui/GuiPlayerTabOverlay awh net/minecraft/client/gui/GuiPlayerTabOverlay awh
@@ -35,7 +27,6 @@ net/minecraft/client/renderer/IImageBuffer bfm
net/minecraft/client/renderer/ThreadDownloadImageData bma net/minecraft/client/renderer/ThreadDownloadImageData bma
net/minecraft/client/renderer/entity/RenderPlayer bln net/minecraft/client/renderer/entity/RenderPlayer bln
net/minecraft/client/renderer/entity/layers/LayerCape bkp net/minecraft/client/renderer/entity/layers/LayerCape bkp
net/minecraft/client/renderer/texture/DownloadingTexture bma
net/minecraft/client/renderer/texture/ITextureObject bmk net/minecraft/client/renderer/texture/ITextureObject bmk
net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage
func_195699_a (IIIIIIZZ)V func_195699_a func_195699_a (IIIIIIZZ)V func_195699_a
@@ -47,20 +38,21 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na
func_195714_b ()I func_195714_b func_195714_b ()I func_195714_b
func_195715_a (IIIII)V func_195715_a func_195715_a (IIIII)V func_195715_a
net/minecraft/client/renderer/texture/SimpleTexture bme net/minecraft/client/renderer/texture/SimpleTexture bme
net/minecraft/client/renderer/texture/Texture bly
net/minecraft/client/renderer/texture/TextureManager bmj net/minecraft/client/renderer/texture/TextureManager bmj
getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; b getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; b
loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z a loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z a
net/minecraft/client/renderer/texture/ThreadDownloadImageData bma
net/minecraft/client/resources/DefaultPlayerSkin bmz net/minecraft/client/resources/DefaultPlayerSkin bmz
getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; a
getDefaultSkinLegacy ()Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/IResource bnh net/minecraft/client/resources/IResource bnh
getInputStream ()Ljava/io/InputStream; b getInputStream ()Ljava/io/InputStream; b
net/minecraft/client/resources/IResourceManager bni net/minecraft/client/resources/IResourceManager bni
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
net/minecraft/client/resources/SkinManager bnp net/minecraft/client/resources/SkinManager bnp
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; a
net/minecraft/client/resources/SkinManager$3 bnp$3
field_152801_c c
field_152802_d d
net/minecraft/client/resources/SkinManager$SkinAvailableCallback bnp$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback bnp$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/resources/IResource bnh net/minecraft/resources/IResource bnh
+11
View File
@@ -9,6 +9,8 @@ net/minecraft/client/gui/GuiPlayerTabOverlay awh
renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_238523_a_ renderPlayerlist (Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V func_238523_a_
net/minecraft/client/gui/spectator/PlayerMenuObject bad net/minecraft/client/gui/spectator/PlayerMenuObject bad
net/minecraft/client/model/ModelRenderer bct net/minecraft/client/model/ModelRenderer bct
net/minecraft/client/renderer/IImageBuffer bfm
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/client/renderer/IRenderTypeBuffer
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; func_228634_a_ getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; func_228634_a_
net/minecraft/client/renderer/ThreadDownloadImageData bma net/minecraft/client/renderer/ThreadDownloadImageData bma
@@ -26,10 +28,19 @@ net/minecraft/client/renderer/entity/layers/LayerCape bkp
net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage net/minecraft/client/renderer/texture/NativeImage
net/minecraft/client/renderer/texture/TextureManager bmj net/minecraft/client/renderer/texture/TextureManager bmj
net/minecraft/client/resources/SkinManager bnp net/minecraft/client/resources/SkinManager bnp
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_210275_a
func_229297_b_ (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V func_229297_b_
loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V a
loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; a
loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; a
net/minecraft/client/resources/SkinManager$3 bnp$3
run ()V run
net/minecraft/client/resources/SkinManager$3$1 bnp$3$1
field_152803_a a
field_152804_b b
run ()V run
net/minecraft/client/resources/SkinManager$SkinAvailableCallback bnp$a net/minecraft/client/resources/SkinManager$SkinAvailableCallback bnp$a
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V a
net/minecraft/scoreboard/ScoreObjective auk net/minecraft/scoreboard/ScoreObjective auk
net/minecraft/scoreboard/Scoreboard auo net/minecraft/scoreboard/Scoreboard auo
net/minecraft/util/ResourceLocation jy net/minecraft/util/ResourceLocation jy
@@ -9,7 +9,8 @@
"MixinMinecraft", "MixinMinecraft",
"MixinPlayerMenuObject", "MixinPlayerMenuObject",
"MixinSkinManager", "MixinSkinManager",
"MixinTextureManager", "MixinSkinManager$3",
"MixinSkinManager$3$1",
"MixinThreadDownloadImageDataV1" "MixinThreadDownloadImageDataV1"
], ],
"refmap": "mixins.customskinloader.refmap.json", "refmap": "mixins.customskinloader.refmap.json",
+25 -25
View File
@@ -35,57 +35,57 @@
{ {
"downloads": { "downloads": {
"artifact": { "artifact": {
"path": "org/ow2/asm/asm/9.3/asm-9.3.jar", "path": "org/ow2/asm/asm/9.4/asm-9.4.jar",
"sha1": "8e6300ef51c1d801a7ed62d07cd221aca3a90640", "sha1": "b4e0e2d2e023aa317b7cfcfc916377ea348e07d1",
"size": 122176, "size": 122445,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.3/asm-9.3.jar" "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.4/asm-9.4.jar"
} }
}, },
"name": "org.ow2.asm:asm:9.3" "name": "org.ow2.asm:asm:9.4"
}, },
{ {
"downloads": { "downloads": {
"artifact": { "artifact": {
"path": "org/ow2/asm/asm-analysis/9.3/asm-analysis-9.3.jar", "path": "org/ow2/asm/asm-analysis/9.4/asm-analysis-9.4.jar",
"sha1": "4b071f211b37c38e0e9f5998550197c8593f6ad8", "sha1": "0a5fec9dfc039448d4fd098fbaffcaf55373b223",
"size": 34276, "size": 34331,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/9.3/asm-analysis-9.3.jar" "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/9.4/asm-analysis-9.4.jar"
} }
}, },
"name": "org.ow2.asm:asm-analysis:9.3" "name": "org.ow2.asm:asm-analysis:9.4"
}, },
{ {
"downloads": { "downloads": {
"artifact": { "artifact": {
"path": "org/ow2/asm/asm-commons/9.3/asm-commons-9.3.jar", "path": "org/ow2/asm/asm-commons/9.4/asm-commons-9.4.jar",
"sha1": "1f2a432d1212f5c352ae607d7b61dcae20c20af5", "sha1": "8fc2810ddbcbbec0a8bbccb3f8eda58321839912",
"size": 72716, "size": 72781,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/9.3/asm-commons-9.3.jar" "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/9.4/asm-commons-9.4.jar"
} }
}, },
"name": "org.ow2.asm:asm-commons:9.3" "name": "org.ow2.asm:asm-commons:9.4"
}, },
{ {
"downloads": { "downloads": {
"artifact": { "artifact": {
"path": "org/ow2/asm/asm-tree/9.3/asm-tree-9.3.jar", "path": "org/ow2/asm/asm-tree/9.4/asm-tree-9.4.jar",
"sha1": "78d2ecd61318b5a58cd04fb237636c0e86b77d97", "sha1": "a99175a17d7fdc18cbcbd0e8ea6a5d276844190a",
"size": 52669, "size": 52665,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/9.3/asm-tree-9.3.jar" "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/9.4/asm-tree-9.4.jar"
} }
}, },
"name": "org.ow2.asm:asm-tree:9.3" "name": "org.ow2.asm:asm-tree:9.4"
}, },
{ {
"downloads": { "downloads": {
"artifact": { "artifact": {
"path": "org/ow2/asm/asm-util/9.3/asm-util-9.3.jar", "path": "org/ow2/asm/asm-util/9.4/asm-util-9.4.jar",
"sha1": "9595bc05510d0bd4b610188b77333fe4851a1975", "sha1": "ab1e0a84b72561dbaf1ee260321e72148ebf4b19",
"size": 85682, "size": 91549,
"url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/9.3/asm-util-9.3.jar" "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/9.4/asm-util-9.4.jar"
} }
}, },
"name": "org.ow2.asm:asm-util:9.3" "name": "org.ow2.asm:asm-util:9.4"
}, },
{ {
"downloads": { "downloads": {
@@ -11,8 +11,9 @@ import org.spongepowered.asm.mixin.injection.Redirect;
public abstract class MixinGuiPlayerTabOverlay { public abstract class MixinGuiPlayerTabOverlay {
@Redirect( @Redirect(
method = { method = {
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", // 20w16a-
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V" "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lcom/mojang/blaze3d/matrix/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", // 20w17a ~ 23w14a
"Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(Lnet/minecraft/client/gui/Gui;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V" // 23w16a+
}, },
at = @At( at = @At(
value = "INVOKE", value = "INVOKE",
@@ -0,0 +1,34 @@
package customskinloader.mixin;
import java.util.Map;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.resources.SkinManager$3;
import net.minecraft.client.resources.SkinManager$3$1;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
// For 1.12.2-
@Mixin(SkinManager$3$1.class)
public abstract class MixinSkinManager$3$1 {
@Final
@Shadow
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> field_152803_a;
@Final
@Shadow
SkinManager$3 field_152804_b;
@Inject(
method = "Lnet/minecraft/client/resources/SkinManager$3$1;run()V",
at = @At("RETURN")
)
private void inject_run(CallbackInfo callbackInfo) {
FakeSkinManager.loadElytraTexture(this.field_152804_b.field_152802_d, this.field_152803_a, this.field_152804_b.field_152801_c);
}
}
@@ -0,0 +1,29 @@
package customskinloader.mixin;
import java.util.Map;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.resources.SkinManager$3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
// For 1.12.2-
@Mixin(SkinManager$3.class)
public abstract class MixinSkinManager$3 {
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager$3;run()V",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/authlib/minecraft/MinecraftSessionService;getTextures(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;",
ordinal = 0,
remap = false
)
)
private Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> redirect_run(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
return FakeSkinManager.getUserProfile(sessionService, profile, requireSecure);
}
}
@@ -2,19 +2,31 @@ package customskinloader.mixin;
import java.io.File; import java.io.File;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import com.google.common.collect.ImmutableList;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.minecraft.MinecraftSessionService;
import customskinloader.fake.FakeSkinManager; import customskinloader.fake.FakeSkinManager;
import net.minecraft.client.renderer.IImageBuffer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(SkinManager.class) @Mixin(SkinManager.class)
public abstract class MixinSkinManager { public abstract class MixinSkinManager {
@@ -28,23 +40,116 @@ public abstract class MixinSkinManager {
this.fakeManager = new FakeSkinManager(textureManagerInstance, skinCacheDirectory, sessionService); this.fakeManager = new FakeSkinManager(textureManagerInstance, skinCacheDirectory, sessionService);
} }
@Inject( @ModifyVariable(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;", method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At("HEAD"), at = @At(
cancellable = true value = "STORE",
ordinal = 0
),
ordinal = 0
) )
private void inject_loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback, CallbackInfoReturnable<ResourceLocation> callbackInfoReturnable) { private ResourceLocation modifyVariable_loadSkin(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
callbackInfoReturnable.setReturnValue(this.fakeManager.loadSkin(profileTexture, textureType, skinAvailableCallback)); return FakeSkinManager.setResourceLocation(resourceLocation, profileTexture);
} }
@Inject( @ModifyArg(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V", method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At("HEAD"), at = @At(
cancellable = true value = "INVOKE",
target = "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;skinAvailable(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V"
)
) )
private void inject_loadProfileTextures(GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure, CallbackInfo callbackInfo) { private MinecraftProfileTexture modifyArg_loadSkin(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
this.fakeManager.loadProfileTextures(profile, skinAvailableCallback, requireSecure); return FakeSkinManager.getModelCache(profileTexture, this.fakeManager, location);
callbackInfo.cancel(); }
// 19w37a-
@Group(
name = "modifyArgs_loadSkin",
min = 1
)
@ModifyArgs(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;<init>(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V"
)
)
private void modifyArgs_loadSkin_0(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
Object[] argsArr = new Object[args.size()];
for (int i = 0; i < argsArr.length; i++) {
argsArr[i] = args.get(i);
}
argsArr = FakeSkinManager.createThreadDownloadImageData(ImmutableList.copyOf(argsArr), this.fakeManager, profileTexture, textureType, skinAvailableCallback);
args.setAll(argsArr);
}
// 19w38a+
@Group(
name = "modifyArgs_loadSkin",
min = 1
)
@ModifyArgs(
method = "Lnet/minecraft/client/resources/SkinManager;loadSkin(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;<init>(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V"
)
)
private void modifyArgs_loadSkin_1(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
this.modifyArgs_loadSkin_0(args, profileTexture, textureType, skinAvailableCallback);
}
// 19w37a-
@Group(
name = "redirect_loadProfileTextures",
min = 1
)
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/ExecutorService;submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;",
remap = false
)
)
private Future<?> redirect_loadProfileTextures_0(ExecutorService executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
FakeSkinManager.loadProfileTextures(task, profile);
return null;
}
// 19w38a ~ 1.18-exp7
@Group(
name = "redirect_loadProfileTextures",
min = 1
)
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/Executor;execute(Ljava/lang/Runnable;)V",
remap = false
)
)
private void redirect_loadProfileTextures_1(Executor executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
FakeSkinManager.loadProfileTextures(task, profile);
}
// 21w37a+
@Group(
name = "redirect_loadProfileTextures",
min = 1
)
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;loadProfileTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V",
at = @At(
value = "INVOKE",
target = "Ljava/util/concurrent/ExecutorService;execute(Ljava/lang/Runnable;)V",
remap = false
)
)
private void redirect_loadProfileTextures_2(ExecutorService executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) {
FakeSkinManager.loadProfileTextures(task, profile);
} }
@Inject( @Inject(
@@ -55,4 +160,36 @@ public abstract class MixinSkinManager {
private void inject_loadSkinFromCache(GameProfile profile, CallbackInfoReturnable<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> callbackInfoReturnable) { private void inject_loadSkinFromCache(GameProfile profile, CallbackInfoReturnable<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> callbackInfoReturnable) {
callbackInfoReturnable.setReturnValue(this.fakeManager.loadSkinFromCache(profile)); callbackInfoReturnable.setReturnValue(this.fakeManager.loadSkinFromCache(profile));
} }
// 1.13+
@Mixin(SkinManager.class)
public abstract static class V1 {
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;func_210275_a(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/authlib/minecraft/MinecraftSessionService;getTextures(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;",
remap = false
)
)
private Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> redirect_func_210275_a(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
return FakeSkinManager.getUserProfile(sessionService, profile, requireSecure);
}
}
// 19w38a+
@Mixin(SkinManager.class)
public abstract static class V2 {
@Redirect(
method = "Lnet/minecraft/client/resources/SkinManager;func_229297_b_(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V",
at = @At(
value = "INVOKE",
target = "Lcom/google/common/collect/ImmutableList;of(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;",
remap = false
)
)
private ImmutableList<MinecraftProfileTexture.Type> redirect_func_229297_b_(Object e1, Object e2) {
return ImmutableList.copyOf(MinecraftProfileTexture.Type.values());
}
}
} }
@@ -1,22 +0,0 @@
package customskinloader.mixin;
import customskinloader.fake.itf.IFakeTextureManager;
import net.minecraft.client.renderer.texture.TextureManager;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Mixin;
@Implements({
@Interface(
iface = IFakeTextureManager.V1.class,
prefix = "fake1$"
),
@Interface(
iface = IFakeTextureManager.V2.class,
prefix = "fake2$"
),
})
@Mixin(TextureManager.class)
public abstract class MixinTextureManager {
}
@@ -3,7 +3,8 @@ package customskinloader.tweaker;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import customskinloader.Logger; import customskinloader.log.LogManager;
import customskinloader.log.Logger;
import net.minecraft.launchwrapper.ITweaker; import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import org.spongepowered.asm.mixin.MixinEnvironment; import org.spongepowered.asm.mixin.MixinEnvironment;
@@ -14,8 +15,8 @@ public class ModSystemTweaker implements ITweaker {
public static Logger logger = new Logger(); public static Logger logger = new Logger();
public void acceptOptions(List args, File gameDir, File assetsDir, String profile) { public void acceptOptions(List args, File gameDir, File assetsDir, String profile) {
File tweakerLogFile = new File(gameDir,"./CustomSkinLoader/Tweaker.log"); LogManager.setLogFile(gameDir.toPath().resolve("CustomSkinLoader/CustomSkinLoader.log"));
logger = new Logger(tweakerLogFile); logger = LogManager.getLogger("ModSystemTweaker");
logger.info("Using ModSystemTweaker"); logger.info("Using ModSystemTweaker");
logger.info("ModSystemTweaker: acceptOptions"); logger.info("ModSystemTweaker: acceptOptions");
@@ -3,7 +3,8 @@ package customskinloader.tweaker;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import customskinloader.Logger; import customskinloader.log.LogManager;
import customskinloader.log.Logger;
import net.minecraft.launchwrapper.ITweaker; import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LaunchClassLoader;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@@ -17,8 +18,8 @@ public class Tweaker implements ITweaker {
public static Logger logger = new Logger(); public static Logger logger = new Logger();
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) { public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
File tweakerLogFile = new File(gameDir,"./CustomSkinLoader/Tweaker.log"); LogManager.setLogFile(gameDir.toPath().resolve("CustomSkinLoader/CustomSkinLoader.log"));
logger = new Logger(tweakerLogFile); logger = LogManager.getLogger("VanillaTweaker");
logger.info("Using Tweaker"); logger.info("Using Tweaker");
logger.info("Tweaker: acceptOptions"); logger.info("Tweaker: acceptOptions");
@@ -0,0 +1,11 @@
package net.minecraft.client.resources;
import java.util.Map;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
public class SkinManager$3$1 {
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> field_152803_a;
SkinManager$3 field_152804_b;
public void run() {}
}
@@ -0,0 +1,7 @@
package net.minecraft.client.resources;
public class SkinManager$3 {
public SkinManager.SkinAvailableCallback field_152801_c;
public SkinManager field_152802_d;
public void run() {}
}
+7 -25
View File
@@ -7,27 +7,10 @@ configFile.withReader {
prop.load(it) prop.load(it)
project.ext.config = new ConfigSlurper().parse prop project.ext.config = new ConfigSlurper().parse prop
} }
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.+'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
wrapper { wrapper {
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL
gradleVersion = "4.10.3" gradleVersion = "4.9"
} }
import customskinloader.gradle.util.CurseForgeUtil import customskinloader.gradle.util.CurseForgeUtil
@@ -101,7 +84,7 @@ subprojects {
archivesBaseName = "CustomSkinLoader_${-> VersionUtil.getEdition(project)}" archivesBaseName = "CustomSkinLoader_${-> VersionUtil.getEdition(project)}"
processResources { processResources {
filesNotMatching("**/*.js") { filesNotMatching(["**/*.js", "mixins.*.json"]) {
expand([ expand([
modVersion : rootProject.ext.config.version, modVersion : rootProject.ext.config.version,
modFullVersion : project.version, modFullVersion : project.version,
@@ -109,8 +92,8 @@ subprojects {
mcVersion : config.minecraft_version, mcVersion : config.minecraft_version,
mcFullVersions : config.minecraft_full_versions, mcFullVersions : config.minecraft_full_versions,
forgeVersion : config.forge_version, forgeVersion : config.forge_version,
gitVersion : System.getenv("CIRCLE_SHA1"), gitVersion : System.getenv("CIRCLE_SHA1") ?: System.getenv("GITHUB_SHA"),
buildUrl : System.getenv("CIRCLE_BUILD_URL"), buildUrl : System.getenv("CIRCLE_BUILD_URL") ?: "https://github.com/xfl03/MCCustomSkinLoader/actions/runs/" + System.getenv("GITHUB_RUN_ID"),
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
]) ])
} }
@@ -120,9 +103,8 @@ subprojects {
if (!project.name.toLowerCase().contains("forge/legacy")) { if (!project.name.toLowerCase().contains("forge/legacy")) {
apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.spongepowered.mixin'
dependencies { apply from: rootProject.file("buildSrc/patch.gradle")
implementation 'org.spongepowered:mixin:0.8.5' patchMixin()
}
task genSrgMap { task genSrgMap {
doLast { doLast {
@@ -151,7 +133,7 @@ subprojects {
} }
task signJar(type: SignJar, dependsOn: reobfJar) { task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf { System.getenv("KEY_PASS") != null } onlyIf { System.getenv("KEY_PASS") != null && System.getenv("KEY_PASS") != "" }
doLast { System.out.println("Jar will be signed.") } doLast { System.out.println("Jar will be signed.") }
inputFile = jar.archivePath inputFile = jar.archivePath
+1 -4
View File
@@ -1,6 +1,3 @@
name=CustomSkinLoader name=CustomSkinLoader
group=customskinloader group=customskinloader
version=14.14 version=14.17
dev_version=
#RELEASE: snapshot=0
snapshot=0
+7 -1
View File
@@ -13,6 +13,9 @@ repositories {
maven { maven {
url = "https://maven.minecraftforge.net/" url = "https://maven.minecraftforge.net/"
} }
maven {
url = "https://repo.spongepowered.org/repository/maven-public/"
}
} }
dependencies { dependencies {
@@ -21,7 +24,10 @@ dependencies {
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.9.0")
implementation("commons-io:commons-io:2.11.0") implementation("commons-io:commons-io:2.11.0")
implementation("net.minecraftforge.gradle:ForgeGradle:2.3.+") implementation("net.minecraftforge.gradle:ForgeGradle:2.3.+")
implementation("org.cadixdev:mercury:0.1.0")
implementation("gradle.plugin.com.matthewprenger:CurseGradle:1.4.0") implementation("gradle.plugin.com.matthewprenger:CurseGradle:1.4.0")
implementation("gradle.plugin.com.modrinth.minotaur:Minotaur:1.2.1") implementation("gradle.plugin.com.modrinth.minotaur:Minotaur:1.2.1")
implementation("org.spongepowered:mixingradle:0.6-SNAPSHOT")
} }
apply from: file("patch.gradle")
patchMercury()
+116
View File
@@ -0,0 +1,116 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.ow2.asm:asm-debug-all:5.2"
}
}
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassWriter
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.AbstractInsnNode
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.InsnList
import org.objectweb.asm.tree.MethodInsnNode
import org.objectweb.asm.tree.MethodNode
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
import java.util.zip.ZipOutputStream
configurations {
patchClass
}
void patch(Object dependency, Closure<Boolean> fileFilter, Closure<Boolean> classFilter, Closure<Boolean> methodFilter, Closure<Boolean> nodeFilter, Closure methodPathcer) {
project.dependencies {
patchClass dependency
}
project.afterEvaluate {
project.configurations.patchClass.findAll({ File f -> fileFilter.call(f) }).each { File f ->
def name = "${project.buildDir}/libs/${f.name}"
file(name).parentFile.mkdirs()
def zos = new ZipOutputStream(new FileOutputStream(name))
try {
def zf = new ZipFile(f)
zf.stream().filter({ ZipEntry ze -> classFilter.call(ze.name) }).forEach({ ZipEntry ze ->
def cn = new ClassNode()
new ClassReader(zf.getInputStream(ze).bytes).accept(cn, 0)
cn.methods.findAll({ MethodNode mn -> methodFilter.call(mn) }).each { MethodNode mn ->
mn.instructions.toArray().each { AbstractInsnNode ain ->
if (nodeFilter.call(ain)) {
methodPathcer.call(mn.instructions, ain)
}
}
}
def cw = new ClassWriter(ClassWriter.COMPUTE_MAXS)
cn.accept(cw)
zos.putNextEntry(new ZipEntry(ze.name))
zos.write(cw.toByteArray())
zos.closeEntry()
})
} finally {
zos.close()
}
project.dependencies {
compile files(name)
compile dependency
}
}
}
}
// Mercury assumes that all classes containing '$' are inner classes and ignores classes that contain '$' natively.
void patchMercury() {
this.patch(
"org.cadixdev:mercury:0.1.0",
{ File f ->
f.name == "mercury-0.1.0.jar"
},
{ String name ->
name == "org/cadixdev/mercury/remapper/RemapperVisitor.class"
},
{ MethodNode mn ->
mn.name == "remapType" && mn.desc == "(Lorg/eclipse/jdt/core/dom/SimpleName;Lorg/eclipse/jdt/core/dom/ITypeBinding;)V"
},
{ AbstractInsnNode node ->
node.opcode == Opcodes.ASTORE && node.var == 4
},
{ InsnList list, AbstractInsnNode node ->
list.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/gradle/util/RemapUtil", "fixClassName", "(Ljava/lang/String;)Ljava/lang/String;", false))
}
)
}
// Mixin uses incorrect method for field descriptors to get the signature.
void patchMixin() {
this.patch(
"org.spongepowered:mixin:0.8.5",
{ File f ->
f.name == "mixin-0.8.5.jar"
},
{ String name ->
name == "org/spongepowered/tools/obfuscation/mirror/TypeHandleASM.class"
},
{ MethodNode mn ->
mn.name == "findField" && mn.desc == "(Ljava/lang/String;Ljava/lang/String;Z)Lorg/spongepowered/tools/obfuscation/mirror/FieldHandle;"
},
{ AbstractInsnNode node ->
node.opcode == Opcodes.INVOKESTATIC && node.owner == "org/spongepowered/tools/obfuscation/mirror/TypeUtils" && node.name == "getJavaSignature" && node.desc == "(Ljava/lang/String;)Ljava/lang/String;"
},
{ InsnList list, AbstractInsnNode node ->
list.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "org/objectweb/asm/Type", "getType", "(Ljava/lang/String;)Lorg/objectweb/asm/Type;", false))
list.set(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "org/objectweb/asm/Type", "getClassName", "()Ljava/lang/String;", false))
}
)
}
ext {
patchMixin = this.&patchMixin
patchMercury = this.&patchMercury
}
@@ -1,6 +1,8 @@
package customskinloader.gradle; package customskinloader.gradle;
import customskinloader.gradle.task.UploadTask; import customskinloader.gradle.task.UploadBetaTask;
import customskinloader.gradle.task.UploadCanaryTask;
import customskinloader.gradle.task.UploadReleaseTask;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
@@ -8,7 +10,11 @@ public class BuildPlugin implements Plugin<Project> {
@Override @Override
public void apply(Project project) { public void apply(Project project) {
System.out.printf("Apply project '%s'", project.getName()); System.out.printf("Apply project '%s'", project.getName());
project.getTasks().create("upload", UploadTask.class, project.getTasks().create("upload", UploadReleaseTask.class,
task -> task.rootProject = project.getRootProject());
project.getTasks().create("uploadBeta", UploadBetaTask.class,
task -> task.rootProject = project.getRootProject());
project.getTasks().create("uploadCanary", UploadCanaryTask.class,
task -> task.rootProject = project.getRootProject()); task -> task.rootProject = project.getRootProject());
} }
} }
@@ -3,8 +3,6 @@ package customskinloader.gradle.task;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import customskinloader.gradle.entity.CslDetail; import customskinloader.gradle.entity.CslDetail;
import customskinloader.gradle.entity.CslLatest; import customskinloader.gradle.entity.CslLatest;
@@ -14,14 +12,11 @@ import customskinloader.gradle.util.CosUtil;
import customskinloader.gradle.util.VersionUtil; import customskinloader.gradle.util.VersionUtil;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.tasks.TaskAction;
public class UploadTask extends DefaultTask { public abstract class UploadBaseTask extends DefaultTask {
public Project rootProject; public Project rootProject;
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); private CslLatest uploadArtifacts(String filename) throws IOException {
private CslLatest uploadArtifacts() throws IOException {
String shortVersion = VersionUtil.getShortVersion(rootProject); String shortVersion = VersionUtil.getShortVersion(rootProject);
File dir = rootProject.file("build/libs"); File dir = rootProject.file("build/libs");
if (!dir.isDirectory()) { if (!dir.isDirectory()) {
@@ -36,6 +31,10 @@ public class UploadTask extends DefaultTask {
return null; return null;
} }
for (File file : files) { for (File file : files) {
if (file.getName().endsWith("-sources.jar")) {
//Don't upload sources jar to cos
continue;
}
String key = CosUtil.getKey(file.getName()); String key = CosUtil.getKey(file.getName());
if (key == null) { if (key == null) {
continue; continue;
@@ -56,11 +55,11 @@ public class UploadTask extends DefaultTask {
} }
} }
CosUtil.writeAndUploadObject("latest.json", latest); CosUtil.writeAndUploadObject(filename, latest);
return latest; return latest;
} }
public void uploadDetail(CslLatest latest) throws IOException { private void uploadDetail(CslLatest latest, String filename) throws IOException {
CslDetail detail = new CslDetail(latest.version); CslDetail detail = new CslDetail(latest.version);
rootProject.getAllprojects().stream() rootProject.getAllprojects().stream()
@@ -74,19 +73,20 @@ public class UploadTask extends DefaultTask {
}); });
detail.sortDetails(); detail.sortDetails();
CosUtil.writeAndUploadObject("detail.json", detail); CosUtil.writeAndUploadObject(filename, detail);
} }
@TaskAction protected void uploadBase(String latestJsonName, String detailJsonName) throws IOException, TencentCloudSDKException {
public void upload() throws IOException, TencentCloudSDKException { System.out.printf("latestJsonName: %s, detailJsonName: %s\n", latestJsonName, detailJsonName);
if (System.getenv("COS_SECRET_KEY") == null) { if (System.getenv("COS_SECRET_KEY") == null) {
System.out.println("COS_SECRET_KEY not found.");
return; return;
} }
CslLatest latest = uploadArtifacts(); CslLatest latest = uploadArtifacts(latestJsonName);
if (latest == null) { if (latest == null) {
return; return;
} }
uploadDetail(latest); uploadDetail(latest, detailJsonName);
CdnUtil.updateCdn("latest.json", "detail.json"); CdnUtil.updateCdn(latestJsonName, detailJsonName);
} }
} }
@@ -0,0 +1,13 @@
package customskinloader.gradle.task;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import org.gradle.api.tasks.TaskAction;
import java.io.IOException;
public class UploadBetaTask extends UploadBaseTask {
@TaskAction
public void uploadBeta() throws IOException, TencentCloudSDKException {
uploadBase("latest-beta.json", "detail-beta.json");
}
}
@@ -0,0 +1,13 @@
package customskinloader.gradle.task;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import org.gradle.api.tasks.TaskAction;
import java.io.IOException;
public class UploadCanaryTask extends UploadBaseTask {
@TaskAction
public void uploadCanary() throws IOException, TencentCloudSDKException {
uploadBase("latest-canary.json","detail-canary.json");
}
}
@@ -0,0 +1,13 @@
package customskinloader.gradle.task;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import org.gradle.api.tasks.TaskAction;
import java.io.IOException;
public class UploadReleaseTask extends UploadBaseTask{
@TaskAction
public void upload() throws IOException, TencentCloudSDKException {
uploadBase("latest.json","detail.json");
}
}
@@ -40,7 +40,7 @@ public class CurseForgeUtil {
gameVersionStrings.add("Java " + javaVersion); // Java Versions gameVersionStrings.add("Java " + javaVersion); // Java Versions
} }
}); });
gameVersionStrings.add(project.getName().split("/")[0]); // Loader Version gameVersionStrings.addAll(VersionUtil.getLoaders(project));
artifact.setGameVersionStrings(gameVersionStrings); artifact.setGameVersionStrings(gameVersionStrings);
artifact.setChangelogType("text"); artifact.setChangelogType("text");
artifact.setChangelog(System.getenv("GIT_COMMIT_DESC")); artifact.setChangelog(System.getenv("GIT_COMMIT_DESC"));
@@ -1,6 +1,5 @@
package customskinloader.gradle.util; package customskinloader.gradle.util;
import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import com.modrinth.minotaur.TaskModrinthUpload; import com.modrinth.minotaur.TaskModrinthUpload;
@@ -33,7 +32,7 @@ public class ModrinthUtil {
task.addGameVersion(gameVersion); // Minecraft Versions task.addGameVersion(gameVersion); // Minecraft Versions
} }
}); });
task.addLoader(project.getName().split("/")[0].toLowerCase(Locale.ENGLISH)); // Loader Version VersionUtil.getLoaders(project).stream().map(String::toLowerCase).forEach(task::addLoader);
TaskUtil.withTask(project.getRootProject(), "upload", task0 -> task0.finalizedBy(task)); TaskUtil.withTask(project.getRootProject(), "upload", task0 -> task0.finalizedBy(task));
}); });
@@ -21,6 +21,7 @@ import org.cadixdev.lorenz.MappingSet;
import org.cadixdev.lorenz.io.srg.SrgReader; import org.cadixdev.lorenz.io.srg.SrgReader;
import org.cadixdev.lorenz.io.srg.SrgWriter; import org.cadixdev.lorenz.io.srg.SrgWriter;
import org.cadixdev.lorenz.io.srg.tsrg.TSrgReader; import org.cadixdev.lorenz.io.srg.tsrg.TSrgReader;
import org.cadixdev.lorenz.model.ClassMapping;
import org.cadixdev.mercury.Mercury; import org.cadixdev.mercury.Mercury;
import org.cadixdev.mercury.remapper.MercuryRemapper; import org.cadixdev.mercury.remapper.MercuryRemapper;
import org.gradle.api.Project; import org.gradle.api.Project;
@@ -42,7 +43,7 @@ public class RemapUtil {
Writer writer = Files.newBufferedWriter(srg.toPath(), StandardCharsets.UTF_8) Writer writer = Files.newBufferedWriter(srg.toPath(), StandardCharsets.UTF_8)
) { ) {
new TSrgReader(reader).read(set); new TSrgReader(reader).read(set);
new SrgWriter(writer).write(set); new SrgWriterWithoutFilter(writer).write(set);
} }
srg.deleteOnExit(); srg.deleteOnExit();
} }
@@ -89,4 +90,59 @@ public class RemapUtil {
} }
})); }));
} }
/**
* Invoked from {@link org.cadixdev.mercury.remapper.RemapperVisitor#remapType(org.eclipse.jdt.core.dom.SimpleName, org.eclipse.jdt.core.dom.ITypeBinding)}
*/
public static String fixClassName(String name) {
char[] chars = name.toCharArray();
for (int i = 0; i < chars.length - 1; i++) {
if (chars[i] == '.' && chars[i + 1] >= '0' && chars[i + 1] <= '9') {
chars[i] = '$';
}
}
return new String(chars);
}
public static class SrgWriterWithoutFilter extends SrgWriter {
private final static Field classesField;
static {
try {
classesField = SrgWriter.class.getDeclaredField("classes");
classesField.setAccessible(true);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public SrgWriterWithoutFilter(Writer writer) {
super(writer);
}
@Override
protected void writeClassMapping(ClassMapping<?, ?> mapping) {
// Write class mappings without checking
try {
((List<String>) classesField.get(this)).add(String.format("CL: %s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName()));
} catch (Exception e) {
throw new RuntimeException(e);
}
// Write inner class mappings
mapping.getInnerClassMappings().stream()
.sorted(this.getConfig().getClassMappingComparator())
.forEach(this::writeClassMapping);
// Write field mappings
mapping.getFieldsByName().values().stream()
.sorted(this.getConfig().getFieldMappingComparator())
.forEach(this::writeFieldMapping);
// Write method mappings
mapping.getMethodMappings().stream()
.sorted(this.getConfig().getMethodMappingComparator())
.forEach(this::writeMethodMapping);
}
}
} }
@@ -3,15 +3,17 @@ package customskinloader.gradle.util;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.util.VersionNumber; import org.gradle.util.VersionNumber;
import java.util.Arrays; import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class VersionUtil { public class VersionUtil {
public static boolean isRelease(Project rootProject) { public static boolean isRelease(Project rootProject) {
String s = ConfigUtil.getConfigString(rootProject, "snapshot"); String s = System.getenv("IS_SNAPSHOT");
return s == null || s.equals("") || s.equals("0"); // When we cannot find environment variable, it means we are in development, so it is not a release
if (s == null) {
return false;
}
return s.equals("0") || s.equals("false");
} }
public static boolean isSnapshot(Project rootProject) { public static boolean isSnapshot(Project rootProject) {
@@ -19,6 +21,9 @@ public class VersionUtil {
} }
public static String getBuildNum() { public static String getBuildNum() {
if (System.getenv("GITHUB_RUN_NUMBER") != null) {
return System.getenv("GITHUB_RUN_NUMBER");
}
if (System.getenv("CIRCLE_BUILD_NUM") != null) { if (System.getenv("CIRCLE_BUILD_NUM") != null) {
return System.getenv("CIRCLE_BUILD_NUM"); return System.getenv("CIRCLE_BUILD_NUM");
} }
@@ -28,8 +33,7 @@ public class VersionUtil {
//Example: 14.10a-SNAPSHOT-33 //Example: 14.10a-SNAPSHOT-33
public static String getCSLVersion(Project rootProject) { public static String getCSLVersion(Project rootProject) {
return ConfigUtil.getConfigString(rootProject, "version") + return ConfigUtil.getConfigString(rootProject, "version") +
ConfigUtil.getConfigString(rootProject, "dev_version") +
(isRelease(rootProject) ? "" : ("-SNAPSHOT-" + getBuildNum())); (isRelease(rootProject) ? "" : ("-SNAPSHOT-" + getBuildNum()));
} }
@@ -60,4 +64,14 @@ public class VersionUtil {
ConfigUtil.getConfigString(project, "minecraft_version") : ConfigUtil.getConfigString(project, "minecraft_version") :
project.getName().replace("/", ""); project.getName().replace("/", "");
} }
public static List<String> getLoaders(Project project) {
String loaderName = project.getName().split("/")[0];
List<String> loaders = new ArrayList<>(2);
loaders.add(loaderName);
if (loaderName.equals("Fabric")) {
loaders.add("Quilt");
}
return loaders;
}
} }
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff. Show more