mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
299c8f53cf | ||
|
|
13fb0a4f92 | ||
|
|
921374f24f | ||
|
|
d2d244c70e | ||
|
|
f201f344a2 | ||
|
|
76d6ed9a41 | ||
|
|
b807aa1fb1 | ||
|
|
d797ed378a | ||
|
|
c3f8f1eb8f | ||
|
|
226d953012 | ||
|
|
d1ab2fbf43 | ||
|
|
00a14010c6 | ||
|
|
a198e40fc7 | ||
|
|
5b820c537d | ||
|
|
6e1be02cf0 | ||
|
|
9abf9eb779 | ||
|
|
fbc95314ad | ||
|
|
d4576249ac | ||
|
|
dfe47f7c64 | ||
|
|
1199e10ca4 | ||
|
|
61287cf64c | ||
|
|
b16058340c | ||
|
|
ac09a51f48 | ||
|
|
3e5bd83b5c | ||
|
|
4ce00d07b5 | ||
|
|
6e9380be49 | ||
|
|
53050a63f5 | ||
|
|
34ac3ac4f2 |
No files matched your search
@@ -56,7 +56,7 @@ jobs:
|
||||
modtype: [Fabric,Forge-Active,Forge-Legacy]
|
||||
include:
|
||||
-
|
||||
website: ObjectStorage
|
||||
website: TencentCOS
|
||||
modtype: All
|
||||
# -
|
||||
# website: GitHub-Release
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
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"
|
||||
name: 【GitHub Pre-Release】 Delete
|
||||
uses: 8Mi-Tech/delete-release-assets-action@main
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -133,15 +133,15 @@ jobs:
|
||||
EOF
|
||||
-
|
||||
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
||||
name: "[GitHub Pre-Release] Upload Tag"
|
||||
uses: richardsimko/update-tag@v1.0.7
|
||||
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"
|
||||
name: 【GitHub Pre-Release】 Publish
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -154,7 +154,7 @@ jobs:
|
||||
-
|
||||
if: ${{ matrix.website == 'GitHub-Release' && inputs.type == 'Release' }}
|
||||
uses: softprops/action-gh-release@v1
|
||||
name: "[GitHub Release] Publish"
|
||||
name: 【GitHub Release】 Publish
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: CustomSkinLoader ${{ github.ref }}
|
||||
@@ -162,16 +162,12 @@ jobs:
|
||||
#generate_release_notes: true
|
||||
files: ${{ steps.cslenv-github.outputs.pathlist }}
|
||||
-
|
||||
if: ${{ matrix.website == 'ObjectStorage' }}
|
||||
name: "[ObjectStorage] Publish"
|
||||
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 }}
|
||||
R2_BASE_URL: ${{ secrets.R2_BASE_URL }}
|
||||
R2_BUCKET: ${{ secrets.R2_BUCKET }}
|
||||
R2_SECRET_ID: ${{ secrets.R2_SECRET_ID }}
|
||||
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
|
||||
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
|
||||
run: |
|
||||
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
|
||||
@@ -180,7 +176,7 @@ jobs:
|
||||
|
||||
-
|
||||
if: ${{ matrix.website == 'CurseForge_Modrinth' && inputs.type == 'Release' }}
|
||||
name: "[CurseForge & Modrinth] Publish"
|
||||
name: 【CurseForge & Modrinth】 Publish
|
||||
uses: Kir-Antipov/[email protected]
|
||||
with:
|
||||
modrinth-id: idMHQ4n2
|
||||
|
||||
+8
-8
@@ -31,7 +31,7 @@ There are the available versions in different environments below:
|
||||
Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version}
|
||||
Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version}
|
||||
```
|
||||
*`${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually*
|
||||
*`${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually*
|
||||
1. Create a pom file in the same folder:
|
||||
- Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeLegacy-${version}.pom`
|
||||
```xml
|
||||
@@ -40,7 +40,7 @@ There are the available versions in different environments below:
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mods</groupId>
|
||||
<artifactId>CustomSkinLoader_ForgeLegacy</artifactId>
|
||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
||||
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
|
||||
<version>${version}</version>
|
||||
</project>
|
||||
```
|
||||
@@ -51,7 +51,7 @@ There are the available versions in different environments below:
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mods</groupId>
|
||||
<artifactId>CustomSkinLoader_ForgeActive</artifactId>
|
||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
||||
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
|
||||
<version>${version}</version>
|
||||
</project>
|
||||
```
|
||||
@@ -62,7 +62,7 @@ There are the available versions in different environments below:
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>mods</groupId>
|
||||
<artifactId>CustomSkinLoader_Fabric</artifactId>
|
||||
<!-- `${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually -->
|
||||
<!-- `${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually -->
|
||||
<version>${version}</version>
|
||||
</project>
|
||||
```
|
||||
@@ -71,7 +71,7 @@ There are the available versions in different environments below:
|
||||
1. Add below contents to `build.gradle`:
|
||||
```gradle
|
||||
dependencies {
|
||||
deobfCompile "mods:CustomSkinLoader_ForgeLegacy:15.0-SNAPSHOT-00"
|
||||
deobfCompile "mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00"
|
||||
}
|
||||
|
||||
minecraft {
|
||||
@@ -85,8 +85,8 @@ There are the available versions in different environments below:
|
||||
1. Add below contents to `build.gradle`:
|
||||
```gradle
|
||||
dependencies {
|
||||
implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:15.0-SNAPSHOT-00") // Only required for MinecraftForge 1.8 ~ 1.16.5
|
||||
implementation fg.deobf("mods:CustomSkinLoader_ForgeActive:15.0-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest
|
||||
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.15-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest
|
||||
}
|
||||
|
||||
minecraft {
|
||||
@@ -104,7 +104,7 @@ There are the available versions in different environments below:
|
||||
1. Add below contents to `build.gradle`:
|
||||
```gradle
|
||||
dependencies {
|
||||
modImplementation "mods:CustomSkinLoader_Fabric:15.0-SNAPSHOT-00"
|
||||
modImplementation "mods:CustomSkinLoader_Fabric:14.15-SNAPSHOT-00"
|
||||
}
|
||||
|
||||
tasks.runClient {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
+19
-16
@@ -8,7 +8,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
@@ -49,7 +49,8 @@ public class CustomSkinLoader {
|
||||
private static final ProfileCache profileCache = new ProfileCache();
|
||||
private static final DynamicSkullManager dynamicSkullManager = new DynamicSkullManager();
|
||||
|
||||
public static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(config.threadPoolSize, config.threadPoolSize, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>());
|
||||
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(
|
||||
config.threadPoolSize, config.threadPoolSize, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>());
|
||||
|
||||
//Correct thread name in thread pool
|
||||
private static final ThreadFactory defaultFactory = Executors.defaultThreadFactory();
|
||||
@@ -70,28 +71,26 @@ public class CustomSkinLoader {
|
||||
THREAD_POOL.execute(runnable);
|
||||
}
|
||||
|
||||
public static Object loadProfileLazily(GameProfile gameProfile, Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> function) {
|
||||
public static void loadProfileLazily(
|
||||
GameProfile gameProfile, Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> consumer) {
|
||||
String username = gameProfile.getName();
|
||||
String credential = MinecraftUtil.getCredential(gameProfile);
|
||||
// Fix: http://hopper.minecraft.net/crashes/minecraft/MCX-2773713
|
||||
if (username == null) {
|
||||
logger.warning("Could not load profile: username is null.");
|
||||
return function.apply(Maps.newHashMap());
|
||||
consumer.accept(Maps.newHashMap());
|
||||
return;
|
||||
}
|
||||
String tempName = Thread.currentThread().getName();
|
||||
Thread.currentThread().setName(username); // Change Thread Name
|
||||
if (profileCache.isLoading(credential)) {
|
||||
profileCache.putLoader(credential, function);
|
||||
profileCache.putLoader(credential, consumer);
|
||||
Thread.currentThread().setName(tempName);
|
||||
return function.apply(Maps.newHashMap());
|
||||
return;
|
||||
}
|
||||
Object result = function.apply(loadProfile(gameProfile));
|
||||
consumer.accept(loadProfile(gameProfile));
|
||||
Thread.currentThread().setName(tempName);
|
||||
Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> func = profileCache.getLastLoader(credential);
|
||||
if (func != null) {
|
||||
result = loadProfileLazily(gameProfile, func);
|
||||
}
|
||||
return result;
|
||||
profileCache.getLastLoader(credential).ifPresent(c -> loadProfileLazily(gameProfile, c));
|
||||
}
|
||||
|
||||
//For User Skin
|
||||
@@ -195,7 +194,8 @@ public class CustomSkinLoader {
|
||||
}
|
||||
|
||||
//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 credential = MinecraftUtil.getCredential(gameProfile);
|
||||
|
||||
@@ -230,9 +230,12 @@ public class CustomSkinLoader {
|
||||
Logger logger = LogManager.getLogger("Core");
|
||||
logger.info("CustomSkinLoader " + CustomSkinLoader_FULL_VERSION);
|
||||
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("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("Operating System: " + System.getProperty("os.name") +
|
||||
" (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"));
|
||||
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());
|
||||
return logger;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+4
-7
@@ -2,20 +2,19 @@ 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 final HttpTextureUtil.HttpTextureInfo info;
|
||||
private final Map<String, String> metadata;
|
||||
private HttpTextureUtil.HttpTextureInfo info;
|
||||
private ResourceLocation resourceLocation;
|
||||
|
||||
public FakeMinecraftProfileTexture(String url, Map<String, String> metadata) {
|
||||
super(url, metadata);
|
||||
this.info = HttpTextureUtil.toHttpTextureInfo(url);
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
public void setResourceLocation(ResourceLocation resourceLocation) {
|
||||
@@ -31,10 +30,8 @@ public class FakeMinecraftProfileTexture extends MinecraftProfileTexture {
|
||||
return this.info.url;
|
||||
}
|
||||
|
||||
public void setModule(String module) {
|
||||
if (this.metadata != null) {
|
||||
this.metadata.put("module", module);
|
||||
}
|
||||
public String getRawUrl() {
|
||||
return super.getUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
File renamed without changes.
+47
-100
@@ -2,63 +2,38 @@ package customskinloader.fake;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.utils.HttpTextureUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import customskinloader.utils.MinecraftUtil;
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FakeSkinManager {
|
||||
private final static Map<ResourceLocation, MinecraftProfileTexture> MODEL_CACHE = new ConcurrentHashMap<>();
|
||||
private final TextureManager textureManager;
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, File, MinecraftSessionService)}
|
||||
*/
|
||||
public static void setSkinCacheDir(File skinCacheDirectory) {
|
||||
private final Map<ResourceLocation, MinecraftProfileTexture> modelCache = new ConcurrentHashMap<>();
|
||||
|
||||
public FakeSkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) {
|
||||
this.textureManager = textureManagerInstance;
|
||||
HttpTextureUtil.defaultCacheDir = skinCacheDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)}
|
||||
*/
|
||||
public static void setSkinCacheDir(Path skinCacheDirectory) {
|
||||
HttpTextureUtil.defaultCacheDir = skinCacheDirectory.toFile();
|
||||
}
|
||||
|
||||
private static CacheLoader<Object, ?> cacheLoader;
|
||||
/**
|
||||
* Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)}
|
||||
*/
|
||||
public static CacheLoader<Object, ?> setCacheLoader(CacheLoader<Object, ?> loader) {
|
||||
return cacheLoader = loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#getOrLoad(GameProfile)}
|
||||
*/
|
||||
public static Object loadCache(LoadingCache<?, ?> loadingCache, Object cacheKey) throws Exception {
|
||||
return cacheLoader.load(cacheKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
|
||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
|
||||
*/
|
||||
public static ResourceLocation setResourceLocation(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
|
||||
if (profileTexture instanceof FakeMinecraftProfileTexture) {
|
||||
@@ -68,19 +43,19 @@ public class FakeSkinManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
|
||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
|
||||
* <p>
|
||||
* {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);} -> {@code skinAvailableCallback.skinAvailable(textureType, resourcelocation, this.fakeManager.getModelCache(profileTexture, resourcelocation));}
|
||||
* <p>
|
||||
*/
|
||||
public static MinecraftProfileTexture getModelCache(MinecraftProfileTexture profileTexture, ResourceLocation location) {
|
||||
return MODEL_CACHE.getOrDefault(location, profileTexture);
|
||||
public static MinecraftProfileTexture getModelCache(MinecraftProfileTexture profileTexture, FakeSkinManager fakeManager, ResourceLocation location) {
|
||||
return fakeManager.modelCache.getOrDefault(location, profileTexture);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)}
|
||||
* Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinAvailableCallback)}
|
||||
*/
|
||||
public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) {
|
||||
public static Object[] createThreadDownloadImageData(ImmutableList<Object> list, FakeSkinManager fakeManager, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
|
||||
Object[] params = list.toArray();
|
||||
if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) {
|
||||
FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture;
|
||||
@@ -90,7 +65,7 @@ public class FakeSkinManager {
|
||||
if (params[params.length - 2] instanceof Boolean) {
|
||||
params[params.length - 2] = true;
|
||||
}
|
||||
params[params.length - 1] = new BaseBuffer((Runnable) params[params.length - 1], textureType, resourcelocation, fakeProfileTexture);
|
||||
params[params.length - 1] = fakeManager.new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, fakeProfileTexture);
|
||||
}
|
||||
}
|
||||
return params;
|
||||
@@ -99,7 +74,7 @@ public class FakeSkinManager {
|
||||
|
||||
private final static String KEY = "CustomSkinLoaderInfo";
|
||||
/**
|
||||
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager.SkinAvailableCallback, boolean)}
|
||||
* Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinAvailableCallback, boolean)}
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void loadProfileTextures(Runnable runnable, GameProfile profile) {
|
||||
@@ -107,31 +82,9 @@ public class FakeSkinManager {
|
||||
// This is a hack.
|
||||
((Multimap) profile.getProperties()).put(KEY, m);
|
||||
runnable.run();
|
||||
return null;
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 23w31a+
|
||||
* Invoked from net.minecraft.client.resources.SkinManager$1#load(net.minecraft.client.resources.SkinManager$CacheKey, GameProfile)
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static Object[] loadProfileTextures(ImmutableList<Object> list, GameProfile profile) {
|
||||
Object[] params = list.toArray();
|
||||
if (!profile.getProperties().containsKey(SKULL_KEY)) {
|
||||
final Supplier<?> supplier = (Supplier<?>) params[0];
|
||||
params[0] = (Supplier<?>) () -> CustomSkinLoader.loadProfileLazily(profile, m -> {
|
||||
// This is a hack.
|
||||
((Multimap) profile.getProperties()).put(KEY, m);
|
||||
return supplier.get();
|
||||
});
|
||||
params[1] = CustomSkinLoader.THREAD_POOL;
|
||||
} else {
|
||||
params[1] = Minecraft.getMinecraft();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from {@link SkinManager#lambda$loadProfileTextures$1(GameProfile, boolean, SkinAvailableCallback)}
|
||||
*/
|
||||
@@ -153,80 +106,74 @@ public class FakeSkinManager {
|
||||
}
|
||||
}
|
||||
|
||||
private final static String SKULL_KEY = "CSL$IsSkull";
|
||||
/**
|
||||
* 23w31a+
|
||||
* Invoked from {@link SkinManager#getInsecureSkin(GameProfile)}
|
||||
*/
|
||||
public static void setSkullType(GameProfile profile) {
|
||||
profile.getProperties().removeAll(SKULL_KEY);
|
||||
profile.getProperties().put(SKULL_KEY, new Property(SKULL_KEY, "true"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 23w31a+
|
||||
* Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(GameProfile)
|
||||
*/
|
||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
|
||||
if (profile.getProperties().containsKey(SKULL_KEY)) {
|
||||
profile.getProperties().removeAll(SKULL_KEY);
|
||||
return CustomSkinLoader.loadProfileFromCache(profile);
|
||||
} else {
|
||||
return getUserProfile(sessionService, profile, requireSecure);
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = CustomSkinLoader.loadProfileFromCache(profile);
|
||||
for (Iterator<Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||
Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture> entry = it.next();
|
||||
MinecraftProfileTexture texture = entry.getValue();
|
||||
if (shouldJudgeType(texture)) {
|
||||
texture = this.modelCache.get(MinecraftUtil.getSkinManager().loadSkin(texture, entry.getKey()));
|
||||
if (texture == null) { // remove texture if was not loaded before
|
||||
it.remove();
|
||||
} else {
|
||||
map.put(entry.getKey(), texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) {
|
||||
return CustomSkinLoader.loadProfileFromCache(profile);
|
||||
private static void makeCallback(SkinManager.SkinAvailableCallback callback, MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture texture) {
|
||||
if (callback != null)
|
||||
callback.skinAvailable(type, location, texture);
|
||||
}
|
||||
|
||||
private static boolean shouldJudgeType(MinecraftProfileTexture texture) {
|
||||
return texture != null && "auto".equals(texture.getMetadata("model"));
|
||||
}
|
||||
|
||||
private static class BaseBuffer implements IImageBuffer {
|
||||
private class BaseBuffer implements IImageBuffer {
|
||||
private IImageBuffer buffer;
|
||||
|
||||
private final Runnable callback;
|
||||
private final ResourceLocation location;
|
||||
private final FakeMinecraftProfileTexture texture;
|
||||
private SkinManager.SkinAvailableCallback callback;
|
||||
private MinecraftProfileTexture.Type type;
|
||||
private ResourceLocation location;
|
||||
private FakeMinecraftProfileTexture texture;
|
||||
|
||||
public BaseBuffer(Runnable callback, MinecraftProfileTexture.Type type, ResourceLocation location, FakeMinecraftProfileTexture texture) {
|
||||
public BaseBuffer(SkinManager.SkinAvailableCallback callback, MinecraftProfileTexture.Type type, ResourceLocation location, FakeMinecraftProfileTexture texture) {
|
||||
switch (type) {
|
||||
case SKIN: this.buffer = new FakeSkinBuffer(); break;
|
||||
case CAPE: this.buffer = new FakeCapeBuffer(location); break;
|
||||
}
|
||||
|
||||
this.callback = callback;
|
||||
this.type = type;
|
||||
this.location = location;
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeImage func_195786_a(NativeImage image) {
|
||||
public net.minecraft.client.renderer.texture.NativeImage func_195786_a(net.minecraft.client.renderer.texture.NativeImage image) {
|
||||
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).func_195786_a(image) : image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(BufferedImage image) {
|
||||
return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).parseUserSkin(image) : image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void skinAvailable() {
|
||||
if (buffer != null) {
|
||||
buffer.skinAvailable();
|
||||
if (shouldJudgeType(texture) && buffer instanceof FakeSkinBuffer) {
|
||||
//Auto judge skin type
|
||||
Map<String, String> metadata = Maps.newHashMap();
|
||||
String type = ((FakeSkinBuffer) buffer).judgeType();
|
||||
texture.setModule(type);
|
||||
MODEL_CACHE.put(location, texture);
|
||||
metadata.put("model", type);
|
||||
texture = new FakeMinecraftProfileTexture(texture.getRawUrl(), metadata);
|
||||
FakeSkinManager.this.modelCache.put(location, texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.callback != null) {
|
||||
this.callback.run();
|
||||
}
|
||||
FakeSkinManager.makeCallback(callback, type, location, texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+1
-1
@@ -4,7 +4,7 @@ import java.io.InputStream;
|
||||
|
||||
import net.minecraft.client.resources.IResource;
|
||||
|
||||
/** {@link IResource} is no longer an interface since 22w14a */
|
||||
/** {@link net.minecraft.client.resources.IResource} is no longer an interface since 22w14a */
|
||||
public interface IFakeIResource {
|
||||
// 1.13.2 ~ 22w13a
|
||||
interface V1 {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+21
-13
@@ -25,7 +25,6 @@ import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
import customskinloader.profile.ModelManager0;
|
||||
import customskinloader.profile.UserProfile;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import customskinloader.utils.TextureUtil;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -112,7 +111,8 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
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));
|
||||
return gameProfileCache.computeIfAbsent(apiRoot + " " + username,
|
||||
ignored -> loadGameProfile(apiRoot, username));
|
||||
}
|
||||
|
||||
//Username -> UUID
|
||||
@@ -120,7 +120,10 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
//Doc (https://wiki.vg/Mojang_API#Playernames_-.3E_UUIDs)
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
|
||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft").setCacheTime(600).setPayload(gson.toJson(Collections.singletonList(username))));
|
||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(
|
||||
new HttpRequestUtil.HttpRequest(apiRoot + "profiles/minecraft")
|
||||
.setCacheTime(600).setPayload(gson.toJson(Collections.singletonList(username)))
|
||||
);
|
||||
if (StringUtils.isEmpty(responce.content)) {
|
||||
return null;
|
||||
}
|
||||
@@ -150,21 +153,26 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
return null;
|
||||
}
|
||||
UUID id = profile.getId();
|
||||
return standard ? id.toString() : TextureUtil.fromUUID(id);
|
||||
return standard ? id.toString() : UUIDTypeAdapter.fromUUID(id);
|
||||
}
|
||||
|
||||
//UUID -> Profile
|
||||
public static GameProfile fillGameProfile(String sessionRoot, GameProfile profile) {
|
||||
//Doc (http://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape)
|
||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(sessionRoot + "session/minecraft/profile/" + TextureUtil.fromUUID(profile.getId())).setCacheTime(90));
|
||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(
|
||||
new HttpRequestUtil.HttpRequest(sessionRoot + "session/minecraft/profile/"
|
||||
+ UUIDTypeAdapter.fromUUID(profile.getId())).setCacheTime(90));
|
||||
if (StringUtils.isEmpty(responce.content)) {
|
||||
return profile;
|
||||
}
|
||||
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
||||
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer())
|
||||
.create();
|
||||
MinecraftProfilePropertiesResponse propertiesResponce = gson.fromJson(responce.content, MinecraftProfilePropertiesResponse.class);
|
||||
GameProfile newGameProfile = new GameProfile(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID.get(propertiesResponce), TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME.get(propertiesResponce));
|
||||
newGameProfile.getProperties().putAll(TextureUtil.AuthlibField.MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES.get(propertiesResponce));
|
||||
GameProfile newGameProfile = new GameProfile(propertiesResponce.getId(), propertiesResponce.getName());
|
||||
newGameProfile.getProperties().putAll(propertiesResponce.getProperties());
|
||||
|
||||
return newGameProfile;
|
||||
}
|
||||
@@ -177,23 +185,23 @@ public class MojangAPILoader implements ICustomSkinLoaderPlugin, ProfileLoader.I
|
||||
if (textureProperty == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
String value = TextureUtil.AuthlibField.PROPERTY_VALUE_FIELD.get(textureProperty);
|
||||
String value = textureProperty.getValue();
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
String json = new String(Base64.decodeBase64(value), StandardCharsets.UTF_8);
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
MinecraftTexturesPayload result = gson.fromJson(json, MinecraftTexturesPayload.class);
|
||||
|
||||
if (result == null || TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result) == null) {
|
||||
if (result == null || result.getTextures() == null) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
return TextureUtil.AuthlibField.MINECRAFT_TEXTURES_PAYLOAD_TEXTURES.get(result);
|
||||
return result.getTextures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
||||
return (!StringUtils.isNoneEmpty(ssp0.apiRoot) || ssp0.apiRoot.equalsIgnoreCase(ssp1.apiRoot)) || (!StringUtils.isNoneEmpty(ssp0.sessionRoot) || ssp0.sessionRoot.equalsIgnoreCase(ssp1.sessionRoot));
|
||||
return (!StringUtils.isNoneEmpty(ssp0.apiRoot) || ssp0.apiRoot.equalsIgnoreCase(ssp1.apiRoot)) ||
|
||||
(!StringUtils.isNoneEmpty(ssp0.sessionRoot) || ssp0.sessionRoot.equalsIgnoreCase(ssp1.sessionRoot));
|
||||
}
|
||||
|
||||
@Override
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+7
-1
@@ -3,6 +3,7 @@ package customskinloader.loader.jsonapi;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.JsonAPILoader;
|
||||
import customskinloader.loader.MojangAPILoader;
|
||||
import customskinloader.plugin.ICustomSkinLoaderPlugin;
|
||||
@@ -30,7 +31,7 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
||||
|
||||
@Override
|
||||
public String getRoot() {
|
||||
return "https://api.minecraftcapes.net/profile/";
|
||||
return "https://minecraftcapes.net/profile/";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +64,11 @@ public class MinecraftCapesAPI implements JsonAPILoader.IJsonAPI {
|
||||
return profile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPayload(SkinSiteProfile ssp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "MinecraftCapesAPI";
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,160 @@
|
||||
package customskinloader.profile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.codec.Charsets;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import customskinloader.utils.HttpRequestUtil.HttpRequest;
|
||||
import customskinloader.utils.HttpRequestUtil.HttpResponce;
|
||||
import customskinloader.utils.HttpTextureUtil;
|
||||
import customskinloader.utils.HttpUtil0;
|
||||
|
||||
public class DynamicSkullManager {
|
||||
public static class SkullTexture{
|
||||
public Map<Type,MinecraftProfileTexture> textures;
|
||||
public String index;//Index File
|
||||
public ArrayList<String> skins;
|
||||
public int interval;
|
||||
public boolean fromZero;
|
||||
//For program
|
||||
public long startTime;
|
||||
public int period;
|
||||
}
|
||||
private Map<GameProfile, SkullTexture> dynamicTextures = new ConcurrentHashMap<>();
|
||||
private Map<GameProfile, Map<Type, MinecraftProfileTexture>> staticTextures = new ConcurrentHashMap<>();
|
||||
private List<GameProfile> loadingList=new ArrayList<GameProfile>();
|
||||
|
||||
private void parseGameProfile(GameProfile profile){
|
||||
Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null);
|
||||
if (textureProperty==null){
|
||||
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
|
||||
return;
|
||||
}
|
||||
String value=textureProperty.getValue();
|
||||
if(StringUtils.isBlank(value)){
|
||||
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
|
||||
return;
|
||||
}
|
||||
@SuppressWarnings("deprecation") String json = new String(Base64.decodeBase64(value), Charsets.UTF_8);
|
||||
Gson gson=new GsonBuilder().registerTypeAdapter(UUID.class,new UUIDTypeAdapter()).create();
|
||||
SkullTexture result=gson.fromJson(json,SkullTexture.class);
|
||||
if(result==null){
|
||||
staticTextures.put(profile, Maps.<Type, MinecraftProfileTexture>newHashMap());
|
||||
return;
|
||||
}
|
||||
staticTextures.put(profile, (result.textures==null || !result.textures.containsKey(Type.SKIN)) ?
|
||||
Maps.<Type, MinecraftProfileTexture>newHashMap() : parseTextures(result.textures));
|
||||
|
||||
if(StringUtils.isNotEmpty(result.index)){
|
||||
File indexFile=new File(CustomSkinLoader.DATA_DIR,result.index);
|
||||
try{
|
||||
String index=FileUtils.readFileToString(indexFile, "UTF-8");
|
||||
if(StringUtils.isNotEmpty(index)){
|
||||
String[] skins = CustomSkinLoader.GSON.fromJson(index, String[].class);
|
||||
if(skins != null && skins.length != 0)
|
||||
result.skins = Lists.newArrayList(skins);
|
||||
}
|
||||
}catch(Exception e){
|
||||
CustomSkinLoader.logger.warning("Exception occurs while parsing index file: "+e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if(!CustomSkinLoader.config.enableDynamicSkull||result.skins==null||result.skins.isEmpty())
|
||||
return;
|
||||
|
||||
CustomSkinLoader.logger.info("Try to load Dynamic Skull: "+json);
|
||||
|
||||
for(int i=0;i<result.skins.size();i++){//check and cache skins
|
||||
String skin=result.skins.get(i);
|
||||
if(HttpUtil0.isLocal(skin)){
|
||||
//Local Skin
|
||||
File skinFile=new File(CustomSkinLoader.DATA_DIR,skin);
|
||||
if(skinFile.isFile()&&skinFile.length()>0){
|
||||
//Skin found
|
||||
String fakeUrl=HttpTextureUtil.getLocalFakeUrl(skin);
|
||||
result.skins.set(i, fakeUrl);
|
||||
}else{
|
||||
//Could not find skin
|
||||
result.skins.remove(i--);
|
||||
}
|
||||
}else{
|
||||
//Online Skin
|
||||
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(skin).setCacheFile(HttpTextureUtil.getCacheFile(FilenameUtils.getBaseName(skin))).setCacheTime(0).setLoadContent(false));
|
||||
if(!responce.success){
|
||||
//Could not load skin
|
||||
result.skins.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(result.skins.isEmpty()){//Nothing loaded
|
||||
CustomSkinLoader.logger.info("Failed: Nothing loaded.");
|
||||
return;
|
||||
}
|
||||
result.interval=Math.max(result.interval, 50);
|
||||
if(result.fromZero)
|
||||
result.startTime=System.currentTimeMillis();
|
||||
result.period=result.interval*result.skins.size();
|
||||
CustomSkinLoader.logger.info("Successfully loaded Dynamic Skull: "+new Gson().toJson(result));
|
||||
dynamicTextures.put(profile, result);
|
||||
staticTextures.remove(profile);
|
||||
}
|
||||
|
||||
//Support local skin for skull
|
||||
public Map<Type, MinecraftProfileTexture> parseTextures(Map<Type, MinecraftProfileTexture> textures) {
|
||||
MinecraftProfileTexture skin=textures.get(Type.SKIN);
|
||||
String skinUrl=skin.getUrl();
|
||||
if(!HttpUtil0.isLocal(skinUrl))
|
||||
return textures;
|
||||
File skinFile=new File(CustomSkinLoader.DATA_DIR,skinUrl);
|
||||
if(!skinFile.isFile())
|
||||
return Maps.newHashMap();
|
||||
textures.put(Type.SKIN, ModelManager0.getProfileTexture(HttpTextureUtil.getLocalFakeUrl(skinUrl), null));
|
||||
return textures;
|
||||
}
|
||||
|
||||
public Map<Type,MinecraftProfileTexture> getTexture(final GameProfile profile){
|
||||
if(staticTextures.get(profile)!=null)
|
||||
return staticTextures.get(profile);
|
||||
if(loadingList.contains(profile))
|
||||
return Maps.newHashMap();
|
||||
if(dynamicTextures.containsKey(profile)){
|
||||
SkullTexture texture=dynamicTextures.get(profile);
|
||||
long time=System.currentTimeMillis()-texture.startTime;
|
||||
int index=(int)Math.floor((time%texture.period)/texture.interval);
|
||||
Map<Type,MinecraftProfileTexture> map=Maps.newHashMap();
|
||||
map.put(Type.SKIN, ModelManager0.getProfileTexture(texture.skins.get(index), null));
|
||||
return map;
|
||||
}
|
||||
|
||||
loadingList.add(profile);
|
||||
Thread loadThread=new Thread(){
|
||||
public void run(){
|
||||
parseGameProfile(profile);//Load in thread
|
||||
loadingList.remove(profile);
|
||||
}
|
||||
};
|
||||
loadThread.setName("Skull "+profile.hashCode());
|
||||
loadThread.start();
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+8
-7
@@ -3,9 +3,10 @@ package customskinloader.profile;
|
||||
import java.io.File;
|
||||
import java.util.Deque;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
@@ -17,7 +18,7 @@ public class ProfileCache {
|
||||
|
||||
private Map<String, CachedProfile> cachedProfiles = new ConcurrentHashMap<>();
|
||||
private Map<String, UserProfile> localProfiles = new ConcurrentHashMap<>();
|
||||
private Map<String, Deque<Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?>>> profileLoaders = new ConcurrentHashMap<>();
|
||||
private Map<String, Deque<Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>>> profileLoaders = new ConcurrentHashMap<>();
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public ProfileCache(){
|
||||
@@ -52,12 +53,12 @@ public class ProfileCache {
|
||||
return localProfiles.get(username.toLowerCase());
|
||||
return loadLocalProfile(username);
|
||||
}
|
||||
public Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> getLastLoader(String username) {
|
||||
Deque<Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?>> deque = this.profileLoaders.get(username);
|
||||
public Optional<Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>> getLastLoader(String username) {
|
||||
Deque<Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>>> deque = this.profileLoaders.get(username);
|
||||
if (deque != null) {
|
||||
return deque.pollLast();
|
||||
return Optional.ofNullable(deque.pollLast());
|
||||
}
|
||||
return null;
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public void setLoading(String username,boolean loading){
|
||||
@@ -74,7 +75,7 @@ public class ProfileCache {
|
||||
return;
|
||||
saveLocalProfile(username,profile);
|
||||
}
|
||||
public void putLoader(String username, Function<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>, ?> loader) {
|
||||
public void putLoader(String username, Consumer<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> loader) {
|
||||
this.profileLoaders.putIfAbsent(username, new ConcurrentLinkedDeque<>());
|
||||
this.profileLoaders.get(username).offerLast(loader);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,33 @@
|
||||
package customskinloader.utils;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class TextureUtil {
|
||||
/**
|
||||
* Save and get fake url of base64 texture
|
||||
*
|
||||
* @param base64 texture in base64 string
|
||||
* @return base64 fake url
|
||||
* @since 14.16
|
||||
*/
|
||||
public static String parseBase64Texture(String base64) {
|
||||
byte[] capeBytes = Base64.decodeBase64(base64);
|
||||
String hash = HttpTextureUtil.getHash(capeBytes);
|
||||
File cacheFile = HttpTextureUtil.getCacheFile(hash);
|
||||
String fakeUrl = HttpTextureUtil.getBase64FakeUrl(hash);
|
||||
|
||||
//Save base64 image to cache file
|
||||
try {
|
||||
FileUtils.writeByteArrayToFile(cacheFile, capeBytes);
|
||||
CustomSkinLoader.logger.info("Saved base64 image to " + cacheFile);
|
||||
return fakeUrl;
|
||||
} catch (Exception e) {
|
||||
CustomSkinLoader.logger.warning("Error parsing base64 image: " + base64);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+6
-2
@@ -2,13 +2,17 @@ package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import customskinloader.fake.itf.IFakeIImageBuffer;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
public interface IImageBuffer extends IFakeIImageBuffer {
|
||||
public interface IImageBuffer extends Runnable {
|
||||
BufferedImage parseUserSkin(BufferedImage image);
|
||||
|
||||
NativeImage func_195786_a(NativeImage image);
|
||||
|
||||
void skinAvailable();
|
||||
|
||||
@Override
|
||||
default void run() {
|
||||
this.skinAvailable();
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,10 +0,0 @@
|
||||
package customskinloader.fake.itf;
|
||||
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
|
||||
public interface IFakeIImageBuffer extends Runnable {
|
||||
@Override
|
||||
default void run() {
|
||||
((IImageBuffer) this).skinAvailable();
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package customskinloader.profile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import customskinloader.utils.HttpTextureUtil;
|
||||
import customskinloader.utils.HttpUtil0;
|
||||
import customskinloader.utils.TextureUtil;
|
||||
import org.apache.commons.codec.Charsets;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class DynamicSkullManager {
|
||||
public static class SkullTexture {
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures;
|
||||
public String index;//Index File
|
||||
public ArrayList<String> skins;
|
||||
public int interval;
|
||||
public boolean fromZero;
|
||||
//For program
|
||||
public long startTime;
|
||||
public int period;
|
||||
}
|
||||
|
||||
private Map<GameProfile, SkullTexture> dynamicTextures = new ConcurrentHashMap<>();
|
||||
private Map<GameProfile, Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> staticTextures = new ConcurrentHashMap<>();
|
||||
private List<GameProfile> loadingList = Lists.newArrayList();
|
||||
|
||||
private void parseGameProfile(GameProfile profile) {
|
||||
Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null);
|
||||
if (textureProperty == null) {
|
||||
staticTextures.put(profile, Maps.newHashMap());
|
||||
return;
|
||||
}
|
||||
String value = TextureUtil.AuthlibField.PROPERTY_VALUE_FIELD.get(textureProperty);
|
||||
if (StringUtils.isBlank(value)) {
|
||||
staticTextures.put(profile, Maps.newHashMap());
|
||||
return;
|
||||
}
|
||||
@SuppressWarnings("deprecation") String json = new String(Base64.decodeBase64(value), Charsets.UTF_8);
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||
SkullTexture result = gson.fromJson(json, SkullTexture.class);
|
||||
if (result == null) {
|
||||
staticTextures.put(profile, Maps.newHashMap());
|
||||
return;
|
||||
}
|
||||
staticTextures.put(profile, (result.textures == null || !result.textures.containsKey(MinecraftProfileTexture.Type.SKIN)) ? Maps.newHashMap() : parseTextures(result.textures));
|
||||
|
||||
if (StringUtils.isNotEmpty(result.index)) {
|
||||
File indexFile = new File(CustomSkinLoader.DATA_DIR, result.index);
|
||||
try {
|
||||
String index = FileUtils.readFileToString(indexFile, "UTF-8");
|
||||
if (StringUtils.isNotEmpty(index)) {
|
||||
String[] skins = CustomSkinLoader.GSON.fromJson(index, String[].class);
|
||||
if (skins != null && skins.length != 0)
|
||||
result.skins = Lists.newArrayList(skins);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CustomSkinLoader.logger.warning("Exception occurs while parsing index file: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (!CustomSkinLoader.config.enableDynamicSkull || result.skins == null || result.skins.isEmpty())
|
||||
return;
|
||||
|
||||
CustomSkinLoader.logger.info("Try to load Dynamic Skull: " + json);
|
||||
|
||||
for (int i = 0; i < result.skins.size(); i++) {//check and cache skins
|
||||
String skin = result.skins.get(i);
|
||||
if (HttpUtil0.isLocal(skin)) {
|
||||
//Local Skin
|
||||
File skinFile = new File(CustomSkinLoader.DATA_DIR, skin);
|
||||
if (skinFile.isFile() && skinFile.length() > 0) {
|
||||
//Skin found
|
||||
String fakeUrl = HttpTextureUtil.getLocalFakeUrl(skin);
|
||||
result.skins.set(i, fakeUrl);
|
||||
} else {
|
||||
//Could not find skin
|
||||
result.skins.remove(i--);
|
||||
}
|
||||
} else {
|
||||
//Online Skin
|
||||
HttpRequestUtil.HttpResponce responce = HttpRequestUtil.makeHttpRequest(new HttpRequestUtil.HttpRequest(skin).setCacheFile(HttpTextureUtil.getCacheFile(FilenameUtils.getBaseName(skin))).setCacheTime(0).setLoadContent(false));
|
||||
if (!responce.success) {
|
||||
//Could not load skin
|
||||
result.skins.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.skins.isEmpty()) {//Nothing loaded
|
||||
CustomSkinLoader.logger.info("Failed: Nothing loaded.");
|
||||
return;
|
||||
}
|
||||
result.interval = Math.max(result.interval, 50);
|
||||
if (result.fromZero)
|
||||
result.startTime = System.currentTimeMillis();
|
||||
result.period = result.interval * result.skins.size();
|
||||
CustomSkinLoader.logger.info("Successfully loaded Dynamic Skull: " + new Gson().toJson(result));
|
||||
dynamicTextures.put(profile, result);
|
||||
staticTextures.remove(profile);
|
||||
}
|
||||
|
||||
//Support local skin for skull
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> parseTextures(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> textures) {
|
||||
MinecraftProfileTexture skin = textures.get(MinecraftProfileTexture.Type.SKIN);
|
||||
String skinUrl = skin.getUrl();
|
||||
if (!HttpUtil0.isLocal(skinUrl))
|
||||
return textures;
|
||||
File skinFile = new File(CustomSkinLoader.DATA_DIR, skinUrl);
|
||||
if (!skinFile.isFile())
|
||||
return Maps.newHashMap();
|
||||
textures.put(MinecraftProfileTexture.Type.SKIN, ModelManager0.getProfileTexture(HttpTextureUtil.getLocalFakeUrl(skinUrl), null));
|
||||
return textures;
|
||||
}
|
||||
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTexture(final GameProfile profile) {
|
||||
if (staticTextures.get(profile) != null)
|
||||
return staticTextures.get(profile);
|
||||
if (loadingList.contains(profile))
|
||||
return Maps.newHashMap();
|
||||
if (dynamicTextures.containsKey(profile)) {
|
||||
SkullTexture texture = dynamicTextures.get(profile);
|
||||
long time = System.currentTimeMillis() - texture.startTime;
|
||||
int index = (int) Math.floor((time % texture.period) / texture.interval);
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap();
|
||||
map.put(MinecraftProfileTexture.Type.SKIN, ModelManager0.getProfileTexture(texture.skins.get(index), null));
|
||||
return map;
|
||||
}
|
||||
|
||||
loadingList.add(profile);
|
||||
Thread loadThread = new Thread(() -> {
|
||||
parseGameProfile(profile);//Load in thread
|
||||
loadingList.remove(profile);
|
||||
});
|
||||
loadThread.setName("Skull " + profile.hashCode());
|
||||
loadThread.start();
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package customskinloader.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
|
||||
import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Some of the classes in Authlib used after Minecraft 23w31a were changed to record classes,
|
||||
// resulting in changes to method names, so reflection is used here to be compatible with these changes.
|
||||
public enum AuthlibField {
|
||||
PROPERTY_VALUE_FIELD(Property.class, "value"),
|
||||
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_ID(MinecraftProfilePropertiesResponse.class, "id"),
|
||||
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_NAME(MinecraftProfilePropertiesResponse.class, "name"),
|
||||
MINECRAFT_PROFILE_PROPERTIES_RESPONSE_PROPERTIES(MinecraftProfilePropertiesResponse.class, "properties"),
|
||||
MINECRAFT_TEXTURES_PAYLOAD_TEXTURES(MinecraftTexturesPayload.class, "textures");
|
||||
|
||||
private final Field field;
|
||||
|
||||
AuthlibField(Class<?> clazz, String name) {
|
||||
try {
|
||||
this.field = clazz.getDeclaredField(name);
|
||||
this.field.setAccessible(true);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(Object o) {
|
||||
try {
|
||||
return (T) this.field.get(o);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String fromUUID(UUID value) {
|
||||
return value.toString().replace("-", "");
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -15,6 +15,7 @@ net/minecraft/client/Minecraft net/minecraft/class_310
|
||||
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; method_1582
|
||||
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; method_1531
|
||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
|
||||
net/minecraft/client/gui/spectator/PlayerMenuObject net/minecraft/class_530
|
||||
net/minecraft/client/multiplayer/ServerData net/minecraft/class_642
|
||||
serverIP field_3761
|
||||
net/minecraft/client/renderer/RenderType net/minecraft/class_1921
|
||||
@@ -49,12 +50,11 @@ net/minecraft/client/resources/IResourceManager net/minecraft/class_3300
|
||||
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$1 net/minecraft/class_1071$1
|
||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$class_8686
|
||||
profile ()Lcom/mojang/authlib/GameProfile; comp_1631
|
||||
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
|
||||
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
|
||||
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071$class_8687
|
||||
net/minecraft/resources/IResource net/minecraft/class_3298
|
||||
net/minecraft/resources/IResourceManager net/minecraft/class_3300
|
||||
net/minecraft/util/ResourceLocation net/minecraft/class_2960
|
||||
|
||||
+8
-16
@@ -1,9 +1,16 @@
|
||||
|
||||
jar {
|
||||
exclude 'customskinloader/tweaker/**'
|
||||
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'net/minecraft/client/resources/**'
|
||||
exclude 'net/minecraft/resources/**'
|
||||
exclude 'Profile.json'
|
||||
}
|
||||
sourceJar {
|
||||
exclude 'customskinloader/tweaker/**'
|
||||
exclude 'net/**'
|
||||
exclude 'Profile.json'
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -11,10 +18,6 @@ repositories {
|
||||
name = "fabric"
|
||||
url = "https://maven.fabricmc.net/"
|
||||
}
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = "https://repo.spongepowered.org/repository/maven-public/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -26,18 +29,7 @@ import customskinloader.gradle.util.RemapUtil
|
||||
import customskinloader.gradle.util.SourceUtil
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
apply from: rootProject.file("buildSrc/patch.gradle")
|
||||
patchMixin()
|
||||
|
||||
mixin {
|
||||
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
||||
reobfSrgFile = "build/mixin.srg"
|
||||
reobfNotchSrgFile = "build/mixin.srg"
|
||||
}
|
||||
|
||||
SourceUtil.addDependencies project, project(":Common")
|
||||
SourceUtil.addDependencies project, project(":Common"), project(":Vanilla/Common")
|
||||
RemapUtil.remapSources project
|
||||
|
||||
// Resolve snapshot versions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
minecraft_version=1.14
|
||||
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,1.20.2
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21
|
||||
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
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
|
||||
+12
-12
@@ -2,17 +2,22 @@ com/mojang/blaze3d/matrix/MatrixStack net/minecraft/class_4587
|
||||
net/minecraft/client/Minecraft net/minecraft/class_310
|
||||
isIntegratedServerRunning ()Z method_1542
|
||||
net/minecraft/client/entity/AbstractClientPlayer net/minecraft/class_742
|
||||
getDownloadImageSkin (Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)Lnet/minecraft/client/renderer/ThreadDownloadImageData; method_3120
|
||||
getLocationSkin (Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; method_3124
|
||||
net/minecraft/client/gui/Gui net/minecraft/class_332
|
||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/class_355
|
||||
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 (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/renderer/IImageBuffer net/minecraft/class_760
|
||||
net/minecraft/client/renderer/IRenderTypeBuffer net/minecraft/class_4597
|
||||
net/minecraft/client/renderer/RenderType net/minecraft/class_1921
|
||||
getEntitySolid (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType; method_23572
|
||||
net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046
|
||||
bufferedImage field_110560_d
|
||||
textureUploaded field_5215
|
||||
processTask field_20843
|
||||
loadTexture (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; method_22795
|
||||
processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage; method_22798
|
||||
@@ -24,25 +29,20 @@ net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972
|
||||
doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V method_4177
|
||||
net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011
|
||||
net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060
|
||||
net/minecraft/client/resources/PlayerSkin net/minecraft/class_8685
|
||||
net/minecraft/client/resources/SkinManager net/minecraft/class_1071
|
||||
func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4653
|
||||
func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4655
|
||||
getInsecureSkin (Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin; method_52862
|
||||
getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; method_52863
|
||||
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
|
||||
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
|
||||
net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1
|
||||
lambda$load$0 (Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo; method_52867
|
||||
load (Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture; method_52868
|
||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$class_8686
|
||||
net/minecraft/client/resources/SkinManager$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
|
||||
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable
|
||||
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071$class_8687
|
||||
type field_45641
|
||||
registerTexture (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture; method_52873
|
||||
net/minecraft/client/resources/SkinManager$TextureInfo net/minecraft/class_1071$class_8688
|
||||
net/minecraft/scoreboard/ScoreObjective net/minecraft/class_266
|
||||
net/minecraft/scoreboard/Scoreboard net/minecraft/class_269
|
||||
net/minecraft/util/ResourceLocation net/minecraft/class_2960
|
||||
File renamed without changes.
+3
-5
@@ -4,18 +4,16 @@
|
||||
"package": "customskinloader.mixin",
|
||||
"client": [
|
||||
"MixinGuiPlayerTabOverlay",
|
||||
"MixinIImageBuffer",
|
||||
"MixinIResource",
|
||||
"MixinIResourceManager",
|
||||
"MixinLayerCape",
|
||||
"MixinMinecraft",
|
||||
"MixinRenderPlayer",
|
||||
"MixinSkinManager$1",
|
||||
"MixinSkinManager$TextureCache",
|
||||
"MixinSkinManager",
|
||||
"MixinSkinManager$V1",
|
||||
"MixinSkinManager$V2",
|
||||
"MixinThreadDownloadImageData$V1",
|
||||
"MixinThreadDownloadImageData$V2"
|
||||
"MixinThreadDownloadImageDataV2",
|
||||
"MixinThreadDownloadImageDataV3"
|
||||
],
|
||||
"refmap": "mixins.customskinloader.refmap.json",
|
||||
"plugin": "customskinloader.fabric.MixinConfigPlugin",
|
||||
File renamed without changes.
+5
-9
@@ -55,17 +55,13 @@ public class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
boolean result = true;
|
||||
if (mixinClassName.endsWith(".MixinIImageBuffer")) {
|
||||
result = this.world_version <= 2204 && this.protocol_version <= 553; // 18w43b ~ 19w37a
|
||||
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
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V2")) {
|
||||
result = this.world_version >= 2205 && this.protocol_version >= 554; // 19w38a+
|
||||
} else if (mixinClassName.endsWith(".MixinLayerCape") || mixinClassName.endsWith(".MixinRenderPlayer")) {
|
||||
result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V1")) {
|
||||
result = this.world_version <= 3465 && (this.protocol_version <= 763 || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x4000008E)); // 18w43b ~ 1.20.1
|
||||
} else if (mixinClassName.endsWith(".MixinSkinManager$V2") || mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$TextureCache")) {
|
||||
result = this.world_version >= 3567 && ((this.protocol_version > 763 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V1")) {
|
||||
result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V2")) {
|
||||
} else if (mixinClassName.endsWith(".MixinThreadDownloadImageDataV3")) {
|
||||
result = this.world_version >= 2723 && ((this.protocol_version >= 755 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000023); // 1.17-rc2+
|
||||
}
|
||||
logger.info("target: " + targetClassName + ", mixin: " + mixinClassName + ", result: " + result);
|
||||
@@ -1,10 +0,0 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import customskinloader.fake.itf.IFakeIImageBuffer;
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(IImageBuffer.class)
|
||||
public interface MixinIImageBuffer extends IFakeIImageBuffer {
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
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;
|
||||
import net.minecraft.client.resources.SkinManager$1;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArgs;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
||||
|
||||
@Mixin(SkinManager$1.class)
|
||||
public abstract class MixinSkinManager$1 {
|
||||
@ModifyArgs(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$1;load(Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/util/concurrent/CompletableFuture;supplyAsync(Ljava/util/function/Supplier;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;",
|
||||
remap = false
|
||||
)
|
||||
)
|
||||
private void modifyArgs_load(Args args, SkinManager.CacheKey cacheKey) {
|
||||
Object[] argsArr = new Object[args.size()];
|
||||
for (int i = 0; i < argsArr.length; i++) {
|
||||
argsArr[i] = args.get(i);
|
||||
}
|
||||
args.setAll(FakeSkinManager.loadProfileTextures(ImmutableList.copyOf(argsArr), cacheKey.profile()));
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$1;lambda$load$0(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lcom/mojang/authlib/minecraft/MinecraftSessionService;getTextures(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;",
|
||||
remap = false
|
||||
)
|
||||
)
|
||||
private static Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> redirect_lambda$load$0(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) {
|
||||
return FakeSkinManager.loadSkinFromCache(sessionService, profile, requireSecure);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import customskinloader.fake.FakeSkinManager;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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.ModifyArgs;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
||||
|
||||
@Mixin(SkinManager.TextureCache.class)
|
||||
public abstract class MixinSkinManager$TextureCache {
|
||||
@Shadow
|
||||
private MinecraftProfileTexture.Type type;
|
||||
|
||||
@ModifyVariable(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At(
|
||||
value = "STORE",
|
||||
ordinal = 0
|
||||
),
|
||||
ordinal = 0
|
||||
)
|
||||
private ResourceLocation modifyVariable_registerTexture(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture) {
|
||||
return FakeSkinManager.setResourceLocation(resourceLocation, profileTexture);
|
||||
}
|
||||
|
||||
@ModifyArgs(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;",
|
||||
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_registerTexture(Args args, MinecraftProfileTexture profileTexture) {
|
||||
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), profileTexture, this.type);
|
||||
args.setAll(argsArr);
|
||||
}
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import customskinloader.fake.FakeSkinManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.SkinManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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.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.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
||||
|
||||
@SuppressWarnings("target")
|
||||
public abstract class MixinSkinManager {
|
||||
// 18w43b ~ 1.20.1
|
||||
@Mixin(SkinManager.class)
|
||||
public abstract static class V1 {
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;<init>(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void inject_init(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService, CallbackInfo callbackInfo) {
|
||||
FakeSkinManager.setSkinCacheDir(skinCacheDirectory);
|
||||
}
|
||||
|
||||
@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;",
|
||||
at = @At(
|
||||
value = "STORE",
|
||||
ordinal = 0
|
||||
),
|
||||
ordinal = 0
|
||||
)
|
||||
private ResourceLocation modifyVariable_loadSkin(ResourceLocation resourceLocation, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) {
|
||||
return FakeSkinManager.setResourceLocation(resourceLocation, profileTexture);
|
||||
}
|
||||
|
||||
@ModifyArg(
|
||||
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/resources/SkinManager$SkinAvailableCallback;skinAvailable(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V"
|
||||
)
|
||||
)
|
||||
private MinecraftProfileTexture modifyArg_loadSkin(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) {
|
||||
return FakeSkinManager.getModelCache(profileTexture, location);
|
||||
}
|
||||
|
||||
// 18w43b ~ 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), profileTexture, textureType);
|
||||
args.setAll(argsArr);
|
||||
}
|
||||
|
||||
// 19w38a ~ 1.20.1
|
||||
@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);
|
||||
}
|
||||
|
||||
// 18w43b ~ 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 ~ 1.20.1
|
||||
@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(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;loadSkinFromCache(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;",
|
||||
at = @At("HEAD"),
|
||||
cancellable = true
|
||||
)
|
||||
private void inject_loadSkinFromCache(GameProfile profile, CallbackInfoReturnable<Map<MinecraftProfileTexture.Type, MinecraftProfileTexture>> callbackInfoReturnable) {
|
||||
callbackInfoReturnable.setReturnValue(FakeSkinManager.loadSkinFromCache(profile));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
// 18w43b ~ 19w37a
|
||||
@Group(
|
||||
name = "loadElytraTexture",
|
||||
min = 1
|
||||
)
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;func_210276_a(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z",
|
||||
ordinal = 0,
|
||||
remap = false
|
||||
)
|
||||
)
|
||||
private void inject_func_210276_a(Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map, SkinManager.SkinAvailableCallback skinAvailableCallback, CallbackInfo callbackInfo) {
|
||||
FakeSkinManager.loadElytraTexture((SkinManager) (Object) this, map, skinAvailableCallback);
|
||||
}
|
||||
|
||||
// 19w38a ~ 1.20.1
|
||||
@Group(
|
||||
name = "loadElytraTexture",
|
||||
min = 1
|
||||
)
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;func_210276_a(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());
|
||||
}
|
||||
}
|
||||
|
||||
// 23w31a+
|
||||
@Mixin(SkinManager.class)
|
||||
public abstract static class V2 {
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;<init>(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/nio/file/Path;Lcom/mojang/authlib/minecraft/MinecraftSessionService;Ljava/util/concurrent/Executor;)V",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void inject_init(TextureManager textureManager, Path path, MinecraftSessionService minecraftSessionService, Executor executor, CallbackInfo callbackInfo) {
|
||||
FakeSkinManager.setSkinCacheDir(path);
|
||||
}
|
||||
|
||||
@ModifyArg(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;<init>(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/nio/file/Path;Lcom/mojang/authlib/minecraft/MinecraftSessionService;Ljava/util/concurrent/Executor;)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lcom/google/common/cache/CacheBuilder;build(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/LoadingCache;",
|
||||
remap = false
|
||||
)
|
||||
)
|
||||
private CacheLoader<Object, ?> modifyArg_init(CacheLoader<Object, ?> cacheLoader) {
|
||||
return FakeSkinManager.setCacheLoader(cacheLoader);
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;getInsecureSkin(Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin;",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void inject_getInsecureSkin(GameProfile profile, CallbackInfoReturnable<?> callbackInfoReturnable) {
|
||||
FakeSkinManager.setSkullType(profile);
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/resources/SkinManager;getOrLoad(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lcom/google/common/cache/LoadingCache;getUnchecked(Ljava/lang/Object;)Ljava/lang/Object;",
|
||||
remap = false
|
||||
)
|
||||
)
|
||||
private Object redirect_getOrLoad(LoadingCache<?, ?> loadingCache, Object cacheKey) throws Exception {
|
||||
return FakeSkinManager.loadCache(loadingCache, cacheKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package customskinloader.mixin;
|
||||
|
||||
import customskinloader.fake.FakeSkinBuffer;
|
||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
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.Redirect;
|
||||
|
||||
@SuppressWarnings("target")
|
||||
public abstract class MixinThreadDownloadImageData {
|
||||
@Mixin(ThreadDownloadImageData.class) // 19w38a ~ 1.17-rc1
|
||||
public abstract static class V1 {
|
||||
@Final
|
||||
@Shadow
|
||||
private Runnable processTask;
|
||||
|
||||
@Shadow
|
||||
private static NativeImage processLegacySkin(NativeImage nativeImageIn) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;loadTexture(Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;processLegacySkin(Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage;"
|
||||
)
|
||||
)
|
||||
private NativeImage redirect_loadTexture(NativeImage image) {
|
||||
return FakeSkinBuffer.processLegacySkin(image, this.processTask, MixinThreadDownloadImageData.V1::processLegacySkin);
|
||||
}
|
||||
}
|
||||
|
||||
@Mixin(ThreadDownloadImageData.class) // 1.17-rc2+
|
||||
public abstract static class V2 {
|
||||
@Final
|
||||
@Shadow
|
||||
private Runnable processTask;
|
||||
|
||||
@Shadow
|
||||
abstract NativeImage processLegacySkin(NativeImage nativeImageIn);
|
||||
|
||||
@Redirect(
|
||||
method = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;loadTexture(Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;processLegacySkin(Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/client/renderer/texture/NativeImage;"
|
||||
)
|
||||
)
|
||||
private NativeImage redirect_loadTexture(ThreadDownloadImageData _this, NativeImage image) {
|
||||
return FakeSkinBuffer.processLegacySkin(image, this.processTask, this::processLegacySkin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package net.minecraft.client.resources;
|
||||
|
||||
public class SkinManager$1 {
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package net.minecraft.client.resources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SkinManager {
|
||||
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { }
|
||||
public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { return null; }
|
||||
public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) { return null; }
|
||||
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { }
|
||||
public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile) { return null; }
|
||||
|
||||
public interface SkinAvailableCallback {
|
||||
void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||
}
|
||||
|
||||
public static class TextureCache {
|
||||
|
||||
}
|
||||
|
||||
public static class CacheKey {
|
||||
public GameProfile profile() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ net/minecraft/client/Minecraft net/minecraft/client/Minecraft
|
||||
getSkinManager ()Lnet/minecraft/client/resources/SkinManager; m_91109_
|
||||
getTextureManager ()Lnet/minecraft/client/renderer/texture/TextureManager; m_91097_
|
||||
net/minecraft/client/gui/GuiPlayerTabOverlay net/minecraft/client/gui/components/PlayerTabOverlay
|
||||
net/minecraft/client/gui/spectator/PlayerMenuObject net/minecraft/client/gui/spectator/PlayerMenuItem
|
||||
net/minecraft/client/multiplayer/ServerData net/minecraft/client/multiplayer/ServerData
|
||||
serverIP f_105363_
|
||||
net/minecraft/client/renderer/RenderType net/minecraft/client/renderer/RenderType
|
||||
@@ -49,12 +50,11 @@ net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resou
|
||||
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$1 net/minecraft/client/resources/SkinManager$1
|
||||
net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resources/SkinManager$CacheKey
|
||||
profile ()Lcom/mojang/authlib/GameProfile; f_290972_
|
||||
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
|
||||
skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V m_118856_
|
||||
net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache
|
||||
net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource
|
||||
net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager
|
||||
net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation
|
||||
|
||||
@@ -6,7 +6,10 @@ jar {
|
||||
])
|
||||
}
|
||||
|
||||
exclude 'net/minecraft/client/renderer/RenderType.class'
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'net/minecraft/client/resources/**'
|
||||
exclude 'net/minecraft/resources/**'
|
||||
}
|
||||
sourceJar {
|
||||
exclude 'com/**'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
minecraft_version=1.17.1
|
||||
minecraft_full_versions=1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2
|
||||
java_full_versions=16,17,18,19,20,21
|
||||
minecraft_full_versions=1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1
|
||||
java_full_versions=16,17,18
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+28
-118
@@ -35,26 +35,27 @@ function initializeCoreMod() {
|
||||
'name': 'net/minecraft/client/resources/SkinManager'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.fields.removeIf(function (fn) {
|
||||
return fn.name.equals("fakeManager") && fn.desc.equals("Lcustomskinloader/fake/FakeSkinManager;");
|
||||
});
|
||||
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;", null, null));
|
||||
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")) { // 1.20.1-
|
||||
if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.RETURN) {
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.NEW, "customskinloader/fake/FakeSkinManager"));
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkinCacheDir", "(Ljava/io/File;)V", false));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESPECIAL, "customskinloader/fake/FakeSkinManager", "<init>", "(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V", false));
|
||||
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/nio/file/Path;Lcom/mojang/authlib/minecraft/MinecraftSessionService;Ljava/util/concurrent/Executor;)V")) { // 1.20.2+
|
||||
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, 2));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkinCacheDir", "(Ljava/nio/file/Path;)V", false));
|
||||
} else if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("com/google/common/cache/CacheBuilder") && checkName(node.name, "build") && node.desc.equals("(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/LoadingCache;")) {
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setCacheLoader", "(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/CacheLoader;", false));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) { // 1.20.1-
|
||||
} else if (checkName(mn.name, "m_118828_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)Lnet/minecraft/resources/ResourceLocation;")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
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-
|
||||
@@ -64,8 +65,10 @@ function initializeCoreMod() {
|
||||
}
|
||||
|
||||
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;Lnet/minecraft/resources/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
|
||||
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"))) {
|
||||
@@ -78,9 +81,12 @@ function initializeCoreMod() {
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
|
||||
mn.instructions.insertBefore(node, new 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 MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)[Ljava/lang/Object;", false));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcustomskinloader/fake/FakeSkinManager;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)[Ljava/lang/Object;", false));
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
|
||||
@@ -96,7 +102,7 @@ function initializeCoreMod() {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) { // 1.20.1-
|
||||
} else if (checkName(mn.name, "m_118817_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;Z)V")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEINTERFACE
|
||||
@@ -108,7 +114,7 @@ function initializeCoreMod() {
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Ljava/lang/Runnable;Lcom/mojang/authlib/GameProfile;)V", false));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_118821_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) { // 1.20.1-
|
||||
} else if (checkName(mn.name, "m_118821_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
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;")) {
|
||||
@@ -116,7 +122,7 @@ function initializeCoreMod() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_174849_") && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) { // 1.20.1-
|
||||
} else if (checkName(mn.name, "m_174849_") && mn.desc.equals("(Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinTextureCallback;)V")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
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;")) {
|
||||
@@ -125,64 +131,13 @@ function initializeCoreMod() {
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "copyOf", "([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;"))
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) { // 1.20.1-
|
||||
} else if (checkName(mn.name, "m_118815_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) {
|
||||
var first = mn.instructions.getFirst();
|
||||
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
|
||||
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
|
||||
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN));
|
||||
} else if (checkName(mn.name, "m_293307_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin;")) { // 1.20.2+
|
||||
var first = mn.instructions.getFirst();
|
||||
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkullType", "(Lcom/mojang/authlib/GameProfile;)V", false));
|
||||
} else if (checkName(mn.name, "m_293351_") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;")) { // 1.20.2+
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/google/common/cache/LoadingCache") && checkName(node.name, "getUnchecked") && node.desc.equals("(Ljava/lang/Object;)Ljava/lang/Object;")) {
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadCache", "(Lcom/google/common/cache/LoadingCache;Ljava/lang/Object;)Ljava/lang/Object;", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
'SkinManager$1Transformer': { // 1.20.2+
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
'name': 'net/minecraft/client/resources/SkinManager$1'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (checkName(mn.name, "load") && mn.desc.equals("(Lnet/minecraft/client/resources/SkinManager$CacheKey;)Ljava/util/concurrent/CompletableFuture;")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKESTATIC && node.owner.equals("java/util/concurrent/CompletableFuture") && checkName(node.name, "supplyAsync") && node.desc.equals("(Ljava/util/function/Supplier;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;")) {
|
||||
var s = "(";
|
||||
var args = Type.getType(node.desc).getArgumentTypes();
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
s = s + "Ljava/lang/Object;";
|
||||
}
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/resources/SkinManager$CacheKey", mapName("f_290972_"), "()Lcom/mojang/authlib/GameProfile;", false));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadProfileTextures", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/GameProfile;)[Ljava/lang/Object;", false));
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.AALOAD));
|
||||
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
||||
}
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "m_293645_") && mn.desc.equals("(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo;")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEINTERFACE && node.owner.equals("com/mojang/authlib/minecraft/MinecraftSessionService") && checkName(node.name, "getTextures") && node.desc.equals("(Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;")) {
|
||||
mn.instructions.set(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;Z)Ljava/util/Map;", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return cn;
|
||||
@@ -242,51 +197,6 @@ function initializeCoreMod() {
|
||||
}
|
||||
},
|
||||
|
||||
'SkinManager$TextureCacheTransformer': { // 1.20.2+
|
||||
'target': {
|
||||
'type': 'METHOD',
|
||||
'class': 'net/minecraft/client/resources/SkinManager$TextureCache',
|
||||
'methodName': 'm_294542_',
|
||||
'methodDesc': '(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;'
|
||||
},
|
||||
'transformer': function (mn) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.INVOKEVIRTUAL && node.owner.equals("net/minecraft/client/resources/SkinManager$TextureCache") && checkName(node.name, "m_293729_") && node.desc.equals("(Ljava/lang/String;)Lnet/minecraft/resources/ResourceLocation;")) {
|
||||
mn.instructions.insert(node, node = new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
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));
|
||||
} else if (node.getOpcode() === Opcodes.INVOKESPECIAL && (node.owner.equals("net/minecraft/client/renderer/texture/HttpTexture") && checkName(node.name, "<init>") && node.desc.equals("(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/resources/ResourceLocation;ZLjava/lang/Runnable;)V"))) {
|
||||
var s = "(";
|
||||
var args = Type.getType(node.desc).getArgumentTypes();
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
s = s + "Ljava/lang/Object;";
|
||||
}
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false));
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/google/common/collect/ImmutableList", "of", s + ")Lcom/google/common/collect/ImmutableList;", false));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager$TextureCache", mapName("f_291290_"), "Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;"));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)[Ljava/lang/Object;", false));
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||
mn.instructions.insertBefore(node, new IntInsnNode(Opcodes.BIPUSH, i));
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.AALOAD));
|
||||
if (args[i].getInternalName().equals("Z")) {
|
||||
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, "java/lang/Boolean"));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false));
|
||||
} else {
|
||||
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.CHECKCAST, args[i].getInternalName()));
|
||||
}
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.SWAP));
|
||||
}
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.POP));
|
||||
}
|
||||
}
|
||||
return mn;
|
||||
}
|
||||
},
|
||||
'HttpTextureTransformer': {
|
||||
'target': {
|
||||
'type': 'METHOD',
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -6,9 +6,10 @@ jar {
|
||||
"TweakOrder": -10
|
||||
])
|
||||
}
|
||||
|
||||
exclude 'net/minecraft/client/renderer/texture/**'
|
||||
exclude 'net/minecraft/client/resources/SkinManager.class'
|
||||
exclude 'net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.class'
|
||||
exclude 'net/minecraft/resources/**'
|
||||
}
|
||||
sourceJar {
|
||||
exclude 'net/**'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
minecraft_version=1.12.2
|
||||
minecraft_full_versions=1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1,1.12.2,1.13.2,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21
|
||||
java_full_versions=8,9,10,11,12,13,14,15,16,17,18
|
||||
#forge gradle needs forge version
|
||||
forge_mc_version=1.12.2
|
||||
forge_version=14.23.5.2768
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+23
-16
@@ -3,6 +3,7 @@ var Handle = getJavaType('org.objectweb.asm.Handle');
|
||||
var Opcodes = getJavaType('org.objectweb.asm.Opcodes');
|
||||
var Type = getJavaType('org.objectweb.asm.Type');
|
||||
var FieldInsnNode = getJavaType('org.objectweb.asm.tree.FieldInsnNode');
|
||||
var FieldNode = getJavaType('org.objectweb.asm.tree.FieldNode');
|
||||
var InsnNode = getJavaType('org.objectweb.asm.tree.InsnNode');
|
||||
var IntInsnNode = getJavaType('org.objectweb.asm.tree.IntInsnNode');
|
||||
var InvokeDynamicInsnNode = getJavaType('org.objectweb.asm.tree.InvokeDynamicInsnNode');
|
||||
@@ -43,13 +44,24 @@ function initializeCoreMod() {
|
||||
'name': 'net/minecraft/client/resources/SkinManager'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
cn.fields.removeIf(function (fn) {
|
||||
return fn.name.equals("fakeManager") && fn.desc.equals("Lcustomskinloader/fake/FakeSkinManager;");
|
||||
});
|
||||
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;", null, null));
|
||||
|
||||
cn.methods.forEach(function (mn) {
|
||||
if (checkName(mn.name, "<init>") && mn.desc.equals("(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")) {
|
||||
for (var iterator = mn.instructions.iterator(); iterator.hasNext();) {
|
||||
var node = iterator.next();
|
||||
if (node.getOpcode() === Opcodes.RETURN) {
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(node, new TypeInsnNode(Opcodes.NEW, "customskinloader/fake/FakeSkinManager"));
|
||||
mn.instructions.insertBefore(node, new InsnNode(Opcodes.DUP));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 2));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "setSkinCacheDir", "(Ljava/io/File;)V", false));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESPECIAL, "customskinloader/fake/FakeSkinManager", "<init>", "(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V", false));
|
||||
mn.instructions.insertBefore(node, new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||
}
|
||||
}
|
||||
} else if (checkName(mn.name, "func_152789_a")
|
||||
@@ -66,8 +78,10 @@ function initializeCoreMod() {
|
||||
&& (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;Lnet/minecraft/util/ResourceLocation;)Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;", false));
|
||||
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
|
||||
@@ -87,9 +101,12 @@ function initializeCoreMod() {
|
||||
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 MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)[Ljava/lang/Object;", false));
|
||||
mn.instructions.insertBefore(node, new VarInsnNode(Opcodes.ALOAD, 3));
|
||||
mn.instructions.insertBefore(node, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "createThreadDownloadImageData", "(Lcom/google/common/collect/ImmutableList;Lcustomskinloader/fake/FakeSkinManager;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$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));
|
||||
@@ -154,8 +171,10 @@ function initializeCoreMod() {
|
||||
}
|
||||
} else if (checkName(mn.name, "func_152788_a") && mn.desc.equals("(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")) {
|
||||
var first = mn.instructions.getFirst();
|
||||
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(first, new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||
mn.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 1));
|
||||
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKESTATIC, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
|
||||
mn.instructions.insertBefore(first, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "customskinloader/fake/FakeSkinManager", "loadSkinFromCache", "(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
|
||||
mn.instructions.insertBefore(first, new InsnNode(Opcodes.ARETURN));
|
||||
}
|
||||
});
|
||||
@@ -185,18 +204,6 @@ function initializeCoreMod() {
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
'IImageBufferTransformer': {
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
'name': 'net/minecraft/client/renderer/IImageBuffer'
|
||||
},
|
||||
'transformer': function (cn) {
|
||||
if (!cn.interfaces.contains("customskinloader/fake/itf/IFakeIImageBuffer")) {
|
||||
cn.interfaces.add("customskinloader/fake/itf/IFakeIImageBuffer");
|
||||
}
|
||||
return cn;
|
||||
}
|
||||
},
|
||||
|
||||
// For 1.14+
|
||||
'MinecraftTransformer': {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-1
@@ -18,7 +18,6 @@ import org.objectweb.asm.tree.MethodNode;
|
||||
public class LaunchWrapper implements IClassTransformer {
|
||||
private static final TransformerManager.IClassTransformer[] CLASS_TRANSFORMERS = {
|
||||
new FakeInterfacesTransformer.MinecraftTransformer(),
|
||||
new FakeInterfacesTransformer.IImageBufferTransformer(),
|
||||
new FakeInterfacesTransformer.ThreadDownloadImageDataTransformer(),
|
||||
new FakeInterfacesTransformer.ClientIResourceTransformer(),
|
||||
new FakeInterfacesTransformer.ClientIResourceManagerTransformer(),
|
||||
File renamed without changes.
Loaded 100 of 162 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user