mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfa7db1731 | ||
|
|
b645fd1665 | ||
|
|
28fc81cb9a | ||
|
|
bb0a47de4b | ||
|
|
d09b1d9807 | ||
|
|
c207bdfc0e | ||
|
|
69d35a69b7 | ||
|
|
d767f40d32 | ||
|
|
5329a27d1a | ||
|
|
ddefe00ac0 | ||
|
|
dd4b706827 | ||
|
|
84072c62f3 | ||
|
|
2d00e12f0a | ||
|
|
b2b56f5be5 | ||
|
|
43c8ceb21e | ||
|
|
a0ad239770 | ||
|
|
c8f0f7e283 | ||
|
|
bfbd6ee31a | ||
|
|
f8f3caad39 | ||
|
|
bd409ae169 | ||
|
|
82f0aad9ff | ||
|
|
f2fce38137 | ||
|
|
7d19f3114c | ||
|
|
d7a1e0f31f | ||
|
|
201210f567 | ||
|
|
26ed002689 | ||
|
|
7d7e5c9060 | ||
|
|
81bf422250 | ||
|
|
776e31e158 | ||
|
|
4a92223158 | ||
|
|
264aacc8c0 | ||
|
|
0b000731b5 | ||
|
|
f0012b58df | ||
|
|
013c22ae95 | ||
|
|
01d02a27b0 | ||
|
|
077551e161 |
No files matched your search
@@ -1,45 +0,0 @@
|
||||
# Java Gradle CircleCI 2.0 configuration file
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: cimg/openjdk:8.0
|
||||
|
||||
working_directory: ~/repo
|
||||
|
||||
environment:
|
||||
JVM_OPTS: -Xmx3200m
|
||||
TERM: dumb
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- gradle-cache
|
||||
|
||||
# Gradle Wrapper
|
||||
- run:
|
||||
name: Gradle Version
|
||||
command: |
|
||||
sudo chmod +x gradlew
|
||||
./gradlew --version
|
||||
- run:
|
||||
name: Build
|
||||
command: |
|
||||
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $CIRCLE_SHA1)
|
||||
./gradlew clean build
|
||||
- run:
|
||||
name: Publish
|
||||
command: |
|
||||
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $CIRCLE_SHA1)
|
||||
./gradlew upload --debug --stacktrace
|
||||
# ./gradlew publishGprPublicationToGitHubPackagesRepository
|
||||
|
||||
- store_artifacts:
|
||||
path: ./build/libs
|
||||
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.gradle
|
||||
key: gradle-cache
|
||||
@@ -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
|
||||
@@ -0,0 +1,83 @@
|
||||
name: Report Bug
|
||||
description: Report a bug and help us improve CustomSkinLoader
|
||||
labels: [ bug ]
|
||||
body:
|
||||
- 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
|
||||
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: "https://"
|
||||
- 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: "https://"
|
||||
- type: input
|
||||
id: mod-version
|
||||
attributes:
|
||||
label: Mod Version
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: mc-version
|
||||
attributes:
|
||||
label: Minecraft Version
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: loader-type
|
||||
attributes:
|
||||
label: Mod Loader
|
||||
options:
|
||||
- Quilt
|
||||
- Fabric
|
||||
- Forge
|
||||
- <without 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
|
||||
@@ -0,0 +1,82 @@
|
||||
name: 提交问题
|
||||
description: 报告问题以帮助我们改进CustomSkinLoader
|
||||
labels: [ bug ]
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 描述问题
|
||||
description: |
|
||||
简单的描述问题, 并提供类似图片、视频,以更好的报告错误(如果可以)
|
||||
!注意:请不要在这里放日志文件或崩溃报告文件的内容
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproducing
|
||||
attributes:
|
||||
label: 复现步骤
|
||||
description: 请问你是如何触发这个问题的
|
||||
render: bash
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: crash-report
|
||||
attributes:
|
||||
label: 崩溃报告查看地址
|
||||
description: |
|
||||
在游戏目录下的 `crash-reports` 文件夹下,里面找最近的报告生成时间
|
||||
[生成连接](https://mclo.gs)
|
||||
placeholder: "https://"
|
||||
- type: input
|
||||
id: csl-log
|
||||
attributes:
|
||||
label: CustomSkinLoader.log 查看地址
|
||||
description: |
|
||||
文件路径:`<游戏路径>/CustomSkinLoader/CustomSkinLoader.log`.
|
||||
[生成连接](https://mclo.gs)
|
||||
placeholder: "https://"
|
||||
- type: input
|
||||
id: mod-version
|
||||
attributes:
|
||||
label: 模组版本
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: mc-version
|
||||
attributes:
|
||||
label: Minecraft游戏版本
|
||||
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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,59 @@
|
||||
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 Common
|
||||
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
|
||||
-
|
||||
name: Publish
|
||||
if: ${{ inputs.publish-task }}
|
||||
env:
|
||||
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
||||
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
||||
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
||||
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
|
||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||
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
|
||||
-
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }}
|
||||
path: build/libs
|
||||
@@ -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
|
||||
@@ -0,0 +1,15 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
name: Build Release
|
||||
uses: ./.github/workflows/common.yml
|
||||
with:
|
||||
type: Release
|
||||
publish-task: upload
|
||||
is-snapshot: false
|
||||
secrets: inherit
|
||||
@@ -27,7 +27,7 @@ import customskinloader.utils.MinecraftUtil;
|
||||
/**
|
||||
* 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@
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
@@ -198,8 +198,8 @@ public class CustomSkinLoader {
|
||||
String credential = MinecraftUtil.getCredential(gameProfile);
|
||||
|
||||
//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"
|
||||
if (username == null || username.isEmpty() || username.equals("\u0020") || credential == null) {
|
||||
//Authlib 3.11.50 makes empty username to " "
|
||||
if (username == null || username.isEmpty() || username.equals(" ") || credential == null) {
|
||||
return dynamicSkullManager.getTexture(gameProfile);
|
||||
}
|
||||
if (config.forceUpdateSkull ? profileCache.isReady(credential) : profileCache.isExist(credential)) {
|
||||
|
||||
@@ -102,7 +102,8 @@ public class Logger {
|
||||
}
|
||||
|
||||
//Format, print and write
|
||||
String sb = String.format("[%s %s] %s", Thread.currentThread().getName(), level.getName(), msg);
|
||||
String sb = String.format("[%s] [%s/%s] [CustomSkinLoader]: %s",
|
||||
DATE_FORMAT.format(new Date()), Thread.currentThread().getName(), level.getName(), msg);
|
||||
if (canPrintToStdOut(level)) {
|
||||
System.out.println(sb);
|
||||
}
|
||||
@@ -110,7 +111,7 @@ public class Logger {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String sb2 = String.format("[%s] %s\r\n", DATE_FORMAT.format(new Date()), sb);
|
||||
String sb2 = String.format("%s\r\n", sb);
|
||||
writer.write(sb2);
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -2,11 +2,7 @@ package customskinloader.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.loader.ProfileLoader;
|
||||
@@ -29,9 +25,9 @@ public class Config {
|
||||
public boolean enableDynamicSkull = true;
|
||||
public boolean enableTransparentSkin = true;
|
||||
public boolean forceIgnoreHttpsCertificate = false;
|
||||
public boolean forceLoadAllTextures = false;
|
||||
public boolean forceLoadAllTextures = true;
|
||||
public boolean enableCape = true;
|
||||
public int threadPoolSize = 3;
|
||||
public int threadPoolSize = 8;
|
||||
/**
|
||||
* Can logger write message to standard output(System.out).
|
||||
* Because standard output won't write to latest.log after Forge 1.17,
|
||||
@@ -233,7 +229,7 @@ public class Config {
|
||||
profiles.addAll(defaultProfiles);
|
||||
}
|
||||
}
|
||||
profiles.sort((c1, c2) -> Integer.compare(c1.getPriority(), c2.getPriority()));
|
||||
profiles.sort(Comparator.comparingInt(ICustomSkinLoaderPlugin.IDefaultProfile::getPriority));
|
||||
|
||||
List<SkinSiteProfile> loadlist = new ArrayList<>();
|
||||
for (ICustomSkinLoaderPlugin.IDefaultProfile profile : profiles) {
|
||||
|
||||
@@ -30,14 +30,15 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
||||
image = resetImageFormat(image, 22, 0, 46, 22);
|
||||
return image;
|
||||
}
|
||||
} catch (IOException | NoSuchElementException ignored) { }
|
||||
} catch (IOException | NoSuchElementException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int loaded = 0;
|
||||
private double ratioX = -1;
|
||||
private double ratioY = -1;
|
||||
private ResourceLocation location;
|
||||
private final ResourceLocation location;
|
||||
private String type = null;
|
||||
|
||||
public FakeCapeBuffer(ResourceLocation location) {
|
||||
@@ -47,11 +48,19 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
||||
@Override
|
||||
public FakeImage parseUserSkin(FakeImage image) {
|
||||
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
|
||||
// The first cape which find elytra texture is outdated will reload it
|
||||
if (this.loaded == loadedGlobal) {
|
||||
elytraImage = loadElytra(image);
|
||||
elytraImage = loadElytra(this.image);
|
||||
}
|
||||
this.loaded = loadedGlobal;
|
||||
if (elytraImage != null) {
|
||||
@@ -126,15 +135,16 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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 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 excludeY = (int) Math.ceil(2 * ratioY);
|
||||
int excludeY = (int) Math.ceil(2 * ratioY);
|
||||
for (int x = startX; x < endX; ++x) {
|
||||
for (int y = startY; y < endY; ++y) {
|
||||
if (y < excludeY && (x < excludeX0 || x >= excludeX1)) continue;
|
||||
@@ -167,24 +177,27 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
||||
|
||||
/**
|
||||
* Scale image
|
||||
* @param image the image to scale.
|
||||
*
|
||||
* @param image the image to scale.
|
||||
* @param closeOldImage whether close old image
|
||||
* @param scaleWidth width enlargement ratio
|
||||
* @param scaleHeight height enlargement ratio
|
||||
* @param ratioX the ratio of 64 of the old image width
|
||||
* @param ratioY the ratio of 32 of the old image height
|
||||
* @param width the width after scaling.
|
||||
* @param height the height after scaling.
|
||||
* @param startX the x where start to copy.
|
||||
* @param startY the y where start to copy.
|
||||
* @param endX the x where end to copy.
|
||||
* @param endY the y where end to copy.
|
||||
* @param scaleWidth width enlargement ratio
|
||||
* @param scaleHeight height enlargement ratio
|
||||
* @param ratioX the ratio of 64 of the old image width
|
||||
* @param ratioY the ratio of 32 of the old image height
|
||||
* @param width the width after scaling.
|
||||
* @param height the height after scaling.
|
||||
* @param startX the x where start to copy.
|
||||
* @param startY the y where start to copy.
|
||||
* @param endX the x where end to copy.
|
||||
* @param endY the y where end to copy.
|
||||
* @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) {
|
||||
FakeImage newImage = image.createImage(width, height);
|
||||
startX = (int) (startX * ratioX); endX = (int) (endX * ratioX);
|
||||
startY = (int) (startY * ratioY); endY = (int) (endY * ratioY);
|
||||
startX = (int) (startX * ratioX);
|
||||
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;
|
||||
for (int x = startX; x < endX; ++x) {
|
||||
@@ -196,12 +209,61 @@ public class FakeCapeBuffer extends FakeSkinBuffer {
|
||||
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)
|
||||
image.close();
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,21 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
|
||||
|
||||
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);
|
||||
|
||||
@@ -93,8 +107,15 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
|
||||
}
|
||||
json = IOUtils.toString(Files.newInputStream(jsonFile.toPath()), StandardCharsets.UTF_8);
|
||||
} else {
|
||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(jsonUrl).setCacheTime(90).setUserAgent(ssp.userAgent).setPayload(this.jsonAPI.getPayload(ssp)));
|
||||
json = responce.content;
|
||||
try {
|
||||
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("")) {
|
||||
CustomSkinLoader.logger.info("Profile not found.");
|
||||
@@ -135,4 +156,11 @@ public class JsonAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPr
|
||||
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;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
@@ -24,7 +24,12 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
|
||||
|
||||
@Override
|
||||
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}¬hirdparty", 860)
|
||||
);
|
||||
}
|
||||
|
||||
public abstract static class DefaultProfile implements ICustomSkinLoaderPlugin.IDefaultProfile {
|
||||
@@ -75,7 +80,7 @@ public class LegacyLoader implements ICustomSkinLoaderPlugin, ProfileLoader.IPro
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 600;
|
||||
return 710;
|
||||
}
|
||||
|
||||
@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 {
|
||||
// public Minecrack(LegacyLoader loader) { super(loader); }
|
||||
// @Override public String getName() { return "Minecrack"; }
|
||||
// @Override public int getPriority() { return 600; }
|
||||
// @Override public String getSkinRoot() { return "http://minecrack.fr.nf/mc/skinsminecrackd/{USERNAME}.png"; }
|
||||
// @Override public String getCapeRoot() { return "http://minecrack.fr.nf/mc/cloaksminecrackd/{USERNAME}.png"; }
|
||||
// @Override public String getElytraRoot() { return null; }
|
||||
// }
|
||||
/**
|
||||
* Get cape Profile¬
|
||||
*
|
||||
* @since 14.16
|
||||
*/
|
||||
public static LegacyLoader.DefaultProfile getCapeProfile(LegacyLoader loader, String name, String capeRoot, int priority) {
|
||||
return new DefaultProfile(loader) {
|
||||
@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 UUID_PLACEHOLDER = "{UUID}";
|
||||
/**
|
||||
* Mojang UUID with -
|
||||
*
|
||||
* @since 14.16
|
||||
*/
|
||||
public static final String STANDARD_UUID_PLACEHOLDER = "{STANDARD_UUID}";
|
||||
|
||||
@Override
|
||||
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) {
|
||||
String t = url.replace(USERNAME_PLACEHOLDER, username);
|
||||
if (!t.contains(UUID_PLACEHOLDER)) {
|
||||
if (!t.contains(UUID_PLACEHOLDER) && !t.contains(STANDARD_UUID_PLACEHOLDER)) {
|
||||
return t;
|
||||
}
|
||||
String uuid = MojangAPILoader.getMojangUuidByUsername(username);
|
||||
String uuid = MojangAPILoader.getMojangUuidByUsername(username, true);
|
||||
//If Mojang uuid not found, won't load the texture
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
return t.replace(UUID_PLACEHOLDER, uuid);
|
||||
String styledUuid = uuid.replace("-", "");
|
||||
return t.replace(UUID_PLACEHOLDER, styledUuid).replace(STANDARD_UUID_PLACEHOLDER, uuid);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import org.apache.commons.codec.Charsets;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -137,14 +136,16 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
* Get Mojang UUID by username.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
public static String getMojangUuidByUsername(String username) {
|
||||
public static String getMojangUuidByUsername(String username, boolean standard) {
|
||||
GameProfile profile = loadGameProfile(getMojangApiRoot(), username);
|
||||
if (profile == null) {
|
||||
return null;
|
||||
}
|
||||
return UUIDTypeAdapter.fromUUID(profile.getId());
|
||||
UUID id = profile.getId();
|
||||
return standard ? id.toString() : UUIDTypeAdapter.fromUUID(id);
|
||||
}
|
||||
|
||||
//UUID -> Profile
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
@@ -17,17 +16,45 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public class CustomSkinAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
public static class LittleSkin extends JsonAPILoader.DefaultProfile {
|
||||
public LittleSkin(JsonAPILoader loader) { super(loader); }
|
||||
@Override public String getName() { return "LittleSkin"; }
|
||||
@Override public int getPriority() { return 200; }
|
||||
@Override public String getRoot() { return "https://littleskin.cn/csl/"; }
|
||||
public LittleSkin(JsonAPILoader loader) {
|
||||
super(loader);
|
||||
}
|
||||
|
||||
@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 BlessingSkin(JsonAPILoader loader) { super(loader); }
|
||||
@Override public String getName() { return "BlessingSkin"; }
|
||||
@Override public int getPriority() { return 300; }
|
||||
@Override public String getRoot() { return "https://skin.prinzeugen.net/"; }
|
||||
public BlessingSkin(JsonAPILoader loader) {
|
||||
super(loader);
|
||||
}
|
||||
|
||||
@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
|
||||
@@ -38,8 +65,8 @@ public class CustomSkinAPI implements JsonAPILoader.IJsonAPI {
|
||||
// @Override public String getRoot() { return "http://fleey.cn/skin/skin_user/skin_json.php/"; }
|
||||
// }
|
||||
|
||||
private static final String TEXTURES="textures/";
|
||||
private static final String SUFFIX=".json";
|
||||
private static final String TEXTURES = "textures/";
|
||||
private static final String SUFFIX = ".json";
|
||||
|
||||
@Override
|
||||
public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) {
|
||||
@@ -53,65 +80,63 @@ public class CustomSkinAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
@Override
|
||||
public UserProfile toUserProfile(String root, String json, boolean local) {
|
||||
CustomSkinAPIProfile profile=CustomSkinLoader.GSON.fromJson(json, CustomSkinAPIProfile.class);
|
||||
UserProfile p=new UserProfile();
|
||||
|
||||
if(StringUtils.isNotBlank(profile.skin)){
|
||||
p.skinUrl=root+TEXTURES+profile.skin;
|
||||
if(local)
|
||||
p.skinUrl=HttpTextureUtil.getLocalFakeUrl(p.skinUrl);
|
||||
CustomSkinAPIProfile profile = CustomSkinLoader.GSON.fromJson(json, CustomSkinAPIProfile.class);
|
||||
UserProfile p = new UserProfile();
|
||||
|
||||
if (StringUtils.isNotBlank(profile.skin)) {
|
||||
p.skinUrl = root + TEXTURES + profile.skin;
|
||||
if (local)
|
||||
p.skinUrl = HttpTextureUtil.getLocalFakeUrl(p.skinUrl);
|
||||
}
|
||||
if(StringUtils.isNotBlank(profile.cape)){
|
||||
p.capeUrl=root+TEXTURES+profile.cape;
|
||||
if(local)
|
||||
p.capeUrl=HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
|
||||
if (StringUtils.isNotBlank(profile.cape)) {
|
||||
p.capeUrl = root + TEXTURES + profile.cape;
|
||||
if (local)
|
||||
p.capeUrl = HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
|
||||
}
|
||||
if(StringUtils.isNotBlank(profile.elytra)){
|
||||
p.elytraUrl=root+TEXTURES+profile.elytra;
|
||||
if(local)
|
||||
p.elytraUrl=HttpTextureUtil.getLocalFakeUrl(p.elytraUrl);
|
||||
if (StringUtils.isNotBlank(profile.elytra)) {
|
||||
p.elytraUrl = root + TEXTURES + profile.elytra;
|
||||
if (local)
|
||||
p.elytraUrl = HttpTextureUtil.getLocalFakeUrl(p.elytraUrl);
|
||||
}
|
||||
|
||||
Map<String,String> textures=new LinkedHashMap<>();
|
||||
if(profile.skins!=null)
|
||||
|
||||
Map<String, String> textures = new LinkedHashMap<>();
|
||||
if (profile.skins != null)
|
||||
textures.putAll(profile.skins);
|
||||
if(profile.textures!=null)
|
||||
if (profile.textures != null)
|
||||
textures.putAll(profile.textures);
|
||||
if(textures.isEmpty())
|
||||
if (textures.isEmpty())
|
||||
return p;
|
||||
|
||||
boolean hasSkin=false;
|
||||
for(String model:textures.keySet()){
|
||||
ModelManager0.Model enumModel=ModelManager0.getEnumModel(model);
|
||||
if(enumModel==null||StringUtils.isEmpty(textures.get(model)))
|
||||
|
||||
boolean hasSkin = false;
|
||||
for (String model : textures.keySet()) {
|
||||
ModelManager0.Model enumModel = ModelManager0.getEnumModel(model);
|
||||
if (enumModel == null || StringUtils.isEmpty(textures.get(model)))
|
||||
continue;
|
||||
if(ModelManager0.isSkin(enumModel))
|
||||
if(hasSkin)
|
||||
if (ModelManager0.isSkin(enumModel))
|
||||
if (hasSkin)
|
||||
continue;
|
||||
else
|
||||
hasSkin=true;
|
||||
String url=root+TEXTURES+textures.get(model);
|
||||
if(local)
|
||||
url=HttpTextureUtil.getLocalFakeUrl(url);
|
||||
hasSkin = true;
|
||||
String url = root + TEXTURES + textures.get(model);
|
||||
if (local)
|
||||
url = HttpTextureUtil.getLocalFakeUrl(url);
|
||||
p.put(enumModel, url);
|
||||
}
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
private static class CustomSkinAPIProfile{
|
||||
|
||||
private static class CustomSkinAPIProfile {
|
||||
public String username;
|
||||
public LinkedHashMap<String,String> textures;
|
||||
|
||||
public LinkedHashMap<String,String> skins;
|
||||
|
||||
public LinkedHashMap<String, String> textures;
|
||||
|
||||
public LinkedHashMap<String, String> skins;
|
||||
|
||||
public String skin;
|
||||
public String cape;
|
||||
public String elytra;
|
||||
}
|
||||
@Override
|
||||
public String getPayload(SkinSiteProfile ssp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "CustomSkinAPI";
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
@@ -16,17 +15,45 @@ import customskinloader.profile.UserProfile;
|
||||
public class ElyByAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
public static class ElyBy extends JsonAPILoader.DefaultProfile {
|
||||
public ElyBy(JsonAPILoader loader) { super(loader); }
|
||||
@Override public String getName() { return "ElyBy"; }
|
||||
@Override public int getPriority() { return 400; }
|
||||
@Override public String getRoot() { return "http://skinsystem.ely.by/textures/"; }
|
||||
public ElyBy(JsonAPILoader loader) {
|
||||
super(loader);
|
||||
}
|
||||
|
||||
@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 TLauncher(JsonAPILoader loader) { super(loader); }
|
||||
@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/"; }
|
||||
public TLauncher(JsonAPILoader loader) {
|
||||
super(loader);
|
||||
}
|
||||
|
||||
@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
|
||||
@@ -41,15 +68,11 @@ public class ElyByAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPayload(SkinSiteProfile ssp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ElyByAPI";
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Map;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
@@ -15,10 +14,24 @@ import customskinloader.profile.UserProfile;
|
||||
public class GlitchlessAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
public static class GlitchlessGames extends JsonAPILoader.DefaultProfile {
|
||||
public GlitchlessGames(JsonAPILoader loader) { super(loader); }
|
||||
@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="; }
|
||||
public GlitchlessGames(JsonAPILoader loader) {
|
||||
super(loader);
|
||||
}
|
||||
|
||||
@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
|
||||
@@ -40,11 +53,6 @@ public class GlitchlessAPI implements JsonAPILoader.IJsonAPI {
|
||||
return ModelManager0.toUserProfile(result.textures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPayload(SkinSiteProfile ssp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "GlitchlessAPI";
|
||||
|
||||
@@ -2,22 +2,15 @@ package customskinloader.loader.jsonapi;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.Logger;
|
||||
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.loader.MojangAPILoader;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
import customskinloader.utils.HttpTextureUtil;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import customskinloader.utils.TextureUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
@@ -49,7 +42,7 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
@Override
|
||||
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 == null) {
|
||||
return null;
|
||||
@@ -65,23 +58,8 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
||||
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();
|
||||
profile.capeUrl = fakeUrl;
|
||||
profile.capeUrl = TextureUtil.parseBase64Texture(result.textures.cape);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
@@ -16,14 +15,28 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public class UniSkinAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
public static class SkinMe extends JsonAPILoader.DefaultProfile {
|
||||
public SkinMe(JsonAPILoader loader) { super(loader); }
|
||||
@Override public String getName() { return "SkinMe"; }
|
||||
@Override public int getPriority() { return 500; }
|
||||
@Override public String getRoot() { return "http://www.skinme.cc/uniskin/"; }
|
||||
public SkinMe(JsonAPILoader loader) {
|
||||
super(loader);
|
||||
}
|
||||
|
||||
@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 SUFFIX=".json";
|
||||
private static final String TEXTURES = "textures/";
|
||||
private static final String SUFFIX = ".json";
|
||||
|
||||
@Override
|
||||
public List<ICustomSkinLoaderPlugin.IDefaultProfile> getDefaultProfiles(JsonAPILoader loader) {
|
||||
@@ -37,55 +50,54 @@ public class UniSkinAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
@Override
|
||||
public UserProfile toUserProfile(String root, String json, boolean local) {
|
||||
UniSkinAPIProfile profile=CustomSkinLoader.GSON.fromJson(json, UniSkinAPIProfile.class);
|
||||
UserProfile p=new UserProfile();
|
||||
|
||||
if(StringUtils.isNotBlank(profile.cape)){
|
||||
p.capeUrl=root+TEXTURES+profile.cape;
|
||||
if(local)
|
||||
p.capeUrl=HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
|
||||
UniSkinAPIProfile profile = CustomSkinLoader.GSON.fromJson(json, UniSkinAPIProfile.class);
|
||||
UserProfile p = new UserProfile();
|
||||
|
||||
if (StringUtils.isNotBlank(profile.cape)) {
|
||||
p.capeUrl = root + TEXTURES + profile.cape;
|
||||
if (local)
|
||||
p.capeUrl = HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
|
||||
}
|
||||
|
||||
if(profile.skins==null||profile.skins.isEmpty())
|
||||
|
||||
if (profile.skins == null || profile.skins.isEmpty())
|
||||
return p;
|
||||
if(profile.model_preference==null||profile.model_preference.isEmpty())
|
||||
if (profile.model_preference == null || profile.model_preference.isEmpty())
|
||||
return p;
|
||||
|
||||
boolean hasSkin=false;
|
||||
for(String model:profile.model_preference){
|
||||
ModelManager0.Model enumModel=ModelManager0.getEnumModel(model);
|
||||
if(enumModel==null||StringUtils.isEmpty(profile.skins.get(model)))
|
||||
|
||||
boolean hasSkin = false;
|
||||
for (String model : profile.model_preference) {
|
||||
ModelManager0.Model enumModel = ModelManager0.getEnumModel(model);
|
||||
if (enumModel == null || StringUtils.isEmpty(profile.skins.get(model)))
|
||||
continue;
|
||||
if(ModelManager0.isSkin(enumModel))
|
||||
if(hasSkin)
|
||||
if (ModelManager0.isSkin(enumModel))
|
||||
if (hasSkin)
|
||||
continue;
|
||||
else
|
||||
hasSkin=true;
|
||||
String url=root+TEXTURES+profile.skins.get(model);
|
||||
if(local)
|
||||
url=HttpTextureUtil.getLocalFakeUrl(url);
|
||||
hasSkin = true;
|
||||
String url = root + TEXTURES + profile.skins.get(model);
|
||||
if (local)
|
||||
url = HttpTextureUtil.getLocalFakeUrl(url);
|
||||
p.put(enumModel, url);
|
||||
}
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
private class UniSkinAPIProfile{
|
||||
private static class UniSkinAPIProfile {
|
||||
public String player_name;
|
||||
public long last_update;
|
||||
public List<String> model_preference;
|
||||
public Map<String,String> skins;
|
||||
|
||||
public Map<String, String> skins;
|
||||
|
||||
public String cape;
|
||||
}
|
||||
@Override
|
||||
public String getPayload(SkinSiteProfile ssp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,8 @@ public class PluginLoader {
|
||||
new JsonAPILoader(new UniSkinAPI()),
|
||||
new JsonAPILoader(new ElyByAPI()),
|
||||
new JsonAPILoader(new GlitchlessAPI()),
|
||||
new JsonAPILoader(new MinecraftCapesAPI())
|
||||
new JsonAPILoader(new MinecraftCapesAPI()),
|
||||
new JsonAPILoader(new WynntilsAPI()),
|
||||
};
|
||||
public static final ArrayList<ICustomSkinLoaderPlugin> PLUGINS = loadPlugins();
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ public class HttpRequestUtil {
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.payload)) {
|
||||
CustomSkinLoader.logger.info("Payload: " + request.payload);
|
||||
c.setRequestMethod("POST");
|
||||
c.setRequestProperty("Content-Type", "application/json");
|
||||
c.setDoOutput(true);
|
||||
OutputStream os = c.getOutputStream();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager net/minecraft/class_3300
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; method_14486
|
||||
net/minecraft/client/resources/SkinManager net/minecraft/class_1071
|
||||
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
|
||||
|
||||
+3
-4
@@ -49,11 +49,10 @@ tasks.publishModrinth.doFirst {
|
||||
// https://github.com/MinecraftForge/ForgeGradle/blob/fc67182a61926f0bdb0d12da5fba7f4322f64d86/src/main/java/net/minecraftforge/gradle/common/BasePlugin.java#L229
|
||||
jsonSlurper.parse(plugin.cacheFile("McManifest.json")).versions.each { version ->
|
||||
if (version.type == "snapshot") {
|
||||
// If the first version is a snapshot, 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) {
|
||||
currentRelease = jsonSlurper.parse(new URL(version.url)).assets.with {
|
||||
it.toString().split($/\./$).with { "${it[0]}.${it[1]}" }
|
||||
}
|
||||
return
|
||||
}
|
||||
} else if (version.type == "release") {
|
||||
currentRelease = version.id.with {
|
||||
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resou
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; m_142591_
|
||||
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_
|
||||
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
|
||||
|
||||
@@ -1,29 +1,46 @@
|
||||
# CustomSkinLoader
|
||||
# CustomSkinLoader
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader/tags)
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/customskinloader)
|
||||
[](https://modrinth.com/mod/customskinloader)
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader/blob/14-develop/LICENSE)
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader/actions)
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader/stargazers)
|
||||
|
||||
[](https://github.com/xfl03/MCCustomSkinLoader)
|
||||
|
||||
## What's this?
|
||||
Custom Skin Loader mod for Minecraft.
|
||||
It's a mod which can load skins and capes from any online source or from your local.
|
||||
|
||||
## Download
|
||||
Latest version could be found in [CurseForge](https://minecraft.curseforge.com/projects/customskinloader) or [Modrinth](https://modrinth.com/mod/customskinloader).
|
||||
中文用户也可以从[33 Kit](https://3-3.dev/csl-download)获取最新版本。
|
||||
### Release Build
|
||||
- [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/)~~
|
||||
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)
|
||||
### Develop Build
|
||||
- [GitHub Action](https://github.com/xfl03/MCCustomSkinLoader/actions)
|
||||
- [33 Kit(Chinese/中文)](https://3-3.dev/csl-download)
|
||||
|
||||
## Contact Us
|
||||
[QQ Group](https://im.qq.com/): [651287593](https://jq.qq.com/?_wv=1027&k=vF16R5tg)
|
||||
[Telegram](https://telegram.org/): [@customskinloader](https://t.me/customskinloader)
|
||||
- [Telegram @customskinloader](https://t.me/customskinloader)
|
||||
- [QQ Group(Chinese/中文) 651287593](https://jq.qq.com/?_wv=1027&k=vF16R5tg)
|
||||
|
||||
## Feature
|
||||
### Support Plenty of Skin Load API and Customizable Skin Load List
|
||||
Supported Skin Load APIs:
|
||||
- [Mojang API](http://wiki.vg/Mojang_API)
|
||||
Supported skin loading APIs:
|
||||
- [MojangAPI](http://wiki.vg/Mojang_API)
|
||||
- [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI)
|
||||
- CustomSkinAPIPlus (Test Only)
|
||||
- [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc)
|
||||
- [ElyByAPI](http://docs.ely.by/api.html)
|
||||
- [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc)
|
||||
- [ElyByAPI](https://docs.ely.by/en/api.html)
|
||||
- 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.
|
||||
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.
|
||||
|
||||
## Default Load List
|
||||
- [Mojang](http://www.minecraft.net/) (Mojang API)
|
||||
- [Mojang](http://www.minecraft.net/) (MojangAPI)
|
||||
- [LittleSkin](https://littleskin.cn/) (CustomSkinAPI)
|
||||
- [Blessing Skin](http://skin.prinzeugen.net/) (CustomSkinAPI)
|
||||
- [BlessingSkin](http://skin.prinzeugen.net/) (CustomSkinAPI)
|
||||
- [ElyBy](http://docs.ely.by/) (ElyByAPI)
|
||||
- SkinMe (UniSkinAPI)
|
||||
- [TLauncher](https://tlauncher.org/) (ElyByAPI)
|
||||
- LocalSkin (Legacy)
|
||||
- [Glitchless](https://games.glitchless.ru/games/minecraft/)
|
||||
- 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).
|
||||
|
||||
## 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)
|
||||
|
||||
## 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
|
||||
You could not modify binary file.
|
||||
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.
|
||||
You could not repost this mod to any website without permission.
|
||||
You could not earn money with this mod excluding modpack.
|
||||
|
||||
### Source Code
|
||||
#### Package 'customskinloader'
|
||||
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)
|
||||
- [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
|
||||
|
||||
You should change the name of the package to avoid others' misunderstanding.
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager cep
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
|
||||
net/minecraft/client/resources/SkinManager cex
|
||||
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
|
||||
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager ach
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
|
||||
net/minecraft/client/resources/SkinManager eks
|
||||
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
|
||||
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager aga
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
|
||||
net/minecraft/client/resources/SkinManager fbo
|
||||
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
|
||||
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager ake
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource
|
||||
net/minecraft/client/resources/SkinManager fpj
|
||||
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 fpj$3
|
||||
field_152801_c field_152801_c
|
||||
field_152802_d field_152802_d
|
||||
|
||||
@@ -49,6 +49,7 @@ net/minecraft/client/resources/IResourceManager bni
|
||||
getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; a
|
||||
net/minecraft/client/resources/SkinManager bnp
|
||||
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
|
||||
|
||||
+3
-3
@@ -92,8 +92,8 @@ subprojects {
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions : config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL"),
|
||||
gitVersion : System.getenv("CIRCLE_SHA1") ?: System.getenv("GITHUB_SHA"),
|
||||
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")
|
||||
])
|
||||
}
|
||||
@@ -133,7 +133,7 @@ subprojects {
|
||||
}
|
||||
|
||||
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.") }
|
||||
|
||||
inputFile = jar.archivePath
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
name=CustomSkinLoader
|
||||
group=customskinloader
|
||||
version=14.15
|
||||
dev_version=
|
||||
#RELEASE: snapshot=0
|
||||
snapshot=1
|
||||
dev_version=.2
|
||||
@@ -1,6 +1,8 @@
|
||||
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.Project;
|
||||
|
||||
@@ -8,7 +10,11 @@ public class BuildPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
+15
-15
@@ -3,8 +3,6 @@ package customskinloader.gradle.task;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
import customskinloader.gradle.entity.CslDetail;
|
||||
import customskinloader.gradle.entity.CslLatest;
|
||||
@@ -14,14 +12,11 @@ import customskinloader.gradle.util.CosUtil;
|
||||
import customskinloader.gradle.util.VersionUtil;
|
||||
import org.gradle.api.DefaultTask;
|
||||
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;
|
||||
|
||||
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
private CslLatest uploadArtifacts() throws IOException {
|
||||
private CslLatest uploadArtifacts(String filename) throws IOException {
|
||||
String shortVersion = VersionUtil.getShortVersion(rootProject);
|
||||
File dir = rootProject.file("build/libs");
|
||||
if (!dir.isDirectory()) {
|
||||
@@ -36,6 +31,10 @@ public class UploadTask extends DefaultTask {
|
||||
return null;
|
||||
}
|
||||
for (File file : files) {
|
||||
if (file.getName().endsWith("-sources.jar")) {
|
||||
//Don't upload sources jar to cos
|
||||
continue;
|
||||
}
|
||||
String key = CosUtil.getKey(file.getName());
|
||||
if (key == null) {
|
||||
continue;
|
||||
@@ -56,11 +55,11 @@ public class UploadTask extends DefaultTask {
|
||||
}
|
||||
}
|
||||
|
||||
CosUtil.writeAndUploadObject("latest.json", latest);
|
||||
CosUtil.writeAndUploadObject(filename, 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);
|
||||
|
||||
rootProject.getAllprojects().stream()
|
||||
@@ -74,19 +73,20 @@ public class UploadTask extends DefaultTask {
|
||||
});
|
||||
|
||||
detail.sortDetails();
|
||||
CosUtil.writeAndUploadObject("detail.json", detail);
|
||||
CosUtil.writeAndUploadObject(filename, detail);
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
public void upload() throws IOException, TencentCloudSDKException {
|
||||
protected void uploadBase(String latestJsonName, String detailJsonName) throws IOException, TencentCloudSDKException {
|
||||
System.out.printf("latestJsonName: %s, detailJsonName: %s\n", latestJsonName, detailJsonName);
|
||||
if (System.getenv("COS_SECRET_KEY") == null) {
|
||||
System.out.println("COS_SECRET_KEY not found.");
|
||||
return;
|
||||
}
|
||||
CslLatest latest = uploadArtifacts();
|
||||
CslLatest latest = uploadArtifacts(latestJsonName);
|
||||
if (latest == null) {
|
||||
return;
|
||||
}
|
||||
uploadDetail(latest);
|
||||
CdnUtil.updateCdn("latest.json", "detail.json");
|
||||
uploadDetail(latest, detailJsonName);
|
||||
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(project.getName().split("/")[0]); // Loader Version
|
||||
gameVersionStrings.addAll(VersionUtil.getLoaders(project));
|
||||
artifact.setGameVersionStrings(gameVersionStrings);
|
||||
artifact.setChangelogType("text");
|
||||
artifact.setChangelog(System.getenv("GIT_COMMIT_DESC"));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package customskinloader.gradle.util;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.modrinth.minotaur.TaskModrinthUpload;
|
||||
@@ -33,7 +32,7 @@ public class ModrinthUtil {
|
||||
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));
|
||||
});
|
||||
|
||||
@@ -3,15 +3,17 @@ package customskinloader.gradle.util;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.util.VersionNumber;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class VersionUtil {
|
||||
public static boolean isRelease(Project rootProject) {
|
||||
String s = ConfigUtil.getConfigString(rootProject, "snapshot");
|
||||
return s == null || s.equals("") || s.equals("0");
|
||||
String s = System.getenv("IS_SNAPSHOT");
|
||||
// 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) {
|
||||
@@ -19,6 +21,9 @@ public class VersionUtil {
|
||||
}
|
||||
|
||||
public static String getBuildNum() {
|
||||
if (System.getenv("GITHUB_RUN_NUMBER") != null) {
|
||||
return System.getenv("GITHUB_RUN_NUMBER");
|
||||
}
|
||||
if (System.getenv("CIRCLE_BUILD_NUM") != null) {
|
||||
return System.getenv("CIRCLE_BUILD_NUM");
|
||||
}
|
||||
@@ -60,4 +65,14 @@ public class VersionUtil {
|
||||
ConfigUtil.getConfigString(project, "minecraft_version") :
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user